Code Search for Developers
 
 
  

TabletUI.cs from MASE: Agile Software Engineering at Krugle


Show TabletUI.cs syntax highlighted

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Threading;
using Whiteboard;
using Whiteboard.MaseWS;
using EStory;
using New_Study_Project;

namespace TableWhiteboard_HCI_Intergration.HCI_Objs
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class TabletUI : System.Windows.Forms.Form
	{
		private Dashboard dashboard;
		private System.Windows.Forms.GroupBox groupBoxPublic;
		private System.Windows.Forms.GroupBox groupBoxPrivate;
		private System.Windows.Forms.TabControl tabControlPublic;
		private System.Windows.Forms.TabControl tabControlPrivate;
		CustomTreeView treeViewPublicSelectedIterations;
		CustomTreeView treeViewPublicUnselectedIterations;
		CustomTreeView treeViewPrivateSelectedIterations;
		CustomTreeView treeViewPrivateUnselectedIterations;
		private System.Windows.Forms.Button btNewTypedCard;
		private System.Windows.Forms.Button btNewHWCard;
		private System.Windows.Forms.TabPage tabPagePublicSelectedIteration;
		private System.Windows.Forms.TabPage tabPagePublicUnselectedIterations;
		private System.Windows.Forms.TabPage tabPagePrivateSelectedIterations;
		private System.Windows.Forms.TabPage tabPagePrivateUnselectedIterations;
		private System.Windows.Forms.ImageList imageList;
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.Timer timer1;
		
		CustomTreeNode[] tNodeForPublicSelectedIterations;
		CustomTreeNode[] tNodeForPublicUnselectedIterations;
		CustomTreeNode[] tNodeForPrivateSelectedIterations;
		CustomTreeNode[] tNodeForPrivateUnselectedIterations;
		CustomTreeNode destinationNode;
		CustomTreeNode passedNode;
		CustomTreeNode sourceNode;
		CustomTreeNode selectedNode;
		private EStoryForm eStoryForm;
		private DragDropEffects effectState;
		private const int publicDomain = 1;
		private const int privateDomain = 2;
		private const int noDomain = 0;
		private const int typedType = 0;
		private const int handWrittenType = 1;
		private int sourceDomain = 0;
		private int destinationDomain = 0;
		private Thread MASEUpdateThread;
		private Thread MASEListenThread;
		private TabletVO copyBeforeEdition;
		private bool updatable = false;

		#region Application Specific Data
		int num_of_selectedIterations = 0;
		int num_of_selectedIterationsIncludingProductBacklog = 0;
		int num_of_unselectedIterations = 0;
		ProjectVO selectedProject;
		TabletVO productBacklog;
		TabletVO[] productBacklogProcessList;
		TabletVO[] selectedIterations;
		TabletVO[] unselectedIterations;
		TabletVO[][] selectedIterationProcessList;
		TabletVO[][] unselectedIterationProcessList;
		int bugIndex = 0;
		int featureIndex = 0;
		int refactorIndex = 0;
		public const int iterationIndex = 4;
		#endregion
		
		private void populateApplicationData()
		{	
			int inclusionOfProductBacklogAsSelectedIteration = 1; 
			num_of_selectedIterations = dashboard.selectedIterations.Length;
			num_of_selectedIterationsIncludingProductBacklog = num_of_selectedIterations+inclusionOfProductBacklogAsSelectedIteration;
			num_of_unselectedIterations = dashboard.unselectedIterations.Length;
			selectedProject = dashboard.selectedProject;
			productBacklog = dashboard.productBacklog;
			productBacklogProcessList = dashboard.myBacklogList;
			selectedIterations = dashboard.selectedIterations;
			unselectedIterations = dashboard.unselectedIterations;
			selectedIterationProcessList = dashboard.myProcessList;
			unselectedIterationProcessList = dashboard.unselectedProcesList;
			bugIndex = EStory.EStoryForm.BUG;
			refactorIndex = EStory.EStoryForm.ENHANCEMENT;
			featureIndex = EStory.EStoryForm.FEATURE;
			tNodeForPublicSelectedIterations = new CustomTreeNode[num_of_selectedIterationsIncludingProductBacklog];
			tNodeForPublicUnselectedIterations = new CustomTreeNode[num_of_unselectedIterations]; 
			tNodeForPrivateSelectedIterations = new CustomTreeNode[num_of_selectedIterationsIncludingProductBacklog];
			tNodeForPrivateUnselectedIterations = new CustomTreeNode[num_of_unselectedIterations];
		}

		private void genChildTreeNodeCollection(CustomTreeNode parent, TabletVO[] childAry)
		{
			CustomTreeNode[] childTreeNodeAry = new CustomTreeNode[childAry.Length];
			for(int i=0; i< childAry.Length; i++)
			{
				int imageIndex = childAry[i].tabletProcess.activityType;
				childTreeNodeAry[i] = new CustomTreeNode(childAry[i]);
				parent.Nodes.Add(childTreeNodeAry[i]);
			}
		}

		private void populateTreeViews()
		{
			for(int i=0; i<num_of_unselectedIterations; i++)
			{
				tNodeForPrivateUnselectedIterations[i] = new CustomTreeNode(unselectedIterations[i]);
				//genChildTreeNodeCollection(tNodeForPrivateUnselectedIterations[i], unselectedIterationProcessList[i]);
				tNodeForPublicUnselectedIterations[i] = new CustomTreeNode(unselectedIterations[i]);
				genChildTreeNodeCollection(tNodeForPublicUnselectedIterations[i], unselectedIterationProcessList[i]);
			}
			tNodeForPrivateSelectedIterations[0] = new CustomTreeNode(productBacklog);
			//genChildTreeNodeCollection(tNodeForPrivateSelectedIterations[0], productBacklogProcessList);
			tNodeForPublicSelectedIterations[0] = new CustomTreeNode(productBacklog);
			genChildTreeNodeCollection(tNodeForPublicSelectedIterations[0], productBacklogProcessList);
			for(int i=0; i<num_of_selectedIterations; i++)
			{
				tNodeForPrivateSelectedIterations[i+1] = new CustomTreeNode(selectedIterations[i]);
				//genChildTreeNodeCollection(tNodeForPrivateSelectedIterations[i+1], selectedIterationProcessList[i]);
				tNodeForPublicSelectedIterations[i+1] = new CustomTreeNode(selectedIterations[i]);
				genChildTreeNodeCollection(tNodeForPublicSelectedIterations[i+1], selectedIterationProcessList[i]);
			}
			treeViewPublicSelectedIterations.Nodes.AddRange(tNodeForPublicSelectedIterations);
			treeViewPublicUnselectedIterations.Nodes.AddRange(tNodeForPublicUnselectedIterations);
			treeViewPrivateSelectedIterations.Nodes.AddRange(tNodeForPrivateSelectedIterations);
			treeViewPrivateUnselectedIterations.Nodes.AddRange(tNodeForPrivateUnselectedIterations);
			effectState = DragDropEffects.All;
		}

		public void prepareEStoryForm(int domain)
		{
			int iterationCount = dashboard.myIterationList.Length + 1;
			TabletVO productbacklog = dashboard.productBacklog;
			TabletVO[] iterations = new TabletVO[iterationCount];

			iterations[0] = productbacklog;
			int tempInt = 0;
			for(int index = 1; index < iterationCount; index++)
			{
				tempInt = index-1;
				iterations[index] = dashboard.myIterationList[tempInt];
			}
			string[] ebProcessTypes = new string[1];
			TabletVO updatedStoryVO = selectedNode.tabVO;
			if(domain == publicDomain)
				eStoryForm = new EStoryForm(selectedProject.id, iterations, ref updatedStoryVO, ebProcessTypes, new EventHandler(storyEditionPublicHandling));
			else 
				eStoryForm = new EStoryForm(selectedProject.id, iterations, ref updatedStoryVO, ebProcessTypes, new EventHandler(storyEditionPrivateHandling));
		}
		public void activateThreads()
		{
			if(MASEListenThread==null)
			{
				MaseListen.dashboard = this.dashboard;
				MASEListenThread = new Thread(new ThreadStart(MaseListen.startListening));
				MaseListen.registerCallback();
			}
			MASEListenThread.Start();
			if(MASEUpdateThread==null)
			{
				MaseUpdate.setSelectedIterations(dashboard.getSelectedIterations());
				MaseUpdate.setProductBacklog(dashboard.productBacklog);
				MASEUpdateThread = new Thread(new ThreadStart(MaseUpdate.monitorUpdatedQueue));
			}
			MASEUpdateThread.Start();
		}
		public TabletUI(Dashboard dashboard)
		{
			this.dashboard = dashboard;
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			timer1.Start();
			populateApplicationData();
			populateTreeViews();
			activateThreads();
			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(TabletUI));
			this.groupBoxPublic = new System.Windows.Forms.GroupBox();
			this.tabControlPublic = new System.Windows.Forms.TabControl();
			this.tabPagePublicSelectedIteration = new System.Windows.Forms.TabPage();
			this.treeViewPublicSelectedIterations = new TableWhiteboard_HCI_Intergration.HCI_Objs.CustomTreeView();
			this.imageList = new System.Windows.Forms.ImageList(this.components);
			this.tabPagePublicUnselectedIterations = new System.Windows.Forms.TabPage();
			this.treeViewPublicUnselectedIterations = new TableWhiteboard_HCI_Intergration.HCI_Objs.CustomTreeView();
			this.btNewTypedCard = new System.Windows.Forms.Button();
			this.btNewHWCard = new System.Windows.Forms.Button();
			this.groupBoxPrivate = new System.Windows.Forms.GroupBox();
			this.tabControlPrivate = new System.Windows.Forms.TabControl();
			this.tabPagePrivateSelectedIterations = new System.Windows.Forms.TabPage();
			this.treeViewPrivateSelectedIterations = new TableWhiteboard_HCI_Intergration.HCI_Objs.CustomTreeView();
			this.tabPagePrivateUnselectedIterations = new System.Windows.Forms.TabPage();
			this.treeViewPrivateUnselectedIterations = new TableWhiteboard_HCI_Intergration.HCI_Objs.CustomTreeView();
			this.timer1 = new System.Windows.Forms.Timer(this.components);
			this.groupBoxPublic.SuspendLayout();
			this.tabControlPublic.SuspendLayout();
			this.tabPagePublicSelectedIteration.SuspendLayout();
			this.tabPagePublicUnselectedIterations.SuspendLayout();
			this.groupBoxPrivate.SuspendLayout();
			this.tabControlPrivate.SuspendLayout();
			this.tabPagePrivateSelectedIterations.SuspendLayout();
			this.tabPagePrivateUnselectedIterations.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBoxPublic
			// 
			this.groupBoxPublic.Controls.Add(this.tabControlPublic);
			this.groupBoxPublic.Location = new System.Drawing.Point(8, 8);
			this.groupBoxPublic.Name = "groupBoxPublic";
			this.groupBoxPublic.Size = new System.Drawing.Size(408, 248);
			this.groupBoxPublic.TabIndex = 1;
			this.groupBoxPublic.TabStop = false;
			this.groupBoxPublic.Text = "Public Listing";
			// 
			// tabControlPublic
			// 
			this.tabControlPublic.AllowDrop = true;
			this.tabControlPublic.Controls.Add(this.tabPagePublicSelectedIteration);
			this.tabControlPublic.Controls.Add(this.tabPagePublicUnselectedIterations);
			this.tabControlPublic.ImageList = this.imageList;
			this.tabControlPublic.Location = new System.Drawing.Point(8, 16);
			this.tabControlPublic.Name = "tabControlPublic";
			this.tabControlPublic.SelectedIndex = 0;
			this.tabControlPublic.Size = new System.Drawing.Size(392, 224);
			this.tabControlPublic.TabIndex = 0;
			// 
			// tabPagePublicSelectedIteration
			// 
			this.tabPagePublicSelectedIteration.AllowDrop = true;
			this.tabPagePublicSelectedIteration.AutoScroll = true;
			this.tabPagePublicSelectedIteration.Controls.Add(this.treeViewPublicSelectedIterations);
			this.tabPagePublicSelectedIteration.Location = new System.Drawing.Point(4, 23);
			this.tabPagePublicSelectedIteration.Name = "tabPagePublicSelectedIteration";
			this.tabPagePublicSelectedIteration.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
			this.tabPagePublicSelectedIteration.Size = new System.Drawing.Size(384, 197);
			this.tabPagePublicSelectedIteration.TabIndex = 0;
			this.tabPagePublicSelectedIteration.Text = "Selected Iterations";
			// 
			// treeViewPublicSelectedIterations
			// 
			this.treeViewPublicSelectedIterations.AllowDrop = true;
			this.treeViewPublicSelectedIterations.ImageIndex = 3;
			this.treeViewPublicSelectedIterations.ImageList = this.imageList;
			this.treeViewPublicSelectedIterations.Location = new System.Drawing.Point(8, 7);
			this.treeViewPublicSelectedIterations.Name = "treeViewPublicSelectedIterations";
			this.treeViewPublicSelectedIterations.RightToLeft = System.Windows.Forms.RightToLeft.No;
			this.treeViewPublicSelectedIterations.SelectedImageIndex = 3;
			this.treeViewPublicSelectedIterations.Size = new System.Drawing.Size(368, 184);
			this.treeViewPublicSelectedIterations.TabIndex = 1;
			this.treeViewPublicSelectedIterations.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewPublicSelectedIterations_DragOver);
			this.treeViewPublicSelectedIterations.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewPublicSelectedIterations_DragDrop);
			this.treeViewPublicSelectedIterations.DoubleClick += new System.EventHandler(this.treeViewPublicSelectedIterations_DoubleClick);
			this.treeViewPublicSelectedIterations.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeViewPublicSelectedIterations_ItemDrag);
			this.treeViewPublicSelectedIterations.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeViewPublicSelectedIterations_DragEnter);
			// 
			// imageList
			// 
			this.imageList.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream")));
			this.imageList.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// tabPagePublicUnselectedIterations
			// 
			this.tabPagePublicUnselectedIterations.AllowDrop = true;
			this.tabPagePublicUnselectedIterations.AutoScroll = true;
			this.tabPagePublicUnselectedIterations.Controls.Add(this.treeViewPublicUnselectedIterations);
			this.tabPagePublicUnselectedIterations.Location = new System.Drawing.Point(4, 23);
			this.tabPagePublicUnselectedIterations.Name = "tabPagePublicUnselectedIterations";
			this.tabPagePublicUnselectedIterations.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
			this.tabPagePublicUnselectedIterations.Size = new System.Drawing.Size(384, 197);
			this.tabPagePublicUnselectedIterations.TabIndex = 1;
			this.tabPagePublicUnselectedIterations.Text = "Other Iterations";
			// 
			// treeViewPublicUnselectedIterations
			// 
			this.treeViewPublicUnselectedIterations.AllowDrop = true;
			this.treeViewPublicUnselectedIterations.ImageList = this.imageList;
			this.treeViewPublicUnselectedIterations.Location = new System.Drawing.Point(8, 7);
			this.treeViewPublicUnselectedIterations.Name = "treeViewPublicUnselectedIterations";
			this.treeViewPublicUnselectedIterations.Size = new System.Drawing.Size(368, 184);
			this.treeViewPublicUnselectedIterations.TabIndex = 1;
			this.treeViewPublicUnselectedIterations.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewPublicUnselectedIterations_DragOver);
			this.treeViewPublicUnselectedIterations.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewPublicUnselectedIterations_DragDrop);
			this.treeViewPublicUnselectedIterations.DoubleClick += new System.EventHandler(this.treeViewPublicUnselectedIterations_DoubleClick);
			this.treeViewPublicUnselectedIterations.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeViewPublicUnselectedIterations_ItemDrag);
			this.treeViewPublicUnselectedIterations.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeViewPublicUnselectedIterations_DragEnter);
			// 
			// btNewTypedCard
			// 
			this.btNewTypedCard.Location = new System.Drawing.Point(8, 512);
			this.btNewTypedCard.Name = "btNewTypedCard";
			this.btNewTypedCard.Size = new System.Drawing.Size(200, 40);
			this.btNewTypedCard.TabIndex = 3;
			this.btNewTypedCard.Text = "Create a new typed card";
			this.btNewTypedCard.Click += new System.EventHandler(this.btNewTypedCard_Click);
			// 
			// btNewHWCard
			// 
			this.btNewHWCard.Location = new System.Drawing.Point(216, 512);
			this.btNewHWCard.Name = "btNewHWCard";
			this.btNewHWCard.Size = new System.Drawing.Size(200, 40);
			this.btNewHWCard.TabIndex = 4;
			this.btNewHWCard.Text = "Create a new written card";
			this.btNewHWCard.Click += new System.EventHandler(this.btNewHWCard_Click);
			// 
			// groupBoxPrivate
			// 
			this.groupBoxPrivate.Controls.Add(this.tabControlPrivate);
			this.groupBoxPrivate.Location = new System.Drawing.Point(8, 256);
			this.groupBoxPrivate.Name = "groupBoxPrivate";
			this.groupBoxPrivate.Size = new System.Drawing.Size(408, 248);
			this.groupBoxPrivate.TabIndex = 5;
			this.groupBoxPrivate.TabStop = false;
			this.groupBoxPrivate.Text = "Private Listing";
			// 
			// tabControlPrivate
			// 
			this.tabControlPrivate.AllowDrop = true;
			this.tabControlPrivate.Controls.Add(this.tabPagePrivateSelectedIterations);
			this.tabControlPrivate.Controls.Add(this.tabPagePrivateUnselectedIterations);
			this.tabControlPrivate.ImageList = this.imageList;
			this.tabControlPrivate.Location = new System.Drawing.Point(8, 16);
			this.tabControlPrivate.Name = "tabControlPrivate";
			this.tabControlPrivate.SelectedIndex = 0;
			this.tabControlPrivate.Size = new System.Drawing.Size(392, 224);
			this.tabControlPrivate.TabIndex = 0;
			// 
			// tabPagePrivateSelectedIterations
			// 
			this.tabPagePrivateSelectedIterations.AllowDrop = true;
			this.tabPagePrivateSelectedIterations.AutoScroll = true;
			this.tabPagePrivateSelectedIterations.Controls.Add(this.treeViewPrivateSelectedIterations);
			this.tabPagePrivateSelectedIterations.Location = new System.Drawing.Point(4, 23);
			this.tabPagePrivateSelectedIterations.Name = "tabPagePrivateSelectedIterations";
			this.tabPagePrivateSelectedIterations.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
			this.tabPagePrivateSelectedIterations.Size = new System.Drawing.Size(384, 197);
			this.tabPagePrivateSelectedIterations.TabIndex = 0;
			this.tabPagePrivateSelectedIterations.Text = "Selected Iterations";
			// 
			// treeViewPrivateSelectedIterations
			// 
			this.treeViewPrivateSelectedIterations.AllowDrop = true;
			this.treeViewPrivateSelectedIterations.ImageList = this.imageList;
			this.treeViewPrivateSelectedIterations.Location = new System.Drawing.Point(8, 7);
			this.treeViewPrivateSelectedIterations.Name = "treeViewPrivateSelectedIterations";
			this.treeViewPrivateSelectedIterations.Size = new System.Drawing.Size(368, 184);
			this.treeViewPrivateSelectedIterations.TabIndex = 1;
			this.treeViewPrivateSelectedIterations.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewPrivateSelectedIterations_DragOver);
			this.treeViewPrivateSelectedIterations.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewPrivateSelectedIterations_DragDrop);
			this.treeViewPrivateSelectedIterations.DoubleClick += new System.EventHandler(this.treeViewPrivateSelectedIterations_DoubleClick);
			this.treeViewPrivateSelectedIterations.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeViewPrivateSelectedIterations_ItemDrag);
			this.treeViewPrivateSelectedIterations.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeViewPrivateSelectedIterations_DragEnter);
			// 
			// tabPagePrivateUnselectedIterations
			// 
			this.tabPagePrivateUnselectedIterations.AllowDrop = true;
			this.tabPagePrivateUnselectedIterations.AutoScroll = true;
			this.tabPagePrivateUnselectedIterations.Controls.Add(this.treeViewPrivateUnselectedIterations);
			this.tabPagePrivateUnselectedIterations.Location = new System.Drawing.Point(4, 23);
			this.tabPagePrivateUnselectedIterations.Name = "tabPagePrivateUnselectedIterations";
			this.tabPagePrivateUnselectedIterations.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
			this.tabPagePrivateUnselectedIterations.Size = new System.Drawing.Size(384, 197);
			this.tabPagePrivateUnselectedIterations.TabIndex = 1;
			this.tabPagePrivateUnselectedIterations.Text = "Other Iterations";
			this.tabPagePrivateUnselectedIterations.Visible = false;
			// 
			// treeViewPrivateUnselectedIterations
			// 
			this.treeViewPrivateUnselectedIterations.AllowDrop = true;
			this.treeViewPrivateUnselectedIterations.ImageList = this.imageList;
			this.treeViewPrivateUnselectedIterations.Location = new System.Drawing.Point(8, 7);
			this.treeViewPrivateUnselectedIterations.Name = "treeViewPrivateUnselectedIterations";
			this.treeViewPrivateUnselectedIterations.Size = new System.Drawing.Size(368, 184);
			this.treeViewPrivateUnselectedIterations.TabIndex = 1;
			this.treeViewPrivateUnselectedIterations.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewPrivateUnselectedIterations_DragOver);
			this.treeViewPrivateUnselectedIterations.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewPrivateUnselectedIterations_DragDrop);
			this.treeViewPrivateUnselectedIterations.DoubleClick += new System.EventHandler(this.treeViewPrivateUnselectedIterations_DoubleClick);
			this.treeViewPrivateUnselectedIterations.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeViewPrivateUnselectedIterations_ItemDrag);
			this.treeViewPrivateUnselectedIterations.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeViewPrivateUnselectedIterations_DragEnter);
			// 
			// timer1
			// 
			this.timer1.Interval = 1000;
			this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
			// 
			// TabletUI
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(424, 558);
			this.Controls.Add(this.groupBoxPrivate);
			this.Controls.Add(this.btNewTypedCard);
			this.Controls.Add(this.groupBoxPublic);
			this.Controls.Add(this.btNewHWCard);
			this.Name = "TabletUI";
			this.Text = "Tablet UI";
			this.Closed += new System.EventHandler(this.TabletUI_Closed);
			this.groupBoxPublic.ResumeLayout(false);
			this.tabControlPublic.ResumeLayout(false);
			this.tabPagePublicSelectedIteration.ResumeLayout(false);
			this.tabPagePublicUnselectedIterations.ResumeLayout(false);
			this.groupBoxPrivate.ResumeLayout(false);
			this.tabControlPrivate.ResumeLayout(false);
			this.tabPagePrivateSelectedIterations.ResumeLayout(false);
			this.tabPagePrivateUnselectedIterations.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		#region Drag Over 
		private void treeViewPrivateSelectedIterations_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
		{
			if(!(sourceDomain == publicDomain && destinationDomain == privateDomain))
				dragOver(sender, e, (CustomTreeNode)treeViewPrivateSelectedIterations.Nodes[0]);
		}
		private void treeViewPublicSelectedIterations_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
		{
			dragOver(sender, e, (CustomTreeNode)treeViewPublicSelectedIterations.Nodes[0]);
		}
		private void treeViewPublicUnselectedIterations_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
		{
			dragOver(sender, e, (CustomTreeNode)treeViewPublicUnselectedIterations.Nodes[0]);
		}
		private void treeViewPrivateUnselectedIterations_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
		{
			if(!(sourceDomain == publicDomain && destinationDomain == privateDomain))
				dragOver(sender, e, (CustomTreeNode)treeViewPrivateUnselectedIterations.Nodes[0]);
		}
		private void dragOver(object sender, System.Windows.Forms.DragEventArgs e, CustomTreeNode parentTreeNode)
		{
			e.Effect = effectState;
			CustomTreeNode aNode = FindPassedTreeNode(e.X, e.Y, parentTreeNode);
			if(aNode!= null)
			{
				if(aNode.Parent != null)
					aNode = (CustomTreeNode)aNode.Parent;

				aNode.BackColor = Color.DarkBlue;
				aNode.ForeColor = Color.White;
				if((passedNode != null)&&(passedNode != aNode))
				{
					passedNode.BackColor = Color.White;
					passedNode.ForeColor = Color.Black;
				}
				passedNode = aNode;
			}
		}
		#endregion
		#region Item Drag
		private void treeViewPublicSelectedIterations_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
		{
			itemDrag(sender, e, treeViewPublicSelectedIterations, publicDomain);
		}
		private void treeViewPrivateSelectedIterations_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
		{
			itemDrag(sender, e, treeViewPrivateSelectedIterations, privateDomain);
		}
		private void treeViewPrivateUnselectedIterations_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
		{
			itemDrag(sender, e, treeViewPrivateUnselectedIterations, privateDomain);
		}
		private void treeViewPublicUnselectedIterations_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
		{
			itemDrag(sender, e, treeViewPublicUnselectedIterations, publicDomain);
		}
		private void itemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e, TreeView trView, int domain)
		{
			sourceNode = (CustomTreeNode)e.Item;

			if(domain == publicDomain)
			{
				sourceDomain = publicDomain;
				destinationDomain = publicDomain;
			}
			else
			{
				sourceDomain = privateDomain;
				destinationDomain = privateDomain;
			}
			if(sourceNode.ImageIndex != iterationIndex)
			{
				trView.SelectedNode = sourceNode;
				DoDragDrop(imageList.Images[sourceNode.ImageIndex], effectState);
			}
		}
		#endregion
		#region Drag Drop
		private void treeViewPrivateSelectedIterations_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
		{
			if(!(sourceDomain == publicDomain && destinationDomain == privateDomain))
				dragDrop(sender, e, treeViewPrivateSelectedIterations, privateDomain);
		}
		private void treeViewPublicSelectedIterations_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
		{
			dragDrop(sender, e, treeViewPublicSelectedIterations, publicDomain);
		}
		private void treeViewPublicUnselectedIterations_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
		{
			dragDrop(sender, e, treeViewPublicUnselectedIterations, publicDomain);
		}
		private void treeViewPrivateUnselectedIterations_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
		{
			if(!(sourceDomain == publicDomain && destinationDomain == privateDomain))
				dragDrop(sender, e, treeViewPrivateUnselectedIterations, privateDomain);
		}
		private void dragDrop(object sender, System.Windows.Forms.DragEventArgs e, CustomTreeView trView, int domain)
		{
			if(passedNode.Parent != null)
				destinationNode = (CustomTreeNode)passedNode.Parent;
			else
				destinationNode = passedNode;

			trView.SelectedNode = destinationNode;

			if(sourceNode.tabVO.iterationID != destinationNode.tabVO.tabletProcess.id||sourceNode.tabVO.tabletProcess.id == EStoryForm.NotAssigned)
			{
				sourceNode.tabVO.iterationID  = destinationNode.tabVO.tabletProcess.id;
				if(!(sourceDomain == privateDomain && destinationDomain == privateDomain))
				{
					if(sourceNode.tabVO.tabletProcess.id == EStoryForm.NotAssigned)
						MaseUpdate.registerUpdated(sourceNode.tabVO, RegisterObj.CreateStoryContent);
					else
						MaseUpdate.registerUpdated(sourceNode.tabVO, RegisterObj.UpdateStoryContent);
				}
				sourceNode.Parent.Nodes.Remove(sourceNode);
				destinationNode.Nodes.Add(sourceNode);
			}
			sourceNode = null;
			passedNode = null;
			destinationNode = null;
			sourceDomain = noDomain;
			destinationDomain = noDomain;
		}
		#endregion
		#region Drag Enter
		private void treeViewPublicUnselectedIterations_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
		{
			dragEnter(sender, e, publicDomain);
		}
		private void treeViewPrivateSelectedIterations_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
		{
			dragEnter(sender, e, privateDomain);
		}
		private void treeViewPublicSelectedIterations_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
		{
			dragEnter(sender, e, publicDomain);
		}
		private void treeViewPrivateUnselectedIterations_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
		{
			dragEnter(sender, e, privateDomain);
		}
		private void dragEnter(object sender, System.Windows.Forms.DragEventArgs e, int domain)
		{
			if(domain == publicDomain)
				destinationDomain = publicDomain;
			else
				destinationDomain = privateDomain;
			
			if(!(sourceDomain == publicDomain && destinationDomain == privateDomain))
				e.Effect = effectState;
		}
		#endregion
		#region Double Click
		private void treeViewPublicSelectedIterations_DoubleClick(object sender, System.EventArgs e)
		{
			updatable = true;
			doubleClick(sender, e, treeViewPublicSelectedIterations, publicDomain);
		}

		private void treeViewPublicUnselectedIterations_DoubleClick(object sender, System.EventArgs e)
		{
			updatable = true;
			doubleClick(sender, e, treeViewPublicUnselectedIterations, publicDomain);
		}

		private void treeViewPrivateSelectedIterations_DoubleClick(object sender, System.EventArgs e)
		{
			updatable = false;
			doubleClick(sender, e, treeViewPrivateSelectedIterations, privateDomain);
		}

		private void treeViewPrivateUnselectedIterations_DoubleClick(object sender, System.EventArgs e)
		{
			updatable = false;
			doubleClick(sender, e, treeViewPrivateUnselectedIterations, privateDomain);
		}

		private void doubleClick(object sender, System.EventArgs e, TreeView trView, int domain)
		{
			this.selectedNode = (CustomTreeNode)trView.SelectedNode;
			if(selectedNode != null && selectedNode.ImageIndex != iterationIndex)
			{
				TabletContentandUtil tabUtil = new TabletContentandUtil(selectedNode.tabVO);
				copyBeforeEdition = tabUtil.makeDeepCopy();
				prepareEStoryForm(domain);
				eStoryForm.Show();
			}
		}
		#endregion

		private CustomTreeNode updateTreeView(CustomTreeView treeView, CustomTreeNode theNode, bool addOrNot)
		{
			CustomTreeNode startNode = (CustomTreeNode)treeView.Nodes[0];
			while(startNode!=null)
			{
				if(startNode.tabVO.tabletProcess.id == theNode.tabVO.iterationID)
				{
					if(addOrNot == true)
					{
						if(theNode.Parent != null)
							theNode.Parent.Nodes.Remove(theNode);
						startNode.Nodes.Add(theNode);
					}
					return startNode;
				}
				startNode = (CustomTreeNode)startNode.NextNode;
			}
			return null;
		}

		private void storyEditionPublicHandling(object sender, System.EventArgs e)
		{
			editStory(publicDomain);
		}

		private void storyEditionPrivateHandling(object sender, System.EventArgs e)
		{
			editStory(privateDomain);
		}

		private void editStory(int domain)
		{
			TabletContentandUtil tabUtil = new TabletContentandUtil(copyBeforeEdition);
			bool contentNotChanged = tabUtil.Equals(selectedNode.tabVO);
			if(contentNotChanged != true)
			{
				selectedNode.updateDisplayContent();
				
				if(domain == privateDomain)
				{
					if(updateTreeView(treeViewPrivateSelectedIterations, selectedNode, true) == null)
						updateTreeView(treeViewPrivateUnselectedIterations, selectedNode, true);			
				}
				else
				{
					if(updateTreeView(treeViewPublicSelectedIterations, selectedNode, true) == null)
						updateTreeView(treeViewPublicUnselectedIterations, selectedNode, true);	
				}
				
				if(updatable == true)
					MaseUpdate.registerUpdated(selectedNode.tabVO, RegisterObj.UpdateStoryContent);
			}
			copyBeforeEdition = null;
			selectedNode = null;
			updatable = false;
		}

		private void TabletUI_Closed(object sender, System.EventArgs e)
		{
			timer1.Stop();
			if(MASEUpdateThread.ThreadState.Equals(ThreadState.WaitSleepJoin&ThreadState.Suspended)||MASEUpdateThread.ThreadState.Equals(ThreadState.Suspended))
			{
				MASEUpdateThread.Resume();
			}
			if(MASEUpdateThread.ThreadState.Equals(ThreadState.WaitSleepJoin)||MASEUpdateThread.ThreadState.Equals(ThreadState.Running))
			{
				MASEUpdateThread.Interrupt();
			}
			if(MASEUpdateThread.IsAlive)
			{
				if(MASEUpdateThread.Join(10000))
				{
					MessageBox.Show("MASE updator thread terminats successfully.");
				}
				else
				{
					MessageBox.Show("MASE updator thread DOES not terminate properly. Time elapsed for 2 seconds.");
				}
			}
			MASEUpdateThread.Abort();

			if(MASEListenThread.ThreadState.Equals(ThreadState.WaitSleepJoin))
			{
				MASEListenThread.Interrupt();	
			}
			if(MASEListenThread.IsAlive)
			{
				if(MASEListenThread.Join(10000))
				{
					MessageBox.Show("MASE listener thread terminats successfully.");
				}
				else
				{
					MessageBox.Show("MASE listener thread DOES not terminate properly. Time elapsed for 2 seconds.");
				}
			}
			MASEListenThread.Abort();
		}

		private CustomTreeNode FindPassedTreeNode(int x, int y, CustomTreeNode rootNode)
		{
			CustomTreeNode aNode = rootNode;
			int publicClientSizeGap = 35;
			int privateClientSizeGap = 280;
			// somehow there is distance gap between the tree node on top and the tree node highligted

			Point pt = new Point(x,y);
			pt = PointToClient(pt);
			if(destinationDomain == publicDomain)
				pt.Y = pt.Y - publicClientSizeGap;
			else
				pt.Y = pt.Y - privateClientSizeGap;

			while(aNode != null)
			{
				if( aNode.Bounds.Contains(pt))
				{
					return aNode;
				}
				aNode = (CustomTreeNode)aNode.NextVisibleNode;
			}
			return null;
		}

		private void btNewTypedCard_Click(object sender, System.EventArgs e)
		{
			popNewStoryEditor(typedType);
		}

		private void btNewHWCard_Click(object sender, System.EventArgs e)
		{
			popNewStoryEditor(handWrittenType);
		}

		private void popNewStoryEditor(int storyType)
		{
			TabletContentandUtil newTabUtil = new TabletContentandUtil();
			if(storyType == typedType)
				newTabUtil.tabletVO.tabletProcess.handWritten = null;
			else
				newTabUtil.tabletVO.tabletProcess.handWritten = "";
			this.copyBeforeEdition = newTabUtil.makeDeepCopy();
			this.selectedNode = new CustomTreeNode(newTabUtil.makeDeepCopy());
			this.updatable = false;
			prepareEStoryForm(privateDomain);
			eStoryForm.Show();
		}

		private CustomTreeNode findCustomTreeNodeByTableVO(TreeView treeView, TabletVO tabVO)
		{
			CustomTreeNode itrNode = (CustomTreeNode)treeView.Nodes[0];
			while(itrNode != null)
			{
				CustomTreeNode chkStoryNode = (CustomTreeNode)itrNode.FirstNode;
				while(chkStoryNode != null)
				{
					if(chkStoryNode.tabVO.tabletProcess.id == tabVO.tabletProcess.id)
						return chkStoryNode;
					chkStoryNode = (CustomTreeNode)chkStoryNode.NextNode;
				}
				itrNode = (CustomTreeNode)itrNode.NextNode;
			}
			return null;
		}

		private void timer1_Tick(object sender, System.EventArgs e)
		{
			if(MaseListen.recevivedUpdateQueue.Count > 0)
			{
				MaseListenResult lstnResult = (MaseListenResult)MaseListen.recevivedUpdateQueue.Dequeue();
				if(lstnResult.updatedContentType == RegisterObj.CreateStoryContent)
				{
					TabletContentandUtil newTabUtil = new TabletContentandUtil();
					newTabUtil.tabletVO.tabletProcess.handWritten = null;
					this.copyBeforeEdition = newTabUtil.makeDeepCopy();
					this.selectedNode = new CustomTreeNode(newTabUtil.makeDeepCopy());
					this.updatable = false;
					this.selectedNode.tabVO = lstnResult.updatedTabletVOContent;
					editStory(publicDomain);
				} 
				else if(lstnResult.updatedContentType == RegisterObj.UpdateStoryContent)
				{
					CustomTreeNode updatedTreeNode = new CustomTreeNode(lstnResult.updatedTabletVOContent);
					CustomTreeNode existingTreeNode = findCustomTreeNodeByTableVO(treeViewPublicSelectedIterations, lstnResult.updatedTabletVOContent);
					if(existingTreeNode == null)
						existingTreeNode = findCustomTreeNodeByTableVO(treeViewPublicUnselectedIterations, lstnResult.updatedTabletVOContent);
					CustomTreeNode newParentTreeNode = updateTreeView(treeViewPublicSelectedIterations, updatedTreeNode, false);
					if(newParentTreeNode == null)
						newParentTreeNode = updateTreeView(treeViewPublicUnselectedIterations, updatedTreeNode, false);
					existingTreeNode.Parent.Nodes.Remove(existingTreeNode);
					newParentTreeNode.Nodes.Add(updatedTreeNode);
				}
			}
		}
	}
}




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

  ControlPoint.cs
  CustomTreeNode.cs
  CustomTreeView.cs
  Dashboard.cs
  Dashboard.resx
  EStoryForm.cs
  EStoryForm.resx
  IOSelectObject.cs
  InterfaceGrid.cs
  InterfaceObject.cs
  List.cs
  ListNode.cs
  LogFile.cs
  MenuForm.cs
  MenuForm.resx
  MoveAbleSpline.cs
  NonMoveAbleSpline.cs
  ObjectButton.cs
  Old_MoveAbleSpline.cs
  PenCalibration.cs
  PenCalibration.resx
  RNTObject.cs
  Spline.cs
  StartupScreen.cs
  StartupScreen.resx
  StorageButton.cs
  Study_Project.cs
  Study_Project.resx
  TabletUI.cs
  TabletUI.resx
  Workspace.cs
  Workspace.resx
  testCalibration.cs
  testCalibration.resx