Skip to content

Commit eafc43b

Browse files
committed
Fix #36
1 parent c69f466 commit eafc43b

5 files changed

Lines changed: 21 additions & 10 deletions

File tree

Source/NETworkManager/App.xaml.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,7 @@ public partial class App : Application
1010
{
1111
public App()
1212
{
13-
ShutdownMode = ShutdownMode.OnLastWindowClose;
14-
15-
// Parse the command line arguments and store them in the current configuration
16-
CommandLineManager.Parse();
17-
18-
// Detect the current configuration
19-
ConfigurationManager.Detect();
13+
ShutdownMode = ShutdownMode.OnLastWindowClose;
2014
}
2115
}
2216
}

Source/NETworkManager/MainWindow.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@ public MainWindow()
220220
InitializeComponent();
221221
DataContext = this;
222222

223+
// Parse the command line arguments and store them in the current configuration
224+
CommandLineManager.Parse();
225+
226+
// Detect the current configuration
227+
ConfigurationManager.Detect();
228+
223229
// Load settings
224230
SettingsManager.Load();
225231

Source/NETworkManager/Models/Settings/CommandLineInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
public class CommandLineInfo
44
{
55
public bool Autostart { get; set; }
6+
public bool ResetSettings { get; set; }
67

78
public CommandLineInfo()
89
{

Source/NETworkManager/Models/Settings/CommandLineManager.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
using System;
1+
using NETworkManager.Views.Settings;
2+
using System;
3+
using System.Windows;
24

35
namespace NETworkManager.Models.Settings
46
{
57
public static class CommandLineManager
68
{
79
public const string ParameterIdentifier = "--";
8-
public const string ParameterAutostart = "Autostart";
10+
public const string ParameterAutostart = "autostart";
11+
public const string ParameterResetSettings = "reset-settings";
912

1013
public static CommandLineInfo Current { get; set; }
1114

@@ -30,6 +33,13 @@ public static void Parse()
3033
// Autostart
3134
if (parameter.TrimStart(trimChars).Equals(ParameterAutostart, StringComparison.InvariantCultureIgnoreCase))
3235
Current.Autostart = true;
36+
else if (parameter.TrimStart(trimChars).Equals(ParameterResetSettings, StringComparison.InvariantCultureIgnoreCase))
37+
Current.ResetSettings = true;
38+
else
39+
{
40+
MetroMessageBox msg = new MetroMessageBox();
41+
msg.ShowDialog();
42+
}
3343
}
3444
}
3545
}

Source/NETworkManager/Models/Settings/SettingsManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static string SettingsLocationNotPortable
105105
#region XmlSerializer (save and load)
106106
public static void Load()
107107
{
108-
if (File.Exists(SettingsFilePath))
108+
if (File.Exists(SettingsFilePath) && !CommandLineManager.Current.ResetSettings)
109109
{
110110
SettingsInfo settingsInfo = new SettingsInfo();
111111

0 commit comments

Comments
 (0)