/*********************************************************************************************
 * Copyright 2002 - Volian Enterprises, Inc. All rights reserved.
 * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
 * ------------------------------------------------------------------------------
 * $Workfile: Form1.cs $     $Revision: 5 $
 * $Author: Kathy $   $Date: 7/27/04 11:06a $
 *
 * $History: Form1.cs $
 * 
 * *****************  Version 5  *****************
 * User: Kathy        Date: 7/27/04    Time: 11:06a
 * Updated in $/LibSource/VlnStatus/Test
 * add spinner test
 * 
 * *****************  Version 4  *****************
 * User: Jsj          Date: 11/26/02   Time: 4:25p
 * Updated in $/LibSource/VlnStatus/Test
 * updated test
 * 
 * *****************  Version 3  *****************
 * User: Jsj          Date: 11/26/02   Time: 3:37p
 * Updated in $/LibSource/VlnStatus/Test
 * added header
 *********************************************************************************************/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using VlnStatus;
namespace Test
{
	/// 
	/// Test the status windows.
	/// 
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnTest;
		private System.Windows.Forms.Button btnStatMsg;
		private System.Windows.Forms.Button btnSpinner;
		/// 
		/// Required designer variable.
		/// 
		private System.ComponentModel.Container components = null;
		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
		}
		/// 
		/// Clean up any resources being used.
		/// 
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		#region Windows Form Designer generated code
		/// 
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// 
		private void InitializeComponent()
		{
			this.btnTest = new System.Windows.Forms.Button();
			this.btnStatMsg = new System.Windows.Forms.Button();
			this.btnSpinner = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// btnTest
			// 
			this.btnTest.Location = new System.Drawing.Point(208, 64);
			this.btnTest.Name = "btnTest";
			this.btnTest.Size = new System.Drawing.Size(120, 23);
			this.btnTest.TabIndex = 0;
			this.btnTest.Text = "Test Status Bar";
			this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
			// 
			// btnStatMsg
			// 
			this.btnStatMsg.Location = new System.Drawing.Point(32, 64);
			this.btnStatMsg.Name = "btnStatMsg";
			this.btnStatMsg.Size = new System.Drawing.Size(144, 23);
			this.btnStatMsg.TabIndex = 1;
			this.btnStatMsg.Text = "Test Status Message";
			this.btnStatMsg.Click += new System.EventHandler(this.btnStatMsg_Click);
			// 
			// btnSpinner
			// 
			this.btnSpinner.Location = new System.Drawing.Point(360, 64);
			this.btnSpinner.Name = "btnSpinner";
			this.btnSpinner.Size = new System.Drawing.Size(104, 24);
			this.btnSpinner.TabIndex = 2;
			this.btnSpinner.Text = "Test Spinner";
			this.btnSpinner.Click += new System.EventHandler(this.btnSpinner_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(504, 149);
			this.Controls.Add(this.btnSpinner);
			this.Controls.Add(this.btnStatMsg);
			this.Controls.Add(this.btnTest);
			this.Name = "Form1";
			this.Text = "Form1";
			this.ResumeLayout(false);
		}
		#endregion
		/// 
		/// The main entry point for the application.
		/// 
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}
		private void btnTest_Click(object sender, System.EventArgs e)
		{
			int j=0, cnt = 2000;
			string StatStr = "Processing j= ";
			string NewStatBoxTitle = "Status left to do: ";
//			VlnStatusBar StatWindow =  new VlnStatusBar();  // defaults to a title of "Status"
			VlnStatusBar StatWindow =  new VlnStatusBar("Test Status Bar Window");
			StatWindow.BarMax = 2000;
			StatWindow.BarStepValue = 1;
			StatWindow.BarValue = 0;
			for (j=1; j <= 2000; j++)
			{
				StatWindow.StatMsg = StatStr + j.ToString();
				// can also change the status box title on the fly
				StatWindow.StatusBoxTitle = NewStatBoxTitle + cnt.ToString();
//				StatWindow.PerformStep(j);
				StatWindow.PerformStep();
				for (int k=0; k<5000; k++);
				cnt--;
			}
			StatWindow.Dispose();
		}
		private void btnStatMsg_Click(object sender, System.EventArgs e)
		{
			int j=0, cnt =2000;
			string StatStr = "Processing j= ";
			string NewStatBoxTitle = "Status left to do: ";
//			VlnStatusMessage StatMsgWindow = new VlnStatusMessage(); // defaults to a title of "Status"
			VlnStatusMessage StatMsgWindow = new VlnStatusMessage("Test Status Message Window");
			for (j=1; j<= 2000; j++)
			{
				StatMsgWindow.StatusMessage = StatStr + j.ToString();
				// can also change the status box title on the fly
				StatMsgWindow.StatusBoxTitle = NewStatBoxTitle + cnt.ToString();
				for (int k=0; k < 5000; k++);
				cnt--;
			}
			StatMsgWindow.Dispose();
		}
		private void btnSpinner_Click(object sender, System.EventArgs e)
		{
			int cnt = 0;
			VlnSpinner spin = new VlnSpinner(2,25,"- Getting Lock Info for ","filename",true,true,true);
			while(spin.SpinnerWait(cnt>1000))
			{
				cnt++;
			}
			spin.Dispose();
		
		}
	}
}