diff --git a/Form1.Designer.cs b/Form1.Designer.cs
index 9951667..6c9e7c1 100644
--- a/Form1.Designer.cs
+++ b/Form1.Designer.cs
@@ -51,12 +51,15 @@ namespace Process_Auto_Relaunch
this.labelProgramStartPath = new System.Windows.Forms.Label();
this.checkBoxCheckProcess = new System.Windows.Forms.CheckBox();
this.radioButtonRestartNow = new System.Windows.Forms.RadioButton();
+ this.groupBoxHistory = new System.Windows.Forms.GroupBox();
+ this.richTextBoxHistory = new System.Windows.Forms.RichTextBox();
this.groupBoxActions.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.groupBoxProgramStart.SuspendLayout();
this.groupBoxProcessName.SuspendLayout();
this.groupBoxEnabled.SuspendLayout();
this.groupBoxStatus.SuspendLayout();
+ this.groupBoxHistory.SuspendLayout();
this.SuspendLayout();
//
// groupBoxActions
@@ -179,7 +182,7 @@ namespace Process_Auto_Relaunch
this.groupBoxProcessName.Size = new System.Drawing.Size(383, 62);
this.groupBoxProcessName.TabIndex = 8;
this.groupBoxProcessName.TabStop = false;
- this.groupBoxProcessName.Text = "Название наблюдаемого процесса";
+ this.groupBoxProcessName.Text = "Название наблюдаемого процесса (без расширения)";
//
// groupBoxEnabled
//
@@ -312,9 +315,9 @@ namespace Process_Auto_Relaunch
this.checkBoxCheckProcess.Location = new System.Drawing.Point(11, 78);
this.checkBoxCheckProcess.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.checkBoxCheckProcess.Name = "checkBoxCheckProcess";
- this.checkBoxCheckProcess.Size = new System.Drawing.Size(190, 20);
+ this.checkBoxCheckProcess.Size = new System.Drawing.Size(265, 20);
this.checkBoxCheckProcess.TabIndex = 2;
- this.checkBoxCheckProcess.Text = "Не создавать дубликаты";
+ this.checkBoxCheckProcess.Text = "Проверять наличие перед запуском";
this.checkBoxCheckProcess.UseVisualStyleBackColor = true;
//
// radioButtonRestartNow
@@ -330,11 +333,36 @@ namespace Process_Auto_Relaunch
this.radioButtonRestartNow.Text = "Перезапускать сразу";
this.radioButtonRestartNow.UseVisualStyleBackColor = true;
//
+ // groupBoxHistory
+ //
+ this.groupBoxHistory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupBoxHistory.Controls.Add(this.richTextBoxHistory);
+ this.groupBoxHistory.Location = new System.Drawing.Point(13, 514);
+ this.groupBoxHistory.Name = "groupBoxHistory";
+ this.groupBoxHistory.Size = new System.Drawing.Size(383, 132);
+ this.groupBoxHistory.TabIndex = 11;
+ this.groupBoxHistory.TabStop = false;
+ this.groupBoxHistory.Text = "История запусков";
+ //
+ // richTextBoxHistory
+ //
+ this.richTextBoxHistory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.richTextBoxHistory.Location = new System.Drawing.Point(0, 21);
+ this.richTextBoxHistory.Name = "richTextBoxHistory";
+ this.richTextBoxHistory.ReadOnly = true;
+ this.richTextBoxHistory.Size = new System.Drawing.Size(383, 111);
+ this.richTextBoxHistory.TabIndex = 0;
+ this.richTextBoxHistory.Text = "";
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(421, 533);
+ this.ClientSize = new System.Drawing.Size(421, 658);
+ this.Controls.Add(this.groupBoxHistory);
this.Controls.Add(this.groupBoxStatus);
this.Controls.Add(this.groupBoxEnabled);
this.Controls.Add(this.groupBoxProcessName);
@@ -359,6 +387,7 @@ namespace Process_Auto_Relaunch
this.groupBoxEnabled.PerformLayout();
this.groupBoxStatus.ResumeLayout(false);
this.groupBoxStatus.PerformLayout();
+ this.groupBoxHistory.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -385,5 +414,7 @@ namespace Process_Auto_Relaunch
public Label labelStatus;
private System.ComponentModel.BackgroundWorker myBackgroundWorker;
private NumericUpDown numericUpDown1;
+ private GroupBox groupBoxHistory;
+ private RichTextBox richTextBoxHistory;
}
}
diff --git a/Form1.cs b/Form1.cs
index 80a92de..b22ad4d 100644
--- a/Form1.cs
+++ b/Form1.cs
@@ -10,7 +10,7 @@ namespace Process_Auto_Relaunch
{
public partial class Form1 : Form
{
- private delegate void UpdateLogDelegate(string text);
+ private delegate void UpdateLogDelegate(string text, bool add_history = false);
private UpdateLogDelegate updateLogDelegate = null;
public Form1()
@@ -45,6 +45,11 @@ namespace Process_Auto_Relaunch
}
+ ///
+ ///
+ ///
+ ///
+ ///
private void radioButtonDisableWathing_CheckedChanged(object sender, EventArgs e)
{
CheckProgramState();
@@ -61,7 +66,11 @@ namespace Process_Auto_Relaunch
}
}
-
+ ///
+ ///
+ ///
+ ///
+ ///
private void radioButtonEnableWathing_CheckedChanged(object sender, EventArgs e)
{
if (!radioButtonEnableWathing.Checked)
@@ -97,14 +106,29 @@ namespace Process_Auto_Relaunch
}
}
- private void UpdateStatus(string text)
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void UpdateStatus(string text, bool add_history = false)
{
labelStatus.Text = text;
+
+ if (add_history)
+ {
+ HistoryLog(text);
+ }
}
- private void Status(string text)
+ private void HistoryLog(string text)
{
- Invoke(updateLogDelegate, new[] { text });
+ richTextBoxHistory.Text += DateTime.Now.ToString() + ": " + text + "\n";
+ }
+
+ public void Status(string text, bool add_history = false)
+ {
+ Invoke(updateLogDelegate, text, add_history);
}
private void CheckProgramState()
@@ -167,7 +191,8 @@ namespace Process_Auto_Relaunch
return;
}
}
-
+
+ Status(" .", true);
Process.Start(path, args);
}
@@ -193,6 +218,7 @@ namespace Process_Auto_Relaunch
if (i <= 0 || radioButtonRestartNow.Checked)
{
+ i = (int)numericUpDown1.Value;
Status("...");
ProcessStart(Settings.Default.startProgramPath, textBoxArguments.Text);
}
@@ -216,7 +242,7 @@ namespace Process_Auto_Relaunch
else if (e.Error != null)
{
MessageBox.Show("Error: " + e.Error.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
- Status(" . !");
+ Status(" ! .", true);
radioButtonDisableWathing.Checked = true;
}
else