mirror of
https://github.com/kwsch/NHSE.git
synced 2026-07-02 00:11:55 -05:00
Disconnect on window close
This commit is contained in:
parent
20a16666ff
commit
39205c975e
29
NHSE.WinForms/Subforms/SysBot/SysBotUI.Designer.cs
generated
29
NHSE.WinForms/Subforms/SysBot/SysBotUI.Designer.cs
generated
|
|
@ -35,6 +35,7 @@ private void InitializeComponent()
|
|||
this.L_IP = new System.Windows.Forms.Label();
|
||||
this.TB_IP = new System.Windows.Forms.TextBox();
|
||||
this.GB_Inject = new System.Windows.Forms.GroupBox();
|
||||
this.CHK_Validate = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_AutoRead = new System.Windows.Forms.CheckBox();
|
||||
this.CHK_AutoWrite = new System.Windows.Forms.CheckBox();
|
||||
this.RamOffset = new System.Windows.Forms.TextBox();
|
||||
|
|
@ -42,7 +43,6 @@ private void InitializeComponent()
|
|||
this.B_ReadCurrent = new System.Windows.Forms.Button();
|
||||
this.B_WriteCurrent = new System.Windows.Forms.Button();
|
||||
this.TIM_Interval = new System.Windows.Forms.Timer(this.components);
|
||||
this.CHK_Validate = new System.Windows.Forms.CheckBox();
|
||||
this.GB_Inject.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
|
@ -109,6 +109,19 @@ private void InitializeComponent()
|
|||
this.GB_Inject.TabStop = false;
|
||||
this.GB_Inject.Text = "Injector";
|
||||
//
|
||||
// CHK_Validate
|
||||
//
|
||||
this.CHK_Validate.AutoSize = true;
|
||||
this.CHK_Validate.Checked = true;
|
||||
this.CHK_Validate.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.CHK_Validate.Location = new System.Drawing.Point(18, 100);
|
||||
this.CHK_Validate.Name = "CHK_Validate";
|
||||
this.CHK_Validate.Size = new System.Drawing.Size(90, 17);
|
||||
this.CHK_Validate.TabIndex = 23;
|
||||
this.CHK_Validate.Text = "Validate Data";
|
||||
this.CHK_Validate.UseVisualStyleBackColor = true;
|
||||
this.CHK_Validate.CheckedChanged += new System.EventHandler(this.CHK_Validate_CheckedChanged);
|
||||
//
|
||||
// CHK_AutoRead
|
||||
//
|
||||
this.CHK_AutoRead.AutoSize = true;
|
||||
|
|
@ -175,19 +188,6 @@ private void InitializeComponent()
|
|||
//
|
||||
this.TIM_Interval.Interval = 5000;
|
||||
//
|
||||
// CHK_Validate
|
||||
//
|
||||
this.CHK_Validate.AutoSize = true;
|
||||
this.CHK_Validate.Checked = true;
|
||||
this.CHK_Validate.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.CHK_Validate.Location = new System.Drawing.Point(18, 100);
|
||||
this.CHK_Validate.Name = "CHK_Validate";
|
||||
this.CHK_Validate.Size = new System.Drawing.Size(90, 17);
|
||||
this.CHK_Validate.TabIndex = 23;
|
||||
this.CHK_Validate.Text = "Validate Data";
|
||||
this.CHK_Validate.UseVisualStyleBackColor = true;
|
||||
this.CHK_Validate.CheckedChanged += new System.EventHandler(this.CHK_Validate_CheckedChanged);
|
||||
//
|
||||
// SysBotUI
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
@ -206,6 +206,7 @@ private void InitializeComponent()
|
|||
this.Name = "SysBotUI";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "SysBotUI";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SysBotUI_FormClosing);
|
||||
this.GB_Inject.ResumeLayout(false);
|
||||
this.GB_Inject.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,24 @@ private void B_Connect_Click(object sender, EventArgs e)
|
|||
GB_Inject.Enabled = true;
|
||||
}
|
||||
|
||||
private void SysBotUI_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
TurnOffAuto();
|
||||
if (!Bot.Bot.Connected)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Bot.Bot.Disconnect();
|
||||
}
|
||||
#pragma warning disable CA1031 // Do not catch general exception types
|
||||
catch (Exception ex)
|
||||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void B_WriteCurrent_Click(object sender, EventArgs e)
|
||||
{
|
||||
var offset = StringUtil.GetHexValue(RamOffset.Text);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user