Skip to content

Commit 7e4522e

Browse files
committed
v1.3.1
Hide update window on start No update when start ERPLoader with cleanOnly option
1 parent 6d56617 commit 7e4522e

File tree

5 files changed

+19
-22
lines changed

5 files changed

+19
-22
lines changed

ERPLoader/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static void Main(string[] args)
3838
// Last resort in bug catch
3939
try
4040
{
41-
if (!skipRunUpdate)
41+
if (!skipRunUpdate && !isOnlyCleanup)
4242
{
4343
if (File.Exists("EasyUpdater.exe"))
4444
{
@@ -49,8 +49,7 @@ static void Main(string[] args)
4949
{
5050
FileName = "EasyUpdater.exe",
5151
Arguments = "/autoUpdate",
52-
WorkingDirectory = Directory.GetCurrentDirectory(),
53-
CreateNoWindow = true
52+
WorkingDirectory = Directory.GetCurrentDirectory()
5453
};
5554
Process.Start(psi).WaitForExit();
5655

Updater/App.xaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<Application x:Class="Updater.App"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:local="clr-namespace:Updater"
5-
StartupUri="MainWindow.xaml">
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
64
<Application.Resources>
75

86
</Application.Resources>

Updater/App.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ public partial class App : Application
1010
{
1111
public App()
1212
{
13+
Startup += App_Startup;
14+
}
15+
16+
private void App_Startup(object sender, StartupEventArgs e)
17+
{
18+
MainWindow window = new();
19+
window.Start();
1320
}
1421
}
1522
}

Updater/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:Updater"
77
mc:Ignorable="d"
8-
Title="Updater" Height="400" Width="600" Background="#FF171717" Foreground="#FFE6E6E6" WindowStartupLocation="CenterScreen" WindowState="Normal">
8+
Title="Updater" Height="400" Width="600" Background="#FF171717" Foreground="#FFE6E6E6" WindowStartupLocation="CenterScreen">
99
<Window.Resources>
1010
<SolidColorBrush x:Key="Button.Static.Background" Color="#FF757575"/>
1111
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF757575"/>

Updater/MainWindow.xaml.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,16 @@ public partial class MainWindow : Window
1515
public MainWindow()
1616
{
1717
InitializeComponent();
18-
19-
Loaded += MainWindow_Loaded;
2018
}
2119

22-
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
20+
public void Start()
2321
{
24-
WindowState = WindowState.Minimized;
25-
2622
string[] args = Environment.GetCommandLineArgs();
2723

28-
if (args.Length > 0)
24+
foreach (string arg in args)
2925
{
30-
foreach (string arg in args)
31-
{
32-
if (arg.Equals("/autoUpdate"))
33-
IsAutoUpdate = true;
34-
}
26+
if (arg.Equals("/autoUpdate", StringComparison.Ordinal))
27+
IsAutoUpdate = true;
3528
}
3629

3730
var updateInfo = UpdateInfo.GetLatestRelease();
@@ -44,7 +37,7 @@ private void MainWindow_Loaded(object sender, RoutedEventArgs e)
4437
{
4538
if (!IsAutoUpdate)
4639
{
47-
MessageBox.Show("No new update found.", "Updater", MessageBoxButton.OK);
40+
MessageBox.Show("No new update found.", Name, MessageBoxButton.OK);
4841
}
4942

5043
Close();
@@ -59,9 +52,9 @@ private void InitUpdateInfo(UpdateInfo info)
5952
ChangeLogText.Text = "Changelog for " + info.Version;
6053
UpdateLog.Text = info.ChangeLog;
6154
DownloadButton.Click += DownloadButton_Click;
62-
63-
WindowState = WindowState.Normal;
6455
DownloadButton.IsEnabled = true;
56+
57+
Show();
6558
}
6659

6760
private void DownloadButton_Click(object sender, RoutedEventArgs e)
@@ -73,7 +66,7 @@ private void DownloadButton_Click(object sender, RoutedEventArgs e)
7366

7467
public void OnInstallCompleted(ProcessStartInfo selfUpdater = null)
7568
{
76-
MessageBox.Show($"Installed EasyERPMod {updateInfo.Version} succeeded!", Name);
69+
MessageBox.Show($"Install EasyERPMod {updateInfo.Version} succeeded!", Name);
7770

7871
if (selfUpdater != null)
7972
Process.Start(selfUpdater);

0 commit comments

Comments
 (0)