Renaming. Disabled settings discord if start work

This commit is contained in:
Vladimir
2024-05-26 22:46:47 +04:00
parent f28fc0126a
commit 964f5389da
4 changed files with 93 additions and 49 deletions

View File

@@ -1,6 +1,6 @@
namespace RelaunchProcess namespace RelaunchProcess
{ {
partial class DiscordSettings partial class WebhookSettings
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@@ -39,11 +39,14 @@
this.textDwhURL = new System.Windows.Forms.TextBox(); this.textDwhURL = new System.Windows.Forms.TextBox();
this.chbxDiscordEnabled = new System.Windows.Forms.CheckBox(); this.chbxDiscordEnabled = new System.Windows.Forms.CheckBox();
this.btnClearAvatarUrlField = new System.Windows.Forms.Button(); this.btnClearAvatarUrlField = new System.Windows.Forms.Button();
this.groupBoxSettingsDiscord = new System.Windows.Forms.GroupBox();
this.groupBoxSettingsDiscord.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// btnOk // btnOk
// //
this.btnOk.Location = new System.Drawing.Point(215, 155); this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOk.Location = new System.Drawing.Point(236, 206);
this.btnOk.Name = "btnOk"; this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23); this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0; this.btnOk.TabIndex = 0;
@@ -53,8 +56,9 @@
// //
// btnCancel // btnCancel
// //
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(296, 155); this.btnCancel.Location = new System.Drawing.Point(317, 206);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1; this.btnCancel.TabIndex = 1;
@@ -65,7 +69,7 @@
// lblDwhURL // lblDwhURL
// //
this.lblDwhURL.AutoSize = true; this.lblDwhURL.AutoSize = true;
this.lblDwhURL.Location = new System.Drawing.Point(9, 87); this.lblDwhURL.Location = new System.Drawing.Point(6, 103);
this.lblDwhURL.Name = "lblDwhURL"; this.lblDwhURL.Name = "lblDwhURL";
this.lblDwhURL.Size = new System.Drawing.Size(147, 13); this.lblDwhURL.Size = new System.Drawing.Size(147, 13);
this.lblDwhURL.TabIndex = 4; this.lblDwhURL.TabIndex = 4;
@@ -73,9 +77,10 @@
// //
// btnClearUrlField // btnClearUrlField
// //
this.btnClearUrlField.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClearUrlField.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.btnClearUrlField.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnClearUrlField.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.btnClearUrlField.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.btnClearUrlField.Location = new System.Drawing.Point(352, 103); this.btnClearUrlField.Location = new System.Drawing.Point(350, 119);
this.btnClearUrlField.Name = "btnClearUrlField"; this.btnClearUrlField.Name = "btnClearUrlField";
this.btnClearUrlField.Size = new System.Drawing.Size(19, 19); this.btnClearUrlField.Size = new System.Drawing.Size(19, 19);
this.btnClearUrlField.TabIndex = 5; this.btnClearUrlField.TabIndex = 5;
@@ -86,58 +91,66 @@
// lblDwhBotname // lblDwhBotname
// //
this.lblDwhBotname.AutoSize = true; this.lblDwhBotname.AutoSize = true;
this.lblDwhBotname.Location = new System.Drawing.Point(9, 9); this.lblDwhBotname.Location = new System.Drawing.Point(6, 25);
this.lblDwhBotname.Name = "lblDwhBotname"; this.lblDwhBotname.Name = "lblDwhBotname";
this.lblDwhBotname.Size = new System.Drawing.Size(127, 13); this.lblDwhBotname.Size = new System.Drawing.Size(124, 13);
this.lblDwhBotname.TabIndex = 6; this.lblDwhBotname.TabIndex = 6;
this.lblDwhBotname.Text = "Имя бота в сообщении:"; this.lblDwhBotname.Text = "Имя бота в сообщении";
// //
// lblDwhAvatarUrl // lblDwhAvatarUrl
// //
this.lblDwhAvatarUrl.AutoSize = true; this.lblDwhAvatarUrl.AutoSize = true;
this.lblDwhAvatarUrl.Location = new System.Drawing.Point(9, 48); this.lblDwhAvatarUrl.Location = new System.Drawing.Point(6, 64);
this.lblDwhAvatarUrl.Name = "lblDwhAvatarUrl"; this.lblDwhAvatarUrl.Name = "lblDwhAvatarUrl";
this.lblDwhAvatarUrl.Size = new System.Drawing.Size(102, 13); this.lblDwhAvatarUrl.Size = new System.Drawing.Size(132, 13);
this.lblDwhAvatarUrl.TabIndex = 6; this.lblDwhAvatarUrl.TabIndex = 6;
this.lblDwhAvatarUrl.Text = "URL аватара бота:"; this.lblDwhAvatarUrl.Text = "URL-адрес аватара бота";
// //
// textDwhAvatarUrl // textDwhAvatarUrl
// //
this.textDwhAvatarUrl.Location = new System.Drawing.Point(9, 64); this.textDwhAvatarUrl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textDwhAvatarUrl.Location = new System.Drawing.Point(6, 80);
this.textDwhAvatarUrl.Name = "textDwhAvatarUrl"; this.textDwhAvatarUrl.Name = "textDwhAvatarUrl";
this.textDwhAvatarUrl.Size = new System.Drawing.Size(337, 20); this.textDwhAvatarUrl.Size = new System.Drawing.Size(338, 20);
this.textDwhAvatarUrl.TabIndex = 7; this.textDwhAvatarUrl.TabIndex = 7;
// //
// textDwhBotName // textDwhBotName
// //
this.textDwhBotName.Location = new System.Drawing.Point(9, 25); this.textDwhBotName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textDwhBotName.Location = new System.Drawing.Point(6, 41);
this.textDwhBotName.MaxLength = 40; this.textDwhBotName.MaxLength = 40;
this.textDwhBotName.Name = "textDwhBotName"; this.textDwhBotName.Name = "textDwhBotName";
this.textDwhBotName.Size = new System.Drawing.Size(211, 20); this.textDwhBotName.Size = new System.Drawing.Size(212, 20);
this.textDwhBotName.TabIndex = 7; this.textDwhBotName.TabIndex = 7;
// //
// textDwhURL // textDwhURL
// //
this.textDwhURL.Location = new System.Drawing.Point(9, 103); this.textDwhURL.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textDwhURL.Location = new System.Drawing.Point(6, 119);
this.textDwhURL.Name = "textDwhURL"; this.textDwhURL.Name = "textDwhURL";
this.textDwhURL.Size = new System.Drawing.Size(337, 20); this.textDwhURL.Size = new System.Drawing.Size(338, 20);
this.textDwhURL.TabIndex = 3; this.textDwhURL.TabIndex = 3;
// //
// chbxDiscordEnabled // chbxDiscordEnabled
// //
this.chbxDiscordEnabled.AutoSize = true; this.chbxDiscordEnabled.AutoSize = true;
this.chbxDiscordEnabled.Location = new System.Drawing.Point(9, 129); this.chbxDiscordEnabled.Location = new System.Drawing.Point(12, 173);
this.chbxDiscordEnabled.Name = "chbxDiscordEnabled"; this.chbxDiscordEnabled.Name = "chbxDiscordEnabled";
this.chbxDiscordEnabled.Size = new System.Drawing.Size(232, 17); this.chbxDiscordEnabled.Size = new System.Drawing.Size(232, 17);
this.chbxDiscordEnabled.TabIndex = 2; this.chbxDiscordEnabled.TabIndex = 2;
this.chbxDiscordEnabled.Text = "Включить отправку сообщений в Discord"; this.chbxDiscordEnabled.Text = "Включить отправку сообщений в Discord";
this.chbxDiscordEnabled.UseVisualStyleBackColor = true; this.chbxDiscordEnabled.UseVisualStyleBackColor = true;
this.chbxDiscordEnabled.CheckedChanged += new System.EventHandler(this.chbxDiscordEnabled_CheckedChanged);
// //
// btnClearAvatarUrlField // btnClearAvatarUrlField
// //
this.btnClearAvatarUrlField.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClearAvatarUrlField.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.btnClearAvatarUrlField.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnClearAvatarUrlField.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.btnClearAvatarUrlField.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.btnClearAvatarUrlField.Location = new System.Drawing.Point(352, 65); this.btnClearAvatarUrlField.Location = new System.Drawing.Point(350, 81);
this.btnClearAvatarUrlField.Name = "btnClearAvatarUrlField"; this.btnClearAvatarUrlField.Name = "btnClearAvatarUrlField";
this.btnClearAvatarUrlField.Size = new System.Drawing.Size(19, 19); this.btnClearAvatarUrlField.Size = new System.Drawing.Size(19, 19);
this.btnClearAvatarUrlField.TabIndex = 5; this.btnClearAvatarUrlField.TabIndex = 5;
@@ -145,32 +158,47 @@
this.btnClearAvatarUrlField.UseVisualStyleBackColor = true; this.btnClearAvatarUrlField.UseVisualStyleBackColor = true;
this.btnClearAvatarUrlField.Click += new System.EventHandler(this.ClearUrl); this.btnClearAvatarUrlField.Click += new System.EventHandler(this.ClearUrl);
// //
// DiscordSettings // groupBoxSettingsDiscord
//
this.groupBoxSettingsDiscord.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxSettingsDiscord.Controls.Add(this.lblDwhBotname);
this.groupBoxSettingsDiscord.Controls.Add(this.textDwhURL);
this.groupBoxSettingsDiscord.Controls.Add(this.textDwhAvatarUrl);
this.groupBoxSettingsDiscord.Controls.Add(this.lblDwhURL);
this.groupBoxSettingsDiscord.Controls.Add(this.textDwhBotName);
this.groupBoxSettingsDiscord.Controls.Add(this.btnClearUrlField);
this.groupBoxSettingsDiscord.Controls.Add(this.lblDwhAvatarUrl);
this.groupBoxSettingsDiscord.Controls.Add(this.btnClearAvatarUrlField);
this.groupBoxSettingsDiscord.Location = new System.Drawing.Point(12, 12);
this.groupBoxSettingsDiscord.Name = "groupBoxSettingsDiscord";
this.groupBoxSettingsDiscord.Size = new System.Drawing.Size(379, 155);
this.groupBoxSettingsDiscord.TabIndex = 8;
this.groupBoxSettingsDiscord.TabStop = false;
this.groupBoxSettingsDiscord.Text = "Discord";
//
// WebhookSettings
// //
this.AcceptButton = this.btnOk; this.AcceptButton = this.btnOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel; this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(387, 188); this.ClientSize = new System.Drawing.Size(404, 241);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.textDwhAvatarUrl);
this.Controls.Add(this.textDwhBotName);
this.Controls.Add(this.lblDwhAvatarUrl);
this.Controls.Add(this.lblDwhBotname);
this.Controls.Add(this.btnClearAvatarUrlField);
this.Controls.Add(this.btnClearUrlField);
this.Controls.Add(this.lblDwhURL);
this.Controls.Add(this.textDwhURL);
this.Controls.Add(this.chbxDiscordEnabled); this.Controls.Add(this.chbxDiscordEnabled);
this.Controls.Add(this.groupBoxSettingsDiscord);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk); this.Controls.Add(this.btnOk);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "DiscordSettings"; this.MinimumSize = new System.Drawing.Size(420, 280);
this.Name = "WebhookSettings";
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.Text = "Настройки Discord webhook"; this.Text = "Настройки webhook";
this.Load += new System.EventHandler(this.WebhookSettings_FormLoad);
this.groupBoxSettingsDiscord.ResumeLayout(false);
this.groupBoxSettingsDiscord.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -189,5 +217,6 @@
private System.Windows.Forms.Label lblDwhAvatarUrl; private System.Windows.Forms.Label lblDwhAvatarUrl;
private System.Windows.Forms.TextBox textDwhAvatarUrl; private System.Windows.Forms.TextBox textDwhAvatarUrl;
private System.Windows.Forms.Button btnClearAvatarUrlField; private System.Windows.Forms.Button btnClearAvatarUrlField;
private System.Windows.Forms.GroupBox groupBoxSettingsDiscord;
} }
} }

View File

@@ -13,9 +13,9 @@ using RelaunchProcess.Properties;
namespace RelaunchProcess namespace RelaunchProcess
{ {
public partial class DiscordSettings : Form public partial class WebhookSettings : Form
{ {
public DiscordSettings() public WebhookSettings()
{ {
InitializeComponent(); InitializeComponent();
RestoreSettings(); RestoreSettings();
@@ -38,6 +38,16 @@ namespace RelaunchProcess
Settings.Default.Save(); Settings.Default.Save();
} }
public void UpdateUI()
{
groupBoxSettingsDiscord.Enabled = !chbxDiscordEnabled.Checked;
}
private void WebhookSettings_FormLoad(object sender, EventArgs e)
{
UpdateUI();
}
private void BtnCancel_Click(object sender, EventArgs e) private void BtnCancel_Click(object sender, EventArgs e)
{ {
DialogResult = DialogResult.Cancel; DialogResult = DialogResult.Cancel;
@@ -69,5 +79,10 @@ namespace RelaunchProcess
if ( (Button)sender == btnClearUrlField ) textDwhURL.Text = ""; if ( (Button)sender == btnClearUrlField ) textDwhURL.Text = "";
if ( (Button)sender == btnClearAvatarUrlField ) textDwhAvatarUrl.Text = ""; if ( (Button)sender == btnClearAvatarUrlField ) textDwhAvatarUrl.Text = "";
} }
private void chbxDiscordEnabled_CheckedChanged(object sender, EventArgs e)
{
UpdateUI();
}
} }
} }

26
Form1.Designer.cs generated
View File

@@ -48,12 +48,12 @@ namespace Process_Auto_Relaunch
this.checkBoxSaveState = new System.Windows.Forms.CheckBox(); this.checkBoxSaveState = new System.Windows.Forms.CheckBox();
this.radioButtonEnableWathing = new System.Windows.Forms.RadioButton(); this.radioButtonEnableWathing = new System.Windows.Forms.RadioButton();
this.radioButtonDisableWathing = new System.Windows.Forms.RadioButton(); this.radioButtonDisableWathing = new System.Windows.Forms.RadioButton();
this.btnShowDiscordSettings = new System.Windows.Forms.Button();
this.groupBoxStatus = new System.Windows.Forms.GroupBox(); this.groupBoxStatus = new System.Windows.Forms.GroupBox();
this.labelStatus = new System.Windows.Forms.Label(); this.labelStatus = new System.Windows.Forms.Label();
this.myBackgroundWorker = new System.ComponentModel.BackgroundWorker(); this.myBackgroundWorker = new System.ComponentModel.BackgroundWorker();
this.groupBoxHistory = new System.Windows.Forms.GroupBox(); this.groupBoxHistory = new System.Windows.Forms.GroupBox();
this.richTextBoxHistory = new System.Windows.Forms.RichTextBox(); this.richTextBoxHistory = new System.Windows.Forms.RichTextBox();
this.btnShowDiscordSettings = new System.Windows.Forms.Button();
this.groupBoxActions.SuspendLayout(); this.groupBoxActions.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.groupBoxProgramStart.SuspendLayout(); this.groupBoxProgramStart.SuspendLayout();
@@ -303,6 +303,18 @@ namespace Process_Auto_Relaunch
this.radioButtonDisableWathing.UseVisualStyleBackColor = true; this.radioButtonDisableWathing.UseVisualStyleBackColor = true;
this.radioButtonDisableWathing.CheckedChanged += new System.EventHandler(this.radioButtonDisableWathing_CheckedChanged); this.radioButtonDisableWathing.CheckedChanged += new System.EventHandler(this.radioButtonDisableWathing_CheckedChanged);
// //
// btnShowDiscordSettings
//
this.btnShowDiscordSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnShowDiscordSettings.Location = new System.Drawing.Point(282, 16);
this.btnShowDiscordSettings.Margin = new System.Windows.Forms.Padding(4);
this.btnShowDiscordSettings.Name = "btnShowDiscordSettings";
this.btnShowDiscordSettings.Size = new System.Drawing.Size(89, 34);
this.btnShowDiscordSettings.TabIndex = 1;
this.btnShowDiscordSettings.Text = "Webhook";
this.btnShowDiscordSettings.UseVisualStyleBackColor = true;
this.btnShowDiscordSettings.Click += new System.EventHandler(this.btnShowDiscordSettings_Click);
//
// groupBoxStatus // groupBoxStatus
// //
this.groupBoxStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBoxStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -356,18 +368,6 @@ namespace Process_Auto_Relaunch
this.richTextBoxHistory.TabIndex = 0; this.richTextBoxHistory.TabIndex = 0;
this.richTextBoxHistory.Text = ""; this.richTextBoxHistory.Text = "";
// //
// btnShowDiscordSettings
//
this.btnShowDiscordSettings.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btnShowDiscordSettings.Location = new System.Drawing.Point(282, 16);
this.btnShowDiscordSettings.Margin = new System.Windows.Forms.Padding(4);
this.btnShowDiscordSettings.Name = "btnShowDiscordSettings";
this.btnShowDiscordSettings.Size = new System.Drawing.Size(89, 34);
this.btnShowDiscordSettings.TabIndex = 1;
this.btnShowDiscordSettings.Text = "Discord";
this.btnShowDiscordSettings.UseVisualStyleBackColor = true;
this.btnShowDiscordSettings.Click += new System.EventHandler(this.btnShowDiscordSettings_Click);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);

View File

@@ -337,8 +337,8 @@ namespace Process_Auto_Relaunch
private void btnShowDiscordSettings_Click(object sender, EventArgs e) private void btnShowDiscordSettings_Click(object sender, EventArgs e)
{ {
DiscordSettings discordSettings; WebhookSettings discordSettings;
discordSettings = new DiscordSettings(); discordSettings = new WebhookSettings();
discordSettings.ShowDialog(this); discordSettings.ShowDialog(this);
discordSettings.Dispose(); discordSettings.Dispose();
} }