Added a restart Discord checkbox

This commit is contained in:
Jiiks 2015-12-18 18:00:52 +02:00
parent 86749ad34a
commit bfb855081c
4 changed files with 28 additions and 14 deletions

View File

@ -13,6 +13,7 @@ namespace BetterDiscordWI
private int _index; private int _index;
public String DiscordPath; public String DiscordPath;
public Boolean RestartDiscord = false;
public String Sha; public String Sha;
public Boolean finished = false; public Boolean finished = false;

View File

@ -33,6 +33,7 @@
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.tbPath = new BetterDiscordWI.components.CTextBox(); this.tbPath = new BetterDiscordWI.components.CTextBox();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.cbRestart = new System.Windows.Forms.CheckBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
@ -73,7 +74,6 @@
this.tbPath.Name = "tbPath"; this.tbPath.Name = "tbPath";
this.tbPath.Size = new System.Drawing.Size(377, 26); this.tbPath.Size = new System.Drawing.Size(377, 26);
this.tbPath.TabIndex = 4; this.tbPath.TabIndex = 4;
this.tbPath.Text = "feawfewafewa";
// //
// label3 // label3
// //
@ -84,10 +84,21 @@
this.label3.TabIndex = 5; this.label3.TabIndex = 5;
this.label3.Text = "*Installer will kill Discord process."; this.label3.Text = "*Installer will kill Discord process.";
// //
// cbRestart
//
this.cbRestart.AutoSize = true;
this.cbRestart.Location = new System.Drawing.Point(23, 117);
this.cbRestart.Name = "cbRestart";
this.cbRestart.Size = new System.Drawing.Size(175, 17);
this.cbRestart.TabIndex = 6;
this.cbRestart.Text = "Restart Discord after installation";
this.cbRestart.UseVisualStyleBackColor = true;
//
// Panel1 // Panel1
// //
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.Controls.Add(this.cbRestart);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.tbPath); this.Controls.Add(this.tbPath);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
@ -107,5 +118,6 @@
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private components.CTextBox tbPath; private components.CTextBox tbPath;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox cbRestart;
} }
} }

View File

@ -28,21 +28,16 @@ namespace BetterDiscordWI.panels
foreach(String s in directories) foreach(String s in directories)
{ {
Debug.Print(s); Debug.Print(s);
if (s.Contains("app-")) if (!s.Contains("app-")) continue;
if (highestVersion == null)
{ {
highestVersion = s;
continue;
if (highestVersion == null) }
{
highestVersion = s;
continue;
}
if (String.CompareOrdinal(s, highestVersion) > 0)
{
highestVersion = s;
}
if (String.CompareOrdinal(s, highestVersion) > 0)
{
highestVersion = s;
} }
} }
@ -57,6 +52,7 @@ namespace BetterDiscordWI.panels
public void BtnNext() public void BtnNext()
{ {
GetParent().DiscordPath = tbPath.Text; GetParent().DiscordPath = tbPath.Text;
GetParent().RestartDiscord = cbRestart.Checked;
GetParent().SwitchPanel(2); GetParent().SwitchPanel(2);
} }

View File

@ -239,6 +239,11 @@ namespace BetterDiscordWI.panels
GetParent().btnCancel.Text = "OK"; GetParent().btnCancel.Text = "OK";
GetParent().btnCancel.Enabled = true; GetParent().btnCancel.Enabled = true;
}); });
if (GetParent().RestartDiscord)
{
Process.Start(GetParent().DiscordPath + "\\Discord.exe");
}
} }
public FormMain GetParent() public FormMain GetParent()