public void AddProcessMonitorData(ProcessMonitor monitor, object sender) { if (sender != null) { ((Form)sender).Invoke((MethodInvoker)delegate { addProcessMonitorData(monitor); }); return; } }
private void addProcessMonitorData(ProcessMonitor monitor) { }
private ProcessMonitor createNewProcessMonitor() { string targetName = ((List<string>)this.listBox_results.DataSource)[this.listBox_results.SelectedIndex]; bool? selectedMustRun = null; bool selectedCheckCpuUsage; int selectedCpuUsageRelative; int selectedCpuUsageValue; switch (this.comboBox_proc_mustRun.SelectedIndex) { case 0: selectedMustRun = true; break; case 1: selectedMustRun = false; break; case 2: selectedMustRun = null; break; } selectedCpuUsageValue = int.Parse(this.textBox_proc_cpuUsageValue.Text); selectedCpuUsageRelative = this.comboBox_proc_cpuUsageRelative.SelectedIndex; selectedCheckCpuUsage = this.checkBox_proc_cpuUsage.Checked; if (selectedMustRun == null && !selectedCheckCpuUsage) return null; ProcessMonitor monitor = new ProcessMonitor(this.textBox_monitorName.Text, targetName, this.textBox_machineName.Text, this.textBox_username.Text, this.textBox_password.Text, this.textBox_domain.Text, selectedMustRun, selectedCheckCpuUsage, selectedCpuUsageRelative, selectedCpuUsageValue); return monitor; }