From 7f51166d9e1ec3af0fa4e16610757917148f1c19 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Sun, 28 Jul 2024 14:15:55 +0400 Subject: [PATCH] Pre-launch verification is unconditional --- Form1.Designer.cs | 17 ----------------- Form1.cs | 8 ++------ 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 1ee9b15..d023abd 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -35,7 +35,6 @@ namespace Process_Auto_Relaunch this.groupBoxActions = new System.Windows.Forms.GroupBox(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.label1 = new System.Windows.Forms.Label(); - this.checkBoxCheckProcess = new System.Windows.Forms.CheckBox(); this.radioButtonRestartTimer = new System.Windows.Forms.RadioButton(); this.radioButtonRestartNow = new System.Windows.Forms.RadioButton(); this.buttonSetProgramStart = new System.Windows.Forms.Button(); @@ -78,7 +77,6 @@ namespace Process_Auto_Relaunch | System.Windows.Forms.AnchorStyles.Right))); this.groupBoxActions.Controls.Add(this.numericUpDown1); this.groupBoxActions.Controls.Add(this.label1); - this.groupBoxActions.Controls.Add(this.checkBoxCheckProcess); this.groupBoxActions.Controls.Add(this.radioButtonRestartTimer); this.groupBoxActions.Controls.Add(this.radioButtonRestartNow); this.groupBoxActions.Location = new System.Drawing.Point(13, 109); @@ -126,20 +124,6 @@ namespace Process_Auto_Relaunch this.label1.TabIndex = 4; this.label1.Text = "секунд"; // - // checkBoxCheckProcess - // - this.checkBoxCheckProcess.AutoSize = true; - this.checkBoxCheckProcess.Checked = global::RelaunchProcess.Properties.Settings.Default.checkBeforeStart; - this.checkBoxCheckProcess.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxCheckProcess.DataBindings.Add(new System.Windows.Forms.Binding("Checked", global::RelaunchProcess.Properties.Settings.Default, "checkBeforeStart", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.checkBoxCheckProcess.Location = new System.Drawing.Point(11, 78); - this.checkBoxCheckProcess.Margin = new System.Windows.Forms.Padding(4); - this.checkBoxCheckProcess.Name = "checkBoxCheckProcess"; - this.checkBoxCheckProcess.Size = new System.Drawing.Size(265, 20); - this.checkBoxCheckProcess.TabIndex = 2; - this.checkBoxCheckProcess.Text = "Проверять наличие перед запуском"; - this.checkBoxCheckProcess.UseVisualStyleBackColor = true; - // // radioButtonRestartTimer // this.radioButtonRestartTimer.AutoSize = true; @@ -466,7 +450,6 @@ namespace Process_Auto_Relaunch private GroupBox groupBoxActions; private Label label1; - private CheckBox checkBoxCheckProcess; private RadioButton radioButtonRestartTimer; private RadioButton radioButtonRestartNow; private Button buttonSetProgramStart; diff --git a/Form1.cs b/Form1.cs index 5c1446f..5337d55 100644 --- a/Form1.cs +++ b/Form1.cs @@ -315,20 +315,16 @@ namespace Process_Auto_Relaunch private void ProcessStart(string path, string args) { - if (checkBoxCheckProcess.Checked) + if (ProcessByNameIsRuning(path)) { - if (ProcessByNameIsRuning(path)) - { - // Процесс уже запущен return; - } } // Процесс не запущен WatchedProcess = Process.Start(path, args); cpuLastTime = 0; cpuMeasureTimer.Start(); - Status($"Процесс {ProcessName} был запущен.", NotifyLevel.logAlways); + Status($"Процесс {ProcessName} запущен.", NotifyLevel.logAlways); } private void BackgroundWorkerDoWork(object sender, System.ComponentModel.DoWorkEventArgs e)