Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

ToDoList Viewer - PocketPC Viewer for .dan.g's ToDoList

, 9 Aug 2004 CPOL
A read only viewer of the ToDoList XML for the PocketPC.
ToDoListViewer_setup.zip
Setup.msi
Setup.Exe
Setup.Ini
ToDoListViewer_src.zip
ToDoList Viewer
bin
Release
ToDoListViewer.exe
BuildCabs
Cabs
ToDoListViewer_PPC.inf
checked.bmp
CustomerInstaller
bin
Release
Cabs
CustomerInstaller.dll
setup.ini
Setup
Release
Setup.vdproj
ToDoList.ico
ToDoListViewer.csdproj
unchecked.bmp
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using System.Xml;
using System.Drawing.Imaging;

namespace TodoListViewer
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class frmMain : System.Windows.Forms.Form
	{
		private System.Windows.Forms.MainMenu mnuMain;
		private System.Windows.Forms.MenuItem mnuView;
		private System.Windows.Forms.MenuItem mnuViewAll;
		private System.Windows.Forms.MenuItem mnuViewActive;
		private System.Windows.Forms.MenuItem mnuViewComplete;
		private System.Windows.Forms.TreeView tvTodoList;

		private System.Windows.Forms.ImageList imglstTodo;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem mnuViewRefresh;
		private System.Windows.Forms.Panel pnlTask;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.ContextMenu mnuContext;
		private System.Windows.Forms.MenuItem mnuContextRefresh;
		private System.Windows.Forms.MenuItem mnuList;
		private System.Windows.Forms.MenuItem mnuListOpen;
		private System.Windows.Forms.Label lblProject;

		private string m_strFile;
		private int m_iLevel;
		private System.Windows.Forms.Panel pnlDetails;
		private System.Windows.Forms.TabControl tcDetails;
		private System.Windows.Forms.TabPage tpNotes;
		private System.Windows.Forms.TabPage tpDates;
		private System.Windows.Forms.TabPage tpDetails;
		private System.Windows.Forms.TextBox txtNotes;
		private System.Windows.Forms.MenuItem mnuViewDetails;
		private System.Windows.Forms.MenuItem mnuContextDetails;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox txtPriority;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox txtPercentComplete;
		private System.Windows.Forms.TextBox txtTimeEstimate;
		private System.Windows.Forms.TextBox txtAllocatedTo;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.TextBox txtStartDate;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.TextBox txtDueDate;
		private System.Windows.Forms.TextBox txtCompletedDate;
		private bool m_fNotes;

		public frmMain()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
		
			m_iLevel = 0;

			EnableDetailsView(false);

			txtNotes.Width = tpNotes.Width;
			txtNotes.Height = tpNotes.Height;

		}
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
			this.mnuMain = new System.Windows.Forms.MainMenu();
			this.mnuList = new System.Windows.Forms.MenuItem();
			this.mnuListOpen = new System.Windows.Forms.MenuItem();
			this.mnuView = new System.Windows.Forms.MenuItem();
			this.mnuViewAll = new System.Windows.Forms.MenuItem();
			this.mnuViewActive = new System.Windows.Forms.MenuItem();
			this.mnuViewComplete = new System.Windows.Forms.MenuItem();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.mnuViewDetails = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.mnuViewRefresh = new System.Windows.Forms.MenuItem();
			this.tvTodoList = new System.Windows.Forms.TreeView();
			this.mnuContext = new System.Windows.Forms.ContextMenu();
			this.mnuContextDetails = new System.Windows.Forms.MenuItem();
			this.mnuContextRefresh = new System.Windows.Forms.MenuItem();
			this.imglstTodo = new System.Windows.Forms.ImageList();
			this.pnlTask = new System.Windows.Forms.Panel();
			this.lblProject = new System.Windows.Forms.Label();
			this.pnlDetails = new System.Windows.Forms.Panel();
			this.tcDetails = new System.Windows.Forms.TabControl();
			this.tpDetails = new System.Windows.Forms.TabPage();
			this.txtAllocatedTo = new System.Windows.Forms.TextBox();
			this.txtTimeEstimate = new System.Windows.Forms.TextBox();
			this.txtPercentComplete = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.txtPriority = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.tpDates = new System.Windows.Forms.TabPage();
			this.txtCompletedDate = new System.Windows.Forms.TextBox();
			this.txtDueDate = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.txtStartDate = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.tpNotes = new System.Windows.Forms.TabPage();
			this.txtNotes = new System.Windows.Forms.TextBox();
			// 
			// mnuMain
			// 
			this.mnuMain.MenuItems.Add(this.mnuList);
			this.mnuMain.MenuItems.Add(this.mnuView);
			// 
			// mnuList
			// 
			this.mnuList.MenuItems.Add(this.mnuListOpen);
			this.mnuList.Text = "List";
			// 
			// mnuListOpen
			// 
			this.mnuListOpen.Text = "Open";
			this.mnuListOpen.Click += new System.EventHandler(this.mnuListOpen_Click);
			// 
			// mnuView
			// 
			this.mnuView.MenuItems.Add(this.mnuViewAll);
			this.mnuView.MenuItems.Add(this.mnuViewActive);
			this.mnuView.MenuItems.Add(this.mnuViewComplete);
			this.mnuView.MenuItems.Add(this.menuItem1);
			this.mnuView.MenuItems.Add(this.mnuViewDetails);
			this.mnuView.MenuItems.Add(this.menuItem2);
			this.mnuView.MenuItems.Add(this.mnuViewRefresh);
			this.mnuView.Text = "View";
			// 
			// mnuViewAll
			// 
			this.mnuViewAll.Checked = true;
			this.mnuViewAll.Text = "All";
			this.mnuViewAll.Click += new System.EventHandler(this.mnuViewAll_Click);
			// 
			// mnuViewActive
			// 
			this.mnuViewActive.Text = "Active";
			this.mnuViewActive.Click += new System.EventHandler(this.mnuViewActive_Click);
			// 
			// mnuViewComplete
			// 
			this.mnuViewComplete.Text = "Complete";
			this.mnuViewComplete.Click += new System.EventHandler(this.mnuViewComplete_Click);
			// 
			// menuItem1
			// 
			this.menuItem1.Text = "-";
			// 
			// mnuViewDetails
			// 
			this.mnuViewDetails.Text = "Details";
			this.mnuViewDetails.Click += new System.EventHandler(this.mnuViewDetails_Click);
			// 
			// menuItem2
			// 
			this.menuItem2.Text = "-";
			// 
			// mnuViewRefresh
			// 
			this.mnuViewRefresh.Text = "Refresh";
			this.mnuViewRefresh.Click += new System.EventHandler(this.mnuViewRefresh_Click);
			// 
			// tvTodoList
			// 
			this.tvTodoList.ContextMenu = this.mnuContext;
			this.tvTodoList.ImageList = this.imglstTodo;
			this.tvTodoList.Location = new System.Drawing.Point(0, 16);
			this.tvTodoList.Size = new System.Drawing.Size(240, 140);
			this.tvTodoList.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTodoList_AfterSelect);
			// 
			// mnuContext
			// 
			this.mnuContext.MenuItems.Add(this.mnuContextDetails);
			this.mnuContext.MenuItems.Add(this.mnuContextRefresh);
			// 
			// mnuContextDetails
			// 
			this.mnuContextDetails.Text = "Details";
			this.mnuContextDetails.Click += new System.EventHandler(this.mnuContextDetails_Click);
			// 
			// mnuContextRefresh
			// 
			this.mnuContextRefresh.Text = "Refresh";
			this.mnuContextRefresh.Click += new System.EventHandler(this.mnuContextRefresh_Click);
			// 
			// imglstTodo
			// 
			this.imglstTodo.Images.Add(((System.Drawing.Image)(resources.GetObject("resource"))));
			this.imglstTodo.Images.Add(((System.Drawing.Image)(resources.GetObject("resource1"))));
			this.imglstTodo.ImageSize = new System.Drawing.Size(16, 16);
			// 
			// pnlTask
			// 
			this.pnlTask.Controls.Add(this.lblProject);
			this.pnlTask.Controls.Add(this.tvTodoList);
			this.pnlTask.Size = new System.Drawing.Size(240, 156);
			// 
			// lblProject
			// 
			this.lblProject.ContextMenu = this.mnuContext;
			this.lblProject.Size = new System.Drawing.Size(240, 16);
			// 
			// pnlDetails
			// 
			this.pnlDetails.BackColor = System.Drawing.Color.White;
			this.pnlDetails.Controls.Add(this.tcDetails);
			this.pnlDetails.Location = new System.Drawing.Point(0, 156);
			this.pnlDetails.Size = new System.Drawing.Size(240, 112);
			// 
			// tcDetails
			// 
			this.tcDetails.ContextMenu = this.mnuContext;
			this.tcDetails.Controls.Add(this.tpDetails);
			this.tcDetails.Controls.Add(this.tpDates);
			this.tcDetails.Controls.Add(this.tpNotes);
			this.tcDetails.SelectedIndex = 0;
			this.tcDetails.Size = new System.Drawing.Size(240, 112);
			// 
			// tpDetails
			// 
			this.tpDetails.ContextMenu = this.mnuContext;
			this.tpDetails.Controls.Add(this.txtAllocatedTo);
			this.tpDetails.Controls.Add(this.txtTimeEstimate);
			this.tpDetails.Controls.Add(this.txtPercentComplete);
			this.tpDetails.Controls.Add(this.label4);
			this.tpDetails.Controls.Add(this.label3);
			this.tpDetails.Controls.Add(this.label2);
			this.tpDetails.Controls.Add(this.txtPriority);
			this.tpDetails.Controls.Add(this.label1);
			this.tpDetails.Location = new System.Drawing.Point(4, 4);
			this.tpDetails.Size = new System.Drawing.Size(232, 86);
			this.tpDetails.Text = "Details";
			// 
			// txtAllocatedTo
			// 
			this.txtAllocatedTo.ContextMenu = this.mnuContext;
			this.txtAllocatedTo.Location = new System.Drawing.Point(88, 56);
			this.txtAllocatedTo.ReadOnly = true;
			this.txtAllocatedTo.Size = new System.Drawing.Size(136, 22);
			this.txtAllocatedTo.Text = "";
			// 
			// txtTimeEstimate
			// 
			this.txtTimeEstimate.ContextMenu = this.mnuContext;
			this.txtTimeEstimate.Location = new System.Drawing.Point(88, 8);
			this.txtTimeEstimate.ReadOnly = true;
			this.txtTimeEstimate.Size = new System.Drawing.Size(48, 22);
			this.txtTimeEstimate.Text = "";
			// 
			// txtPercentComplete
			// 
			this.txtPercentComplete.ContextMenu = this.mnuContext;
			this.txtPercentComplete.Location = new System.Drawing.Point(88, 32);
			this.txtPercentComplete.ReadOnly = true;
			this.txtPercentComplete.Size = new System.Drawing.Size(48, 22);
			this.txtPercentComplete.Text = "";
			// 
			// label4
			// 
			this.label4.ContextMenu = this.mnuContext;
			this.label4.Location = new System.Drawing.Point(8, 57);
			this.label4.Size = new System.Drawing.Size(72, 20);
			this.label4.Text = "Allocated To";
			// 
			// label3
			// 
			this.label3.ContextMenu = this.mnuContext;
			this.label3.Location = new System.Drawing.Point(8, 8);
			this.label3.Size = new System.Drawing.Size(80, 20);
			this.label3.Text = "Time Est (hr)";
			// 
			// label2
			// 
			this.label2.ContextMenu = this.mnuContext;
			this.label2.Location = new System.Drawing.Point(16, 32);
			this.label2.Size = new System.Drawing.Size(72, 20);
			this.label2.Text = "% Complete";
			this.label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// txtPriority
			// 
			this.txtPriority.ContextMenu = this.mnuContext;
			this.txtPriority.Location = new System.Drawing.Point(192, 8);
			this.txtPriority.ReadOnly = true;
			this.txtPriority.Size = new System.Drawing.Size(32, 22);
			this.txtPriority.Text = "";
			// 
			// label1
			// 
			this.label1.ContextMenu = this.mnuContext;
			this.label1.Location = new System.Drawing.Point(144, 11);
			this.label1.Size = new System.Drawing.Size(48, 16);
			this.label1.Text = "Priority";
			// 
			// tpDates
			// 
			this.tpDates.ContextMenu = this.mnuContext;
			this.tpDates.Controls.Add(this.txtCompletedDate);
			this.tpDates.Controls.Add(this.txtDueDate);
			this.tpDates.Controls.Add(this.label7);
			this.tpDates.Controls.Add(this.txtStartDate);
			this.tpDates.Controls.Add(this.label6);
			this.tpDates.Controls.Add(this.label5);
			this.tpDates.Location = new System.Drawing.Point(4, 4);
			this.tpDates.Size = new System.Drawing.Size(232, 86);
			this.tpDates.Text = "Dates";
			// 
			// txtCompletedDate
			// 
			this.txtCompletedDate.ContextMenu = this.mnuContext;
			this.txtCompletedDate.Location = new System.Drawing.Point(112, 56);
			this.txtCompletedDate.ReadOnly = true;
			this.txtCompletedDate.Size = new System.Drawing.Size(112, 22);
			this.txtCompletedDate.Text = "";
			// 
			// txtDueDate
			// 
			this.txtDueDate.ContextMenu = this.mnuContext;
			this.txtDueDate.Location = new System.Drawing.Point(112, 32);
			this.txtDueDate.ReadOnly = true;
			this.txtDueDate.Size = new System.Drawing.Size(112, 22);
			this.txtDueDate.Text = "";
			// 
			// label7
			// 
			this.label7.ContextMenu = this.mnuContext;
			this.label7.Location = new System.Drawing.Point(8, 57);
			this.label7.Text = "Completed Date";
			this.label7.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// txtStartDate
			// 
			this.txtStartDate.ContextMenu = this.mnuContext;
			this.txtStartDate.Location = new System.Drawing.Point(112, 8);
			this.txtStartDate.ReadOnly = true;
			this.txtStartDate.Size = new System.Drawing.Size(112, 22);
			this.txtStartDate.Text = "";
			// 
			// label6
			// 
			this.label6.ContextMenu = this.mnuContext;
			this.label6.Location = new System.Drawing.Point(8, 33);
			this.label6.Text = "Due Date";
			this.label6.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// label5
			// 
			this.label5.ContextMenu = this.mnuContext;
			this.label5.Location = new System.Drawing.Point(8, 9);
			this.label5.Text = "Start Date";
			this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
			// 
			// tpNotes
			// 
			this.tpNotes.ContextMenu = this.mnuContext;
			this.tpNotes.Controls.Add(this.txtNotes);
			this.tpNotes.Location = new System.Drawing.Point(4, 4);
			this.tpNotes.Size = new System.Drawing.Size(232, 86);
			this.tpNotes.Text = "Notes";
			// 
			// txtNotes
			// 
			this.txtNotes.BackColor = System.Drawing.Color.White;
			this.txtNotes.ContextMenu = this.mnuContext;
			this.txtNotes.Multiline = true;
			this.txtNotes.ReadOnly = true;
			this.txtNotes.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.txtNotes.Size = new System.Drawing.Size(232, 80);
			this.txtNotes.Text = "";
			// 
			// frmMain
			// 
			this.Controls.Add(this.pnlDetails);
			this.Controls.Add(this.pnlTask);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Menu = this.mnuMain;
			this.Text = "ToDoList Viewer";

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>

		static void Main() 
		{
			Application.Run(new frmMain());
		}

		private void mnuListOpen_Click(object sender, System.EventArgs e)
		{
			OpenFileDialog ofdTodoList = new OpenFileDialog();

			ofdTodoList.InitialDirectory = "\\" ;
			ofdTodoList.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*" ;
			ofdTodoList.FilterIndex = 1 ;
			
			if(ofdTodoList.ShowDialog() == DialogResult.OK)
			{
				m_strFile = ofdTodoList.FileName;
				FillTree();
			}
		}

		private void FillTree()
		{
			XmlDocument xmlTodoList;
			XmlNode xndList;
			TreeNode tnParent;

			try
			{
				xmlTodoList = new XmlDocument();

				xmlTodoList.Load(m_strFile);

				tvTodoList.BeginUpdate();

				tvTodoList.Nodes.Clear();

				if(xmlTodoList.GetElementsByTagName("TODOLIST").Count > 0)
				{
					xndList = xmlTodoList.GetElementsByTagName("TODOLIST").Item(0);
					lblProject.Text = xndList.Attributes.GetNamedItem("PROJECTNAME").InnerText + " [v" + xndList.Attributes.GetNamedItem("FILEVERSION").InnerText + " - " + xndList.Attributes.GetNamedItem("LASTMODIFIED").InnerText + "]";

					if(xndList.HasChildNodes == true)
					{
						for(int i = 0; i < xndList.ChildNodes.Count; i++)
						{
							AppendTask(null, xndList.ChildNodes.Item(i));
						}
					}
				}

				tvTodoList.EndUpdate();
			}
			catch
			{
				tnParent = new TreeNode("Invalid Todo List File");
				tnParent.ImageIndex = 4;
				tnParent.SelectedImageIndex = 4;
				tvTodoList.Nodes.Add(tnParent);
				tnParent.Expand();
			}
		}

		private void AppendTask(TreeNode tnParent, XmlNode xndTask)
		{
			TreeNode tnChild;
			CTask clsTask;

			if(xndTask.Name.ToUpper() == "TASK")
			{
				clsTask = new CTask();

				clsTask.Title = xndTask.Attributes.GetNamedItem("TITLE").InnerText;
				
				if(xndTask.Attributes.GetNamedItem("PRIORITY") != null)
				{
					if(xndTask.Attributes.GetNamedItem("PRIORITY").InnerText.Length > 0)
					{
						clsTask.Priority = Convert.ToInt16(xndTask.Attributes.GetNamedItem("PRIORITY").InnerText);
					}
				}

				if(xndTask.Attributes.GetNamedItem("TIMEESTIMATE") != null)
				{
					if(xndTask.Attributes.GetNamedItem("TIMEESTIMATE").InnerText.Length > 0)
					{
						clsTask.HoursEst = Convert.ToSingle(xndTask.Attributes.GetNamedItem("TIMEESTIMATE").InnerText);
					}
				}

				if(xndTask.Attributes.GetNamedItem("PERCENTDONE") != null)
				{
					if(xndTask.Attributes.GetNamedItem("PERCENTDONE").InnerText.Length > 0)
					{
						clsTask.PercentComplete = Convert.ToInt16(xndTask.Attributes.GetNamedItem("PERCENTDONE").InnerText);
					}
				}

				if(xndTask.Attributes.GetNamedItem("PERSON") != null)
				{
					if(xndTask.Attributes.GetNamedItem("PERSON").InnerText.Length > 0)
					{
						clsTask.AllocatedTo = xndTask.Attributes.GetNamedItem("PERSON").InnerText;
					}
				}

				if(xndTask.Attributes.GetNamedItem("STARTDATESTRING") != null)
				{
					if(xndTask.Attributes.GetNamedItem("STARTDATESTRING").InnerText.Length > 0)
					{
						clsTask.StartDate = xndTask.Attributes.GetNamedItem("STARTDATESTRING").InnerText;
					}
				}

				if(xndTask.Attributes.GetNamedItem("DUEDATESTRING") != null)
				{
					if(xndTask.Attributes.GetNamedItem("DUEDATESTRING").InnerText.Length > 0)
					{
						clsTask.DueDate = xndTask.Attributes.GetNamedItem("DUEDATESTRING").InnerText;
					}
				}

				if(xndTask.Attributes.GetNamedItem("DONEDATESTRING") != null)
				{
					if(xndTask.Attributes.GetNamedItem("DONEDATESTRING").InnerText.Length > 0)
					{
						clsTask.CompleteDate = xndTask.Attributes.GetNamedItem("DONEDATESTRING").InnerText;
					}
				}

				if(xndTask.Attributes.GetNamedItem("DONEDATESTRING") != null)
				{
					clsTask.Complete = true;
				}
				else if(xndTask.Attributes.GetNamedItem("PERCENTDONE") != null)
				{
					if(xndTask.Attributes.GetNamedItem("PERCENTDONE").InnerText == "100")
					{
						clsTask.Complete = true;
					}
				}

				if(xndTask.Attributes.GetNamedItem("COMMENTS") != null)
				{
					if(xndTask.Attributes.GetNamedItem("COMMENTS").InnerText.Length > 0)
					{
						clsTask.Notes = xndTask.Attributes.GetNamedItem("COMMENTS").InnerText;
					}
				}


				tnChild = new TreeNode(clsTask.Title);
				tnChild.Tag = clsTask;

				if(xndTask.HasChildNodes == true)
				{
					for(int i = 0; i < xndTask.ChildNodes.Count; i++)
					{
						AppendTask(tnChild, xndTask.ChildNodes.Item(i));
					}
				}

				if(clsTask.Complete == false)
				{
					tnChild.ImageIndex = 0;
					tnChild.SelectedImageIndex = 0;
				}
				else
				{
					tnChild.ImageIndex = 1;
					tnChild.SelectedImageIndex = 1;
				}

				if((m_iLevel == 0) || ((m_iLevel == 1) && (clsTask.Complete == false)) || ((m_iLevel == 1) && (clsTask.Complete == true) && (tnChild.GetNodeCount(false) > 0)) || ((m_iLevel == 2) && (clsTask.Complete == true)) || ((m_iLevel == 2) && (clsTask.Complete == false) && (tnChild.GetNodeCount(false) > 0)))
				{
					if(tnParent == null)
					{
						tvTodoList.Nodes.Add(tnChild);
					}
					else
					{
						tnParent.Nodes.Add(tnChild);
					}
				}
			}
			else if(xndTask.Name.ToUpper() == "COMMENTS")
			{
				if(tnParent != null)
				{
					clsTask = (CTask)tnParent.Tag;
					clsTask.Notes = xndTask.InnerText;
					tnParent.Tag = clsTask;
				}
			}
		}

		private void mnuViewAll_Click(object sender, System.EventArgs e)
		{
			SetViewFilter(0);
		}

		private void mnuViewActive_Click(object sender, System.EventArgs e)
		{
			SetViewFilter(1);
		}
		
		private void mnuViewComplete_Click(object sender, System.EventArgs e)
		{
			SetViewFilter(2);
		}

		private void mnuViewRefresh_Click(object sender, System.EventArgs e)
		{
			FillTree();
		}

		private void mnuContextRefresh_Click(object sender, System.EventArgs e)
		{
			FillTree();
		}

		private void mnuViewDetails_Click(object sender, System.EventArgs e)
		{
			EnableDetailsView(!m_fNotes);
		}

		private void mnuContextDetails_Click(object sender, System.EventArgs e)
		{
			EnableDetailsView(!m_fNotes);
		}

		private void tvTodoList_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
		{
			CTask clsTask;

			if(e.Node.Tag != null)
			{
				clsTask = (CTask)e.Node.Tag;

				if (clsTask.Priority > 0)
				{
					txtPriority.Text = clsTask.Priority.ToString();
				}
				else
				{
					txtPriority.Text = "";
				}

				if (clsTask.HoursEst > 0)
				{
					txtTimeEstimate.Text = clsTask.HoursEst.ToString();
				}
				else
				{
					txtTimeEstimate.Text = "";
				}

				if(clsTask.PercentComplete > 0)
				{
					txtPercentComplete.Text = clsTask.PercentComplete.ToString();
				}
				else
				{
					txtPercentComplete.Text = "";
				}
				txtAllocatedTo.Text = clsTask.AllocatedTo;
				
				txtStartDate.Text = clsTask.StartDate;
				txtDueDate.Text = clsTask.DueDate;
				txtCompletedDate.Text = clsTask.CompleteDate;

				txtNotes.Text = clsTask.Notes;
			}
		}

		private void SetViewFilter(Int16 iLevel)
		{
			mnuViewAll.Checked = false;
			mnuViewActive.Checked = false;
			mnuViewComplete.Checked = false;

			if(iLevel == 0)
			{
				mnuViewAll.Checked = true;
			}
			else if(iLevel == 1)
			{
				mnuViewActive.Checked = true;
			}
			else if(iLevel == 2)
			{
				mnuViewComplete.Checked = true;
			}

			m_iLevel = iLevel;

			FillTree();
		}

		private void EnableDetailsView(bool fEnabled)
		{
			if(fEnabled == false)
			{
				//Turn it off
				pnlDetails.Visible = false;
				pnlTask.Height += pnlDetails.Height;
				tvTodoList.Height += pnlDetails.Height;
				mnuViewDetails.Checked = false;
				mnuContextDetails.Checked = false;

				m_fNotes = false;
			}
			else
			{
				//Turn it on
				pnlDetails.Visible = true;
				pnlTask.Height -= pnlDetails.Height;
				tvTodoList.Height -= pnlDetails.Height;
				mnuViewDetails.Checked = true;
				mnuContextDetails.Checked = true;

				m_fNotes = true;
			}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Kyle Tillman
Team Leader
United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150327.1 | Last Updated 10 Aug 2004
Article Copyright 2004 by Kyle Tillman
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid