www.pudn.com > HttpProxy.rar > MasterLog.cs


using System; 
using System.Data; 
using System.Drawing; 
using System.Collections; 
using System.ComponentModel; 
using System.Windows.Forms; 
using HttpProxy.Component; 
 
namespace HttpProxy.UI 
{ 
	///  
	/// MasterLog 类 
	///  
	public class MasterLog : System.Windows.Forms.Form 
	{ 
		internal static System.Windows.Forms.ListView lvMaster; 
		private System.Windows.Forms.Timer timerFill; 
		private System.ComponentModel.IContainer components; 
 
		private static System.Windows.Forms.ColumnHeader[] col; 
		internal static System.Windows.Forms.ListViewItem lvItem; 
 
		public MasterLog() 
		{ 
			// 
			// Windows 窗体设计器支持所必需的 
			// 
			InitializeComponent(); 
 
			//  
			// lvMaster 
			//  
			lvMaster = new System.Windows.Forms.ListView(); 
			lvMaster.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 
			lvMaster.Dock = System.Windows.Forms.DockStyle.Fill; 
			lvMaster.Location = new System.Drawing.Point(0, 0); 
			lvMaster.MultiSelect = false; 
			lvMaster.Name = "lvMaster"; 
			lvMaster.Size = new System.Drawing.Size(560, 296); 
			lvMaster.TabIndex = 0; 
			lvMaster.View = System.Windows.Forms.View.Details; 
			lvMaster.DoubleClick += new System.EventHandler(lvMaster_DoubleClick); 
 
			col=new ColumnHeader[]{new ColumnHeader(),new ColumnHeader(),new ColumnHeader(),new ColumnHeader()}; 
			col[0].Text="线程Id";			 
			col[0].TextAlign=HorizontalAlignment.Left; 
			col[0].Width=80; 
			col[1].Text="客户端"; 
			col[1].TextAlign=HorizontalAlignment.Left; 
			col[1].Width=180; 
			col[2].Text="远程Server"; 
			col[2].TextAlign=HorizontalAlignment.Left; 
			col[2].Width=180; 
			col[3].Text="启动时间"; 
			col[3].TextAlign=HorizontalAlignment.Left; 
			col[3].Width=120; 
			lvMaster.Columns.AddRange(col); 
			this.Controls.Add(lvMaster); 
		} 
 
		///  
		/// 清理所有正在使用的资源。 
		///  
		protected override void Dispose( bool disposing ) 
		{ 
			if( disposing ) 
			{ 
				if(components != null) 
				{ 
					components.Dispose(); 
				} 
			} 
			base.Dispose( disposing ); 
		} 
 
		#region Windows 窗体设计器生成的代码 
		///  
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改 
		/// 此方法的内容。 
		///  
		private void InitializeComponent() 
		{ 
			this.components = new System.ComponentModel.Container(); 
			 
			this.timerFill = new System.Windows.Forms.Timer(this.components); 
			this.SuspendLayout(); 
			 
			//  
			// timerFill 
			//  
			this.timerFill.Enabled = true; 
			this.timerFill.Interval = 5000; 
			this.timerFill.Tick += new System.EventHandler(this.timerFill_Tick); 
			//  
			// MasterLog 
			//  
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); 
			this.ClientSize = new System.Drawing.Size(560, 296); 
			this.ControlBox = false; 
			 
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 
			this.MaximizeBox = false; 
			this.Name = "MasterLog"; 
			this.ShowInTaskbar = false; 
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 
			this.Text = "主日志"; 
			this.Closing += new System.ComponentModel.CancelEventHandler(this.MasterLog_Closing); 
			this.ResumeLayout(false); 
 
		} 
		#endregion 
 
		///  
		/// Handles the Tick event of the timerFill control. 
		///  
		/// The source of the event. 
		/// The  instance containing the event data. 
		private void timerFill_Tick(object sender, System.EventArgs e) 
		{ 
			foreach(DataRow row in ProxyServer.dsLog.Tables["Parent"].Rows) 
			{ 
				lvItem=new ListViewItem(new string[]{row["ThreadID"].ToString(),row["Client"].ToString(),row["RemoteServer"].ToString(),row["StartTime"].ToString()}); 
				if(lvMaster.Items.Count<=0 || Convert.ToInt32(lvMaster.Items[lvMaster.Items.Count-1].SubItems[0].Text) 
		/// Shows the detail log. 
		///  
		private void ShowDetailLog() 
		{ 
			DetailLog.masterThreadId=lvMaster.SelectedItems[0].SubItems[0].Text; 
 
			if(ProxyMain.DetailLogOpen==false) 
			{ 
				DetailLog child=new DetailLog(); 
				child.MdiParent=ProxyMain.Global; 
				child.Show(); 
				ProxyMain.DetailLogOpen=true; 
			} 
			else 
			{				 
				for(int i=0;i 
		/// Handles the Closing event of the MasterLog control. 
		///  
		/// The source of the event. 
		/// The  instance containing the event data. 
		private void MasterLog_Closing(object sender, System.ComponentModel.CancelEventArgs e) 
		{ 
			ProxyMain.MasterLogOpen=false; 
		} 
	} 
}