Code Search for Developers
 
 
  

MaseUpdate.cs from MASE: Agile Software Engineering at Krugle


Show MaseUpdate.cs syntax highlighted

using System;
using System.Drawing;
using System.Collections;
using System.Threading;
using System.Windows.Forms;

using EStory;
using Whiteboard.MaseWS;
using New_Study_Project;

namespace Whiteboard
{
	/// <summary>
	/// Summary description for MaseUpdate.
	/// </summary>
	public class MaseUpdate
	{
		private static Queue updatedQueue = new Queue();
		public static int createId = -1;
		private static TabletVO[] selectedIterations;
		private static TabletVO productBacklog;
		private static webServicesService ws;
		private static Screen screen = Screen.PrimaryScreen;
		public static int S_width=screen.Bounds.Width;
		public static int S_height=screen.Bounds.Height;
		public const int appTypeClient = 2;
		public const int appTypeServer = 1;
		public static int appType = -1;

		public static void setSelectedIterations(TabletVO[] tabletVOs)
		{
			selectedIterations = tabletVOs;
		}

		public static TabletVO[] getSelectedIterations()
		{
			return selectedIterations;
		}

		public static void setProductBacklog(TabletVO tabletVO)
		{
			productBacklog = tabletVO;
		}

		public static TabletVO getProductBacklog()
		{
			return productBacklog;
		}

		public static void monitorUpdatedQueue()
		{
			bool stop = false;
			int timerInterval = 100;

			ws = SingleWS.getInstance(null);
			while(!stop)
			{
				try
				{
					Thread.Sleep(timerInterval);
				} 
				catch(Exception)
				{
					stop = true;
					timerInterval = 0;
				}

				if(updatedQueue.Count!=0)
				{		
					RegisterObj registerObj = null;
					while(updatedQueue.Count!=0)
					{
						registerObj = (RegisterObj)updatedQueue.Dequeue();
						TabletVO updatedTabletVO = registerObj.getTabVO();
						
						if(appType == appTypeServer)
						{
							updatedTabletVO.horizontalCenter.centerX = updatedTabletVO.horizontalCenter.centerX/MaseUpdate.S_width;
							updatedTabletVO.horizontalCenter.centerY = updatedTabletVO.horizontalCenter.centerY/MaseUpdate.S_height;
						}
						
						if(registerObj.getContentChangeType() == RegisterObj.UpdateStoryContent){
							ws.updateStoryCard(updatedTabletVO);
						}
						else if(registerObj.getContentChangeType() == RegisterObj.UpdateStoryLocation)
						{
							ws.updateIndividualStoryLocation(updatedTabletVO);
						}
						else if(registerObj.getContentChangeType()==RegisterObj.CreateStoryContent)
						{
							registerObj.getTabVO().tabletProcess.id = ws.createStory(updatedTabletVO);
						}
						else if(registerObj.getContentChangeType()==RegisterObj.CreateIterationContent)
						{
							registerObj.getTabVO().tabletProcess.id = ws.createInteration(updatedTabletVO);
							registerObj.getTabVO().iterationID = registerObj.getTabVO().tabletProcess.id;
						}
					}
					updatedQueue.Clear();
				}
			}
			
		}
		
		public MaseUpdate()
		{
		}
		
		public static void registerUpdated(InterfaceObject ifObj)
		{
			
			TabletVO movedStoryVO = null;
			movedStoryVO = ifObj.displayObj.getTabletVO();
			movedStoryVO.hostID = MaseListen.tabletClientId;

			bool locationChanged = false;
			Single dis_diffrange = 1.0f;
			
			if(Workspace.pulibWorkspaceOrNot == false)
				if(movedStoryVO.tabletProcess.id != Convert.ToInt64(EStoryForm.NotAssigned))
					return;

			if(Math.Abs(movedStoryVO.horizontalCenter.centerX - ifObj.getRNTObj().Center.X) > dis_diffrange)
			{
				movedStoryVO.horizontalCenter.centerX = ifObj.getRNTObj().Center.X;
				locationChanged = true;
			}
			if(Math.Abs(movedStoryVO.horizontalCenter.centerY - ifObj.getRNTObj().Center.Y) > dis_diffrange)
			{
				movedStoryVO.horizontalCenter.centerY = ifObj.getRNTObj().Center.Y;
				locationChanged = true;
			}
			if(movedStoryVO.horizontalCenter.rotationAngle != ifObj.getRNTObj().Angle)
			{
				movedStoryVO.horizontalCenter.rotationAngle = ifObj.getRNTObj().Angle;
				locationChanged = true;
			}
			TabletContentandUtil originalTabletContent = ifObj.displayObj.getOriginalTabletContent();
			bool contentChanged = !(originalTabletContent.Equals(movedStoryVO));
			int contentChangeType = 1;
			if(contentChanged == true || locationChanged == true)
			{
				if(contentChanged == true)
				{
					ifObj.displayObj.setOriginalTabletContent(new TabletContentandUtil(movedStoryVO));
					contentChangeType = RegisterObj.UpdateStoryContent;
				} 
				else
					contentChangeType = RegisterObj.UpdateStoryLocation;

				RegisterObj regObj = new RegisterObj(movedStoryVO, contentChangeType);
				updatedQueue.Enqueue(regObj);
			}
		}

		public static void registerUpdated(Spline spline, TabletVO currIteration)
		{
			//Update iteration territory location to Mase here
			if(Workspace.pulibWorkspaceOrNot == false)
				if(currIteration.tabletProcess.id != Convert.ToInt64(EStoryForm.NotAssigned))
					return;

			currIteration.horizontalCenter.centerX = spline.getCenter().X;
			currIteration.horizontalCenter.centerY = spline.getCenter().Y;
			currIteration.hostID = MaseListen.tabletClientId;
			RegisterObj registerObj = new RegisterObj(currIteration, RegisterObj.UpdateStoryLocation);
			updatedQueue.Enqueue(registerObj);
		}

		public static void registerUpdated(TabletVO updatedStoryVO, int contentChangeType)
		{
			if(Workspace.pulibWorkspaceOrNot == false)
				if(updatedStoryVO.tabletProcess.id != Convert.ToInt64(EStoryForm.NotAssigned))
					return;

			updatedStoryVO.hostID = MaseListen.tabletClientId;
			RegisterObj registerObj = new RegisterObj(updatedStoryVO, contentChangeType);
			updatedQueue.Enqueue(registerObj);
		}
	}
}




See more files for this project here

MASE: Agile Software Engineering

The MASE project investigates methods to support the coordination and executable acceptance testing of software projects. Keywords: Agile methods, distributed teams, Extreme Programming. See http://ebe.cpsc.ucalgary.ca/ebe for more information.

Project homepage: http://sourceforge.net/projects/mase
Programming language(s): Java,XML
License: other

  ApplicationProperties.cs
  CardLocationWith4Corners.cs
  HandWrittenObj.cs
  HandwrittenStoryCard.cs
  Iteration.cs
  Iteration.resx
  MaseListen.cs
  MaseUpdate.cs
  ProcessNode.cs
  ProjectNode.cs
  RegisterObj.cs
  Serializer.cs
  SingleWS.cs
  StoryObj.cs
  TabletContentandUtil.cs
  Utility.cs
  VLabel.cs
  VLabel.resx