mirror of
https://github.com/SlothDpal/Relaunch-Process.git
synced 2026-02-22 17:27:38 +03:00
Pre-launch verification is unconditional
This commit is contained in:
17
Form1.Designer.cs
generated
17
Form1.Designer.cs
generated
@@ -35,7 +35,6 @@ namespace Process_Auto_Relaunch
|
|||||||
this.groupBoxActions = new System.Windows.Forms.GroupBox();
|
this.groupBoxActions = new System.Windows.Forms.GroupBox();
|
||||||
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.checkBoxCheckProcess = new System.Windows.Forms.CheckBox();
|
|
||||||
this.radioButtonRestartTimer = new System.Windows.Forms.RadioButton();
|
this.radioButtonRestartTimer = new System.Windows.Forms.RadioButton();
|
||||||
this.radioButtonRestartNow = new System.Windows.Forms.RadioButton();
|
this.radioButtonRestartNow = new System.Windows.Forms.RadioButton();
|
||||||
this.buttonSetProgramStart = new System.Windows.Forms.Button();
|
this.buttonSetProgramStart = new System.Windows.Forms.Button();
|
||||||
@@ -78,7 +77,6 @@ namespace Process_Auto_Relaunch
|
|||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.groupBoxActions.Controls.Add(this.numericUpDown1);
|
this.groupBoxActions.Controls.Add(this.numericUpDown1);
|
||||||
this.groupBoxActions.Controls.Add(this.label1);
|
this.groupBoxActions.Controls.Add(this.label1);
|
||||||
this.groupBoxActions.Controls.Add(this.checkBoxCheckProcess);
|
|
||||||
this.groupBoxActions.Controls.Add(this.radioButtonRestartTimer);
|
this.groupBoxActions.Controls.Add(this.radioButtonRestartTimer);
|
||||||
this.groupBoxActions.Controls.Add(this.radioButtonRestartNow);
|
this.groupBoxActions.Controls.Add(this.radioButtonRestartNow);
|
||||||
this.groupBoxActions.Location = new System.Drawing.Point(13, 109);
|
this.groupBoxActions.Location = new System.Drawing.Point(13, 109);
|
||||||
@@ -126,20 +124,6 @@ namespace Process_Auto_Relaunch
|
|||||||
this.label1.TabIndex = 4;
|
this.label1.TabIndex = 4;
|
||||||
this.label1.Text = "секунд";
|
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
|
// radioButtonRestartTimer
|
||||||
//
|
//
|
||||||
this.radioButtonRestartTimer.AutoSize = true;
|
this.radioButtonRestartTimer.AutoSize = true;
|
||||||
@@ -466,7 +450,6 @@ namespace Process_Auto_Relaunch
|
|||||||
|
|
||||||
private GroupBox groupBoxActions;
|
private GroupBox groupBoxActions;
|
||||||
private Label label1;
|
private Label label1;
|
||||||
private CheckBox checkBoxCheckProcess;
|
|
||||||
private RadioButton radioButtonRestartTimer;
|
private RadioButton radioButtonRestartTimer;
|
||||||
private RadioButton radioButtonRestartNow;
|
private RadioButton radioButtonRestartNow;
|
||||||
private Button buttonSetProgramStart;
|
private Button buttonSetProgramStart;
|
||||||
|
|||||||
8
Form1.cs
8
Form1.cs
@@ -315,20 +315,16 @@ namespace Process_Auto_Relaunch
|
|||||||
|
|
||||||
private void ProcessStart(string path, string args)
|
private void ProcessStart(string path, string args)
|
||||||
{
|
{
|
||||||
if (checkBoxCheckProcess.Checked)
|
if (ProcessByNameIsRuning(path))
|
||||||
{
|
{
|
||||||
if (ProcessByNameIsRuning(path))
|
|
||||||
{
|
|
||||||
// Процесс уже запущен
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Процесс не запущен
|
// Процесс не запущен
|
||||||
WatchedProcess = Process.Start(path, args);
|
WatchedProcess = Process.Start(path, args);
|
||||||
cpuLastTime = 0;
|
cpuLastTime = 0;
|
||||||
cpuMeasureTimer.Start();
|
cpuMeasureTimer.Start();
|
||||||
Status($"Процесс {ProcessName} был запущен.", NotifyLevel.logAlways);
|
Status($"Процесс {ProcessName} запущен.", NotifyLevel.logAlways);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BackgroundWorkerDoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
|
private void BackgroundWorkerDoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user