private void startLogToolStripMenuItem_Click(object sender, EventArgs e) { if (this.PerfLoggingState == PerfLoggingStates.Not_Logging) { try { this.PerfLogPathDir = this.InstalledDirectory + @"\Log"; if (!Directory.Exists(this.PerfLogPathDir)) { Directory.CreateDirectory(this.PerfLogPathDir); } this.PerfLogFullPathName = this.PerfLogPathDir + @"\" + this.CreatePerformanceLogFileName(); PerfLogSW = File.CreateText(this.PerfLogFullPathName); this.LogFilePathListBox.Items.Add(this.PerfLogFullPathName); this.PrintTriggerValues(PerfLogSW); this.PrintSystemEnvironmentInformation(PerfLogSW); this.timer1.Interval = 0x3e8; this.timer1.Start(); this.PerfLoggingState = PerfLoggingStates.Logging; this.performaceLogStatusLabel.Text = this.PerfLoggingState.ToString(); this.LogStartTime = DateTime.Now; } catch (Exception exception) { MessageBox.Show(exception.ToString()); } } else { MessageBox.Show("Logging has already started"); } }
private void stopLogToolStripMenuItem_Click(object sender, EventArgs e) { if (this.PerfLoggingState == PerfLoggingStates.Logging) { this.timer1.Stop(); this.PerfLoggingState = PerfLoggingStates.Stopped; this.performaceLogStatusLabel.Text = this.PerfLoggingState.ToString(); } }
private void PerformanceMonitorForm_FormClosing(object sender, FormClosingEventArgs e) { bool flag = true; if (((e.CloseReason == CloseReason.UserClosing) && (this.PerfLoggingState == PerfLoggingStates.Logging)) && (MessageBox.Show("Closing the Performance Monitor will stop logging.\r\rIs this what you want?", "Stopping Logging", MessageBoxButtons.YesNo) == DialogResult.No)) { e.Cancel = true; flag = false; } if (flag) { SavePerformanceMonitorParameters(); this.performanceMonitorMenuItem.Enabled = true; this.PerfLoggingState = PerfLoggingStates.Stopped; this.timer1.Stop(); } }
private void PerformanceMonitorForm_Load(object sender, EventArgs e) { this.PerfLoggingState = PerfLoggingStates.Not_Logging; this.performaceLogStatusLabel.Text = this.PerfLoggingState.ToString(); if (!RestorePerformanceMonitorParameters()) { this.PerfTrigger_TimeInterval = true; this.PerfTrigger_TotalCPUUsage = false; this.PerfTRigger_SiRFLiveCPUUsage = false; this.PerfTrigger_TotalPhysMemory = false; this.PerfTrigger_SiRFLivePhysMemory = false; this.PerfTrigger_VirtualMemoryUsage = false; this.TimeInterval = 1; this.TotalCPUUsagePercentage = 50.0; this.SiRFLiveCPUUsagePercentage = 50.0; this.PhysicalMemoryUsagePercentage = 50.0; this.SiRFLivePhysicalMemoryUsagePercentage = 50.0; this.VirtualMemoryUsagePercentage = 50.0; } if (this.performanceMonitorMenuItem != null) { this.performanceMonitorMenuItem.Enabled = false; } }