Click here to Skip to main content
15,893,161 members
Articles / Web Development / HTML

NTime - Performance unit testing tool

Rate me:
Please Sign up or sign in to vote.
4.73/5 (27 votes)
30 Mar 20066 min read 439.2K   8.2K   163  
An article on a performance testing tool to test an application against its performance
#region Copyright (c) 2004, Adam Slosarski
/************************************************************************************
'
' Copyright  2004 Adam Slosarski
'
' This software is provided 'as-is', without any express or implied warranty. In no 
' event will the authors be held liable for any damages arising from the use of this 
' software.
' 
' Permission is granted to anyone to use this software for any purpose, including 
' commercial applications, and to alter it and redistribute it freely, subject to the 
' following restrictions:
'
' 1. The origin of this software must not be misrepresented; you must not claim that 
' you wrote the original software. If you use this software in a product, an 
' acknowledgment (see the following) in the product documentation is required.
'
' Portions Copyright  2004 Adam Slosarski
'
' 2. Altered source versions must be plainly marked as such, and must not be 
' misrepresented as being the original software.
'
' 3. This notice may not be removed or altered from any source distribution.
'
'***********************************************************************************/
#endregion

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

using NTime.Framework;

namespace NTime.GUI
{
	/// <summary>
	/// Main NTime GUI form to interact with user.
	/// </summary>
	public class NTimeForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.Splitter splitter1;
		private System.Windows.Forms.ToolBar toolBar1;
		private System.Windows.Forms.ImageList imageList1;
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.ToolBarButton toolBarButton5;
		private System.Windows.Forms.MenuItem menuItem10;
		private System.Windows.Forms.MenuItem menuItem13;
		private System.Windows.Forms.MenuItem menuItem16;
		public System.Windows.Forms.MenuItem menuItem20;
		private System.Windows.Forms.MenuItem menuAbout;
		public System.Windows.Forms.MenuItem menuNewProject;
		public System.Windows.Forms.MenuItem menuOpen;
		public System.Windows.Forms.MenuItem menuSave;
		public System.Windows.Forms.MenuItem menuSaveAs;
		public System.Windows.Forms.MenuItem menuReload;
		public System.Windows.Forms.MenuItem menuRecent;
		public System.Windows.Forms.MenuItem menuExit;
		public System.Windows.Forms.MenuItem menuExpand;
		public System.Windows.Forms.MenuItem menuCollapse;
		public System.Windows.Forms.MenuItem menuExpandAll;
		public System.Windows.Forms.MenuItem menuCollapseAll;
		public System.Windows.Forms.MenuItem menuRun;
		public System.Windows.Forms.MenuItem menuStop;
		private System.ComponentModel.IContainer components;
		public System.Windows.Forms.TreeView TreeView;
		public System.Windows.Forms.MenuItem menuAddAssembly;
		private System.Windows.Forms.MenuItem menuItem6;
		private System.Windows.Forms.ImageList imageList2;
		public System.Windows.Forms.ToolBarButton toolBarRun;
		public System.Windows.Forms.ToolBarButton toolBarStop;
		public System.Windows.Forms.ToolBarButton toolBarNewProject;
		public System.Windows.Forms.ToolBarButton toolBarOpenProject;
		public System.Windows.Forms.ToolBarButton toolBarSave;
		public System.Windows.Forms.StatusBarPanel StatusBarPanelInfo;
		public System.Windows.Forms.StatusBarPanel StatusBarPanelTotal;
		public System.Windows.Forms.StatusBarPanel StatusBarPanelAccepted;
		public System.Windows.Forms.StatusBarPanel StatusBarPanelRejected;
		public System.Windows.Forms.StatusBarPanel StatusBarPanelTime;
		public System.Windows.Forms.StatusBar StatusBar;
		public System.Timers.Timer TimerQuery;
		public System.Timers.Timer TimerFile;
		public System.Windows.Forms.TextBox NodeInfo;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuOptions;

		public NTimeMain ntimeMain = new NTimeMain();

		/// <summary>
		/// Initializes main NTime tool gui form.
		/// </summary>
		public NTimeForm()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			ntimeMain.Form = this;
			ntimeMain.NewProject();
		}

		/// <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(NTimeForm));
			this.StatusBar = new System.Windows.Forms.StatusBar();
			this.StatusBarPanelInfo = new System.Windows.Forms.StatusBarPanel();
			this.StatusBarPanelTotal = new System.Windows.Forms.StatusBarPanel();
			this.StatusBarPanelAccepted = new System.Windows.Forms.StatusBarPanel();
			this.StatusBarPanelRejected = new System.Windows.Forms.StatusBarPanel();
			this.StatusBarPanelTime = new System.Windows.Forms.StatusBarPanel();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuNewProject = new System.Windows.Forms.MenuItem();
			this.menuOpen = new System.Windows.Forms.MenuItem();
			this.menuItem10 = new System.Windows.Forms.MenuItem();
			this.menuSave = new System.Windows.Forms.MenuItem();
			this.menuSaveAs = new System.Windows.Forms.MenuItem();
			this.menuItem13 = new System.Windows.Forms.MenuItem();
			this.menuReload = new System.Windows.Forms.MenuItem();
			this.menuRecent = new System.Windows.Forms.MenuItem();
			this.menuItem16 = new System.Windows.Forms.MenuItem();
			this.menuExit = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuExpand = new System.Windows.Forms.MenuItem();
			this.menuCollapse = new System.Windows.Forms.MenuItem();
			this.menuItem20 = new System.Windows.Forms.MenuItem();
			this.menuExpandAll = new System.Windows.Forms.MenuItem();
			this.menuCollapseAll = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.menuAddAssembly = new System.Windows.Forms.MenuItem();
			this.menuItem6 = new System.Windows.Forms.MenuItem();
			this.menuRun = new System.Windows.Forms.MenuItem();
			this.menuStop = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.menuAbout = new System.Windows.Forms.MenuItem();
			this.TreeView = new System.Windows.Forms.TreeView();
			this.imageList2 = new System.Windows.Forms.ImageList(this.components);
			this.splitter1 = new System.Windows.Forms.Splitter();
			this.toolBar1 = new System.Windows.Forms.ToolBar();
			this.toolBarNewProject = new System.Windows.Forms.ToolBarButton();
			this.toolBarOpenProject = new System.Windows.Forms.ToolBarButton();
			this.toolBarSave = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton5 = new System.Windows.Forms.ToolBarButton();
			this.toolBarRun = new System.Windows.Forms.ToolBarButton();
			this.toolBarStop = new System.Windows.Forms.ToolBarButton();
			this.imageList1 = new System.Windows.Forms.ImageList(this.components);
			this.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.NodeInfo = new System.Windows.Forms.TextBox();
			this.TimerFile = new System.Timers.Timer();
			this.TimerQuery = new System.Timers.Timer();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuOptions = new System.Windows.Forms.MenuItem();
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelInfo)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelTotal)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelAccepted)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelRejected)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelTime)).BeginInit();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.TimerFile)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.TimerQuery)).BeginInit();
			this.SuspendLayout();
			// 
			// StatusBar
			// 
			this.StatusBar.Location = new System.Drawing.Point(0, 403);
			this.StatusBar.Name = "StatusBar";
			this.StatusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
																						 this.StatusBarPanelInfo,
																						 this.StatusBarPanelTotal,
																						 this.StatusBarPanelAccepted,
																						 this.StatusBarPanelRejected,
																						 this.StatusBarPanelTime});
			this.StatusBar.ShowPanels = true;
			this.StatusBar.Size = new System.Drawing.Size(632, 22);
			this.StatusBar.TabIndex = 0;
			this.StatusBar.Text = "Ready";
			// 
			// StatusBarPanelInfo
			// 
			this.StatusBarPanelInfo.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
			this.StatusBarPanelInfo.Text = "Ready";
			this.StatusBarPanelInfo.Width = 186;
			// 
			// StatusBarPanelTotal
			// 
			this.StatusBarPanelTotal.Text = "Total Tests:";
			// 
			// StatusBarPanelAccepted
			// 
			this.StatusBarPanelAccepted.Text = "Accepted:";
			// 
			// StatusBarPanelRejected
			// 
			this.StatusBarPanelRejected.Text = "Rejected:";
			// 
			// StatusBarPanelTime
			// 
			this.StatusBarPanelTime.Text = "Time:";
			this.StatusBarPanelTime.Width = 130;
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem1,
																					  this.menuItem2,
																					  this.menuItem3,
																					  this.menuItem5});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuNewProject,
																					  this.menuOpen,
																					  this.menuItem10,
																					  this.menuSave,
																					  this.menuSaveAs,
																					  this.menuItem13,
																					  this.menuReload,
																					  this.menuRecent,
																					  this.menuItem16,
																					  this.menuExit});
			this.menuItem1.Text = "&File";
			// 
			// menuNewProject
			// 
			this.menuNewProject.Index = 0;
			this.menuNewProject.Shortcut = System.Windows.Forms.Shortcut.CtrlN;
			this.menuNewProject.Text = "&New Project";
			this.menuNewProject.Click += new System.EventHandler(this.menuNewProject_Click);
			// 
			// menuOpen
			// 
			this.menuOpen.Index = 1;
			this.menuOpen.Shortcut = System.Windows.Forms.Shortcut.CtrlO;
			this.menuOpen.Text = "&Open...";
			this.menuOpen.Click += new System.EventHandler(this.menuOpen_Click);
			// 
			// menuItem10
			// 
			this.menuItem10.Index = 2;
			this.menuItem10.Text = "-";
			// 
			// menuSave
			// 
			this.menuSave.Index = 3;
			this.menuSave.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
			this.menuSave.Text = "&Save";
			this.menuSave.Click += new System.EventHandler(this.menuSave_Click);
			// 
			// menuSaveAs
			// 
			this.menuSaveAs.Index = 4;
			this.menuSaveAs.Text = "Save &As...";
			this.menuSaveAs.Click += new System.EventHandler(this.menuSaveAs_Click);
			// 
			// menuItem13
			// 
			this.menuItem13.Index = 5;
			this.menuItem13.Text = "-";
			// 
			// menuReload
			// 
			this.menuReload.Index = 6;
			this.menuReload.Shortcut = System.Windows.Forms.Shortcut.CtrlR;
			this.menuReload.Text = "&Reload";
			this.menuReload.Click += new System.EventHandler(this.menuReload_Click);
			// 
			// menuRecent
			// 
			this.menuRecent.Enabled = false;
			this.menuRecent.Index = 7;
			this.menuRecent.Text = "Re&cent Files";
			this.menuRecent.Visible = false;
			// 
			// menuItem16
			// 
			this.menuItem16.Index = 8;
			this.menuItem16.Text = "-";
			// 
			// menuExit
			// 
			this.menuExit.Index = 9;
			this.menuExit.Text = "E&xit";
			this.menuExit.Click += new System.EventHandler(this.menuExit_Click);
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuExpand,
																					  this.menuCollapse,
																					  this.menuItem20,
																					  this.menuExpandAll,
																					  this.menuCollapseAll});
			this.menuItem2.Text = "&View";
			// 
			// menuExpand
			// 
			this.menuExpand.Index = 0;
			this.menuExpand.Text = "Expand";
			this.menuExpand.Click += new System.EventHandler(this.menuExpand_Click);
			// 
			// menuCollapse
			// 
			this.menuCollapse.Index = 1;
			this.menuCollapse.Text = "Collapse";
			this.menuCollapse.Click += new System.EventHandler(this.menuCollapse_Click);
			// 
			// menuItem20
			// 
			this.menuItem20.Index = 2;
			this.menuItem20.Text = "-";
			// 
			// menuExpandAll
			// 
			this.menuExpandAll.Index = 3;
			this.menuExpandAll.Text = "Expand All";
			this.menuExpandAll.Click += new System.EventHandler(this.menuExpandAll_Click);
			// 
			// menuCollapseAll
			// 
			this.menuCollapseAll.Index = 4;
			this.menuCollapseAll.Text = "Collapse All";
			this.menuCollapseAll.Click += new System.EventHandler(this.menuCollapseAll_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuAddAssembly,
																					  this.menuItem6,
																					  this.menuRun,
																					  this.menuStop,
																					  this.menuItem4,
																					  this.menuOptions});
			this.menuItem3.Text = "&Project";
			// 
			// menuAddAssembly
			// 
			this.menuAddAssembly.Index = 0;
			this.menuAddAssembly.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
			this.menuAddAssembly.Text = "&Add Assembly...";
			this.menuAddAssembly.Click += new System.EventHandler(this.menuAddAssembly_Click);
			// 
			// menuItem6
			// 
			this.menuItem6.Index = 1;
			this.menuItem6.Text = "-";
			// 
			// menuRun
			// 
			this.menuRun.Index = 2;
			this.menuRun.Shortcut = System.Windows.Forms.Shortcut.F5;
			this.menuRun.Text = "&Run";
			this.menuRun.Click += new System.EventHandler(this.menuRun_Click);
			// 
			// menuStop
			// 
			this.menuStop.Enabled = false;
			this.menuStop.Index = 3;
			this.menuStop.Text = "&Stop";
			this.menuStop.Click += new System.EventHandler(this.menuStop_Click);
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 3;
			this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuAbout});
			this.menuItem5.Text = "&Help";
			// 
			// menuAbout
			// 
			this.menuAbout.Index = 0;
			this.menuAbout.Text = "&About NTime...";
			this.menuAbout.Click += new System.EventHandler(this.menuAbout_Click);
			// 
			// TreeView
			// 
			this.TreeView.Dock = System.Windows.Forms.DockStyle.Left;
			this.TreeView.ImageIndex = 4;
			this.TreeView.ImageList = this.imageList2;
			this.TreeView.Location = new System.Drawing.Point(0, 26);
			this.TreeView.Name = "TreeView";
			this.TreeView.PathSeparator = ".";
			this.TreeView.Size = new System.Drawing.Size(248, 377);
			this.TreeView.TabIndex = 1;
			this.TreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeView_AfterSelect);
			// 
			// imageList2
			// 
			this.imageList2.ColorDepth = System.Windows.Forms.ColorDepth.Depth24Bit;
			this.imageList2.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList2.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList2.ImageStream")));
			this.imageList2.TransparentColor = System.Drawing.Color.Teal;
			// 
			// splitter1
			// 
			this.splitter1.Location = new System.Drawing.Point(248, 26);
			this.splitter1.Name = "splitter1";
			this.splitter1.Size = new System.Drawing.Size(3, 377);
			this.splitter1.TabIndex = 2;
			this.splitter1.TabStop = false;
			// 
			// toolBar1
			// 
			this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
			this.toolBar1.AutoSize = false;
			this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
																						this.toolBarNewProject,
																						this.toolBarOpenProject,
																						this.toolBarSave,
																						this.toolBarButton5,
																						this.toolBarRun,
																						this.toolBarStop});
			this.toolBar1.ButtonSize = new System.Drawing.Size(23, 22);
			this.toolBar1.DropDownArrows = true;
			this.toolBar1.ImageList = this.imageList1;
			this.toolBar1.Location = new System.Drawing.Point(0, 0);
			this.toolBar1.Name = "toolBar1";
			this.toolBar1.ShowToolTips = true;
			this.toolBar1.Size = new System.Drawing.Size(632, 26);
			this.toolBar1.TabIndex = 3;
			this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
			// 
			// toolBarNewProject
			// 
			this.toolBarNewProject.ImageIndex = 0;
			this.toolBarNewProject.ToolTipText = "New Project";
			// 
			// toolBarOpenProject
			// 
			this.toolBarOpenProject.ImageIndex = 1;
			this.toolBarOpenProject.ToolTipText = "Open";
			// 
			// toolBarSave
			// 
			this.toolBarSave.ImageIndex = 2;
			this.toolBarSave.ToolTipText = "Save";
			// 
			// toolBarButton5
			// 
			this.toolBarButton5.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
			// 
			// toolBarRun
			// 
			this.toolBarRun.ImageIndex = 3;
			this.toolBarRun.ToolTipText = "Run";
			// 
			// toolBarStop
			// 
			this.toolBarStop.Enabled = false;
			this.toolBarStop.ImageIndex = 4;
			this.toolBarStop.ToolTipText = "Stop";
			// 
			// imageList1
			// 
			this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
			this.imageList1.TransparentColor = System.Drawing.Color.Fuchsia;
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.tabControl1.Location = new System.Drawing.Point(251, 26);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(381, 377);
			this.tabControl1.TabIndex = 4;
			// 
			// tabPage1
			// 
			this.tabPage1.Controls.Add(this.NodeInfo);
			this.tabPage1.Location = new System.Drawing.Point(4, 22);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(373, 351);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "Test Information";
			// 
			// NodeInfo
			// 
			this.NodeInfo.Dock = System.Windows.Forms.DockStyle.Fill;
			this.NodeInfo.Location = new System.Drawing.Point(0, 0);
			this.NodeInfo.Multiline = true;
			this.NodeInfo.Name = "NodeInfo";
			this.NodeInfo.ReadOnly = true;
			this.NodeInfo.ScrollBars = System.Windows.Forms.ScrollBars.Both;
			this.NodeInfo.Size = new System.Drawing.Size(373, 351);
			this.NodeInfo.TabIndex = 0;
			this.NodeInfo.Text = "";
			// 
			// TimerFile
			// 
			this.TimerFile.Interval = 500;
			this.TimerFile.SynchronizingObject = this;
			this.TimerFile.Elapsed += new System.Timers.ElapsedEventHandler(this.Timer_Elapsed);
			// 
			// TimerQuery
			// 
			this.TimerQuery.Interval = 1000;
			this.TimerQuery.SynchronizingObject = this;
			this.TimerQuery.Elapsed += new System.Timers.ElapsedEventHandler(this.TimerQuery_Elapsed);
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 4;
			this.menuItem4.Text = "-";
			// 
			// menuOptions
			// 
			this.menuOptions.Index = 5;
			this.menuOptions.Text = "Options...";
			this.menuOptions.Click += new System.EventHandler(this.menuOptions_Click);
			// 
			// NTimeForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.CausesValidation = false;
			this.ClientSize = new System.Drawing.Size(632, 425);
			this.Controls.Add(this.tabControl1);
			this.Controls.Add(this.splitter1);
			this.Controls.Add(this.TreeView);
			this.Controls.Add(this.StatusBar);
			this.Controls.Add(this.toolBar1);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Menu = this.mainMenu1;
			this.Name = "NTimeForm";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "NTime";
			this.Closing += new System.ComponentModel.CancelEventHandler(this.NTimeForm_Closing);
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelInfo)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelTotal)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelAccepted)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelRejected)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.StatusBarPanelTime)).EndInit();
			this.tabControl1.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.TimerFile)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.TimerQuery)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new NTimeForm());
		}

		#region Toolbar Executor
		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			switch(toolBar1.Buttons.IndexOf(e.Button))
			{
				case 0:
					ntimeMain.NewProject();
					break; 
				case 1:
					ntimeMain.Open();
					break; 
				case 2:
					ntimeMain.Save();
					break; 
				case 4:
					ntimeMain.Run();
					break; 
				case 5:
					ntimeMain.Stop();
					break; 
			}

		}
		#endregion

		#region Menu Executor
		private void menuAbout_Click(object sender, System.EventArgs e)
		{
			new AboutBox().ShowDialog();
		}

		private void menuOpen_Click(object sender, System.EventArgs e)
		{
			ntimeMain.Open();
		}

		private void menuSave_Click(object sender, System.EventArgs e)
		{
			ntimeMain.Save();
		}

		private void menuSaveAs_Click(object sender, System.EventArgs e)
		{
			ntimeMain.SaveAs();
		}

		private void menuRun_Click(object sender, System.EventArgs e)
		{
			ntimeMain.Run();
		}

		private void menuStop_Click(object sender, System.EventArgs e)
		{
			ntimeMain.Stop();
		}

		private void menuExit_Click(object sender, System.EventArgs e)
		{
			Close();
		}

		private void menuReload_Click(object sender, System.EventArgs e)
		{
			ntimeMain.Reload();
		}

		private void menuAddAssembly_Click(object sender, System.EventArgs e)
		{
			ntimeMain.AddAssembly();
		}

		private void menuExpand_Click(object sender, System.EventArgs e)
		{
			if(TreeView.SelectedNode != null)
				TreeView.SelectedNode.Expand();
		}

		private void menuCollapse_Click(object sender, System.EventArgs e)
		{
			if(TreeView.SelectedNode != null)
				TreeView.SelectedNode.Collapse();
		}

		private void menuExpandAll_Click(object sender, System.EventArgs e)
		{
			TreeView.ExpandAll();
		}

		private void menuCollapseAll_Click(object sender, System.EventArgs e)
		{
			TreeView.CollapseAll();
		}

		private void menuNewProject_Click(object sender, System.EventArgs e)
		{
			ntimeMain.NewProject();
		}

		private void menuOptions_Click(object sender, System.EventArgs e)
		{
			ntimeMain.Options();
		}

		#endregion

		private void NTimeForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			e.Cancel = !ntimeMain.Close();
		}

		private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
		{
			TimerFile.Enabled = false;
			ntimeMain.Reload();
		}

		private void TimerQuery_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
		{
			ntimeMain.QueryTests();
		}

		private void TreeView_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
		{
			ntimeMain.ShowNodeInfo();
		}
	}
}

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.


Written By
Web Developer
Poland Poland
Born in Poland, living there as employeed developer, in free time writing much .net stuff and designing applications.

Comments and Discussions