⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 progressform.cs

📁 Cluster validation program including Dunn s index, Davies-Bouldin Index and Scat-Dis index.
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Threading;

namespace Cluster_Validations
{
	/// <summary>
	/// Summary description for ProgressForm.
	/// </summary>
	public class ProgressForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button button1;
		private Excel.Worksheet	m_worksheet;
		private bool			m_bGDI;
		private	bool			m_bDBI;
		private bool			m_bSDI;
		private string			m_strFileName;
		private	MainForm		m_mainForm;
		private System.Windows.Forms.ProgressBar m_ValidateProgressBar;

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public ProgressForm()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			// MainForm阑 Enable 矫挪促
			if ( this.m_mainForm != null )
				m_mainForm.Enabled	=	true;
		
			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.label1 = new System.Windows.Forms.Label();
			this.m_ValidateProgressBar = new System.Windows.Forms.ProgressBar();
			this.button1 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(264, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "柳青 荤亲";
			// 
			// m_ValidateProgressBar
			// 
			this.m_ValidateProgressBar.Location = new System.Drawing.Point(16, 24);
			this.m_ValidateProgressBar.Name = "m_ValidateProgressBar";
			this.m_ValidateProgressBar.Size = new System.Drawing.Size(264, 16);
			this.m_ValidateProgressBar.TabIndex = 3;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(16, 48);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(264, 24);
			this.button1.TabIndex = 2;
			this.button1.Text = "秒家";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// ProgressForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(292, 79);
			this.ControlBox = false;
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.button1,
																		  this.m_ValidateProgressBar,
																		  this.label1});
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "ProgressForm";
			this.Text = "Cluster Validate 角青";
			this.ResumeLayout(false);

		}
		#endregion

		private void button1_Click(object sender, System.EventArgs e) {
			this.Dispose();
		}

		/// <summary>
		/// Validate阑 矫累茄促
		/// </summary>
		/// <param name="data"></param>
		public void RunValidate( Excel.Worksheet worksheet, string fileName, bool bGDI, bool bDBI, bool bSDI, MainForm mainForm ){

			this.m_bDBI =	bDBI;
			this.m_bGDI	=	bGDI;
			this.m_bSDI	=	bSDI;
			this.m_strFileName	=	fileName;
			this.m_worksheet	=	worksheet;
			this.m_mainForm		=	mainForm;

			
			// DoModal 贸烦 青悼窍霸 茄促
			mainForm.Enabled	=	false;

			this.Show();
			
			// 拌魂窍绰 何盒篮 Thread肺 刀赋矫淖促
			// C#俊辑绰 捞犯霸 刀赋矫难具 UI俊 积扁绰 巩力啊 临绢电促
			Thread	ValidateThread = new Thread( new ThreadStart( startThread) );
			ValidateThread.Start();
		}

		private void startThread( ){	
			

			// 单捞磐 历厘
			ClusterLibrary.Data mData;
			this.InitProgressBar( "单捞磐甫 佬绢坷绊 乐嚼聪促" );
			this.m_mainForm.LoadData( this.m_worksheet, this.m_strFileName, this.m_ValidateProgressBar, out mData );
			this.TerminateProgressBar();

			// 搬苞 厘钎 檬扁拳
			this.InitProgressBar( "搬苞 厘钎甫 檬扁拳窍绊 乐嚼聪促" );
			this.m_mainForm.ClearResultListView( this.m_ValidateProgressBar );
			this.TerminateProgressBar();

			// 角力 拌魂窍绰 何盒
			ArrayList	GDIResultsSet;
			ArrayList	DBIResultsSet;
			ArrayList	SDIResults;

			if ( this.m_bGDI == true ){
				// GDI甫 拌魂窍绰 何盒
				this.InitProgressBar( "GDI甫 拌魂 吝涝聪促" );
				GDIResultsSet	=	this.m_mainForm.CalculateGDI ( mData, this.m_ValidateProgressBar );
				this.TerminateProgressBar();
				// GDI 搬苞甫 钎矫窍绰 何盒
				this.InitProgressBar( "GDI搬苞甫 钎矫窍绊 乐嚼聪促" );
				this.m_mainForm.DIsplayGDIResults( GDIResultsSet, this.m_ValidateProgressBar );
				this.TerminateProgressBar();
			}

			if ( this.m_bDBI == true ){
				// DBI甫 拌魂窍绰 何盒
				this.InitProgressBar( "DBI甫 拌魂 吝涝聪促" );
				DBIResultsSet	=	this.m_mainForm .CalculateDBI ( mData, this.m_ValidateProgressBar );
				this.TerminateProgressBar();
				// DBI 搬苞甫 钎矫窍绰 何盒
				this.InitProgressBar( "DBI搬苞甫 钎矫窍绊 乐嚼聪促" );
				this.m_mainForm.DIsplayDBIResults( DBIResultsSet, this.m_ValidateProgressBar );
				this.TerminateProgressBar();
			}

			if ( this.m_bSDI == true ){
				// SDI甫 拌魂窍绰 何盒
				this.InitProgressBar( "SDI甫 拌魂 吝涝聪促" );
				SDIResults	=	this.m_mainForm.CalculateSDI ( mData, this.m_ValidateProgressBar );
				this.TerminateProgressBar();
				// SDI 搬苞甫 钎矫窍绰 何盒
				this.InitProgressBar( "SDI搬苞甫 钎矫窍绊 乐嚼聪促" );
				this.m_mainForm.DIsplaySDIResults( SDIResults, this.m_ValidateProgressBar );
				this.TerminateProgressBar();
			}

			// 肯丰
			this.Hide();

			// DoModal 贸烦 青悼窍霸 茄促
			m_mainForm.Enabled	=	true;
		}

		private void InitProgressBar( string str ){
            this.label1.Text = str;
			this.m_ValidateProgressBar.Value	=	1;
		}

		private void TerminateProgressBar(){
			this.m_ValidateProgressBar.Value	=	this.m_ValidateProgressBar.Maximum;
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -