Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit c53e9cb

Browse files
committed
agilize updater by reopening spcode with a success message
1 parent 5aac974 commit c53e9cb

File tree

5 files changed

+19
-61
lines changed

5 files changed

+19
-61
lines changed

Deploy/SpcodeUpdater/Program.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ namespace SPCodeUpdater
1111
{
1212
public static class Program
1313
{
14-
public delegate void InvokeDel();
15-
14+
private static bool Success;
1615
[STAThread]
1716
public static void Main()
1817
{
@@ -82,12 +81,21 @@ private static void Worker(object arg)
8281
}
8382
}
8483
}
85-
86-
um.Invoke((InvokeDel)(() => { um.SetToReadyState(); }));
84+
Success = true;
8785
}
8886
catch (Exception ex)
8987
{
9088
MessageBox.Show($"The updater failed to update SPCode properly: {ex.Message}");
89+
Success = false;
90+
}
91+
finally
92+
{
93+
Process.Start(new ProcessStartInfo
94+
{
95+
Arguments = $"/C SPCode.exe {(Success ? "--updated" : string.Empty)}",
96+
FileName = "cmd",
97+
WindowStyle = ProcessWindowStyle.Hidden
98+
});
9199
Application.Exit();
92100
}
93101
}

Deploy/SpcodeUpdater/UpdateMarquee.Designer.cs

Lines changed: 0 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Deploy/SpcodeUpdater/UpdateMarquee.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Windows.Forms;
1+
using System.Windows.Forms;
32

43
namespace SPCodeUpdater
54
{
@@ -9,18 +8,5 @@ public UpdateMarquee()
98
{
109
InitializeComponent();
1110
}
12-
13-
public void SetToReadyState()
14-
{
15-
label1.Text = "SPCode got updated!";
16-
progressBar1.Visible = false;
17-
button1.Visible = true;
18-
UseWaitCursor = false;
19-
}
20-
21-
private void Button1_Click(object sender, EventArgs e)
22-
{
23-
Close();
24-
}
2511
}
2612
}

Deploy/SpcodeUpdater/UpdateMarquee.resx

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
<value>12, 23</value>
127127
</data>
128128
<data name="progressBar1.Size" type="System.Drawing.Size, System.Drawing">
129-
<value>200, 23</value>
129+
<value>276, 23</value>
130130
</data>
131131
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
132132
<data name="progressBar1.TabIndex" type="System.Int32, mscorlib">
@@ -142,7 +142,7 @@
142142
<value>$this</value>
143143
</data>
144144
<data name="&gt;&gt;progressBar1.ZOrder" xml:space="preserve">
145-
<value>2</value>
145+
<value>1</value>
146146
</data>
147147
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
148148
<value>True</value>
@@ -172,33 +172,6 @@
172172
<value>$this</value>
173173
</data>
174174
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
175-
<value>1</value>
176-
</data>
177-
<data name="button1.Location" type="System.Drawing.Point, System.Drawing">
178-
<value>218, 23</value>
179-
</data>
180-
<data name="button1.Size" type="System.Drawing.Size, System.Drawing">
181-
<value>75, 23</value>
182-
</data>
183-
<data name="button1.TabIndex" type="System.Int32, mscorlib">
184-
<value>3</value>
185-
</data>
186-
<data name="button1.Text" xml:space="preserve">
187-
<value>Close</value>
188-
</data>
189-
<data name="button1.Visible" type="System.Boolean, mscorlib">
190-
<value>False</value>
191-
</data>
192-
<data name="&gt;&gt;button1.Name" xml:space="preserve">
193-
<value>button1</value>
194-
</data>
195-
<data name="&gt;&gt;button1.Type" xml:space="preserve">
196-
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
197-
</data>
198-
<data name="&gt;&gt;button1.Parent" xml:space="preserve">
199-
<value>$this</value>
200-
</data>
201-
<data name="&gt;&gt;button1.ZOrder" xml:space="preserve">
202175
<value>0</value>
203176
</data>
204177
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

UI/MainWindow/MainWindow.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ public MainWindow(SplashScreen sc)
147147
{
148148
TryLoadSourceFile(args[i], out _, false, true, i == 0);
149149
}
150+
if (args[i].ToLowerInvariant() == "--updated")
151+
{
152+
this.ShowMessageAsync("Update completed", "SPCode has been updated successfully.");
153+
}
150154
}
151155

152156
// Close SplashScreen

0 commit comments

Comments
 (0)