Skip to content

Commit 1659332

Browse files
committed
#40, #39
1 parent eab6c74 commit 1659332

12 files changed

Lines changed: 102 additions & 11 deletions

File tree

Source/NETworkManager/App.xaml.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ private void Application_Startup(object sender, StartupEventArgs e)
2121
// Parse the command line arguments and store them in the current configuration
2222
CommandLineManager.Parse();
2323

24+
if (CommandLineManager.Current.Help)
25+
{
26+
StartupUri = new Uri("/Views/Others/HelpCommandLineWindow.xaml", UriKind.Relative);
27+
return;
28+
}
29+
2430
// If we have restart our application... wait until it has finished
2531
if (CommandLineManager.Current.RestartPid != 0)
2632
{
@@ -31,7 +37,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
3137
if (process != null)
3238
process.WaitForExit();
3339
}
34-
40+
3541
// Detect the current configuration
3642
ConfigurationManager.Detect();
3743

@@ -54,7 +60,7 @@ protected override void OnSessionEnding(SessionEndingCancelEventArgs e)
5460

5561
private void Application_Exit(object sender, ExitEventArgs e)
5662
{
57-
if (!ImportExportManager.ForceRestart)
63+
if (!ImportExportManager.ForceRestart && !CommandLineManager.Current.Help)
5864
{
5965
// Save templates
6066
if (TemplateManager.NetworkInterfaceConfigTemplatesChanged)

Source/NETworkManager/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@
508508
<StatusBarItem>
509509
<StackPanel Orientation="Horizontal">
510510
<TextBlock Text="{Binding Version}" Style="{StaticResource DefaultTextBlock}" Foreground="{DynamicResource GrayBrush3}" FontWeight="Bold" />
511-
<TextBlock Text="BETA 1" Style="{StaticResource DefaultTextBlock}" Foreground="{DynamicResource AccentColorBrush}" Margin="10,0,0,0" />
511+
<TextBlock Text="BETA" Style="{StaticResource DefaultTextBlock}" Foreground="{DynamicResource AccentColorBrush}" Margin="10,0,0,0" />
512512
</StackPanel>
513513
</StatusBarItem>
514514
</StatusBar>

Source/NETworkManager/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public MainWindow()
218218
InitializeComponent();
219219
DataContext = this;
220220

221-
// Get assembly informations
221+
// Get assembly informations
222222
AssemblyManager.Load();
223223
Version = AssemblyManager.Current.AssemblyVersion.ToString();
224224

Source/NETworkManager/Models/Settings/CommandLineInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
public class CommandLineInfo
44
{
5+
public bool Help { get; set; }
56
public bool Autostart { get; set; }
67
public bool ResetSettings { get; set; }
78
public int RestartPid { get; set; }

Source/NETworkManager/Models/Settings/CommandLineManager.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace NETworkManager.Models.Settings
77
public static class CommandLineManager
88
{
99
public const string ParameterIdentifier = "--";
10+
public const string ParameterHelp = "help";
1011
public const string ParameterAutostart = "autostart";
1112
public const string ParameterResetSettings = "reset-settings";
1213
public const string ParameterRestartPid = "restart-pid:";
@@ -32,9 +33,11 @@ public static void Parse()
3233
if (parameter.StartsWith(ParameterIdentifier))
3334
{
3435
string param = parameter.TrimStart(trimChars);
35-
36-
// Autostart
37-
if (param.Equals(ParameterAutostart, StringComparison.InvariantCultureIgnoreCase))
36+
if (param.Equals(ParameterHelp, StringComparison.InvariantCultureIgnoreCase))
37+
{
38+
Current.Help = true;
39+
}// Autostart
40+
else if(param.Equals(ParameterAutostart, StringComparison.InvariantCultureIgnoreCase))
3841
{
3942
Current.Autostart = true;
4043
} // Reset Settings
@@ -48,6 +51,14 @@ public static void Parse()
4851

4952
Current.RestartPid = restartPid;
5053
}
54+
else
55+
{
56+
Current.Help = true;
57+
}
58+
}
59+
else
60+
{
61+
Current.Help = true;
5162
}
5263
}
5364
}

Source/NETworkManager/NETworkManager.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@
179179
<Compile Include="Views\Settings\SettingsApplicationWakeOnLANView.xaml.cs">
180180
<DependentUpon>SettingsApplicationWakeOnLANView.xaml</DependentUpon>
181181
</Compile>
182+
<Compile Include="Views\Others\HelpCommandLineWindow.xaml.cs">
183+
<DependentUpon>HelpCommandLineWindow.xaml</DependentUpon>
184+
</Compile>
182185
<Compile Include="WpfHelper\ProtocolSettingsLayout.cs" />
183186
<Page Include="Resources\ContextMenu\ContextMenu.xaml">
184187
<Generator>MSBuild:Compile</Generator>
@@ -316,6 +319,10 @@
316319
<Generator>MSBuild:Compile</Generator>
317320
<SubType>Designer</SubType>
318321
</Page>
322+
<Page Include="Views\Others\HelpCommandLineWindow.xaml">
323+
<Generator>MSBuild:Compile</Generator>
324+
<SubType>Designer</SubType>
325+
</Page>
319326
<Page Include="Views\Settings\SettingsWindow.xaml">
320327
<SubType>Designer</SubType>
321328
<Generator>MSBuild:Compile</Generator>

Source/NETworkManager/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@
4949
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
5050
// übernehmen, indem Sie "*" eingeben:
5151
// [assembly: AssemblyVersion("1.0.*")]
52-
[assembly: AssemblyVersion("1.0.0.0")]
53-
[assembly: AssemblyFileVersion("1.0.0.0")]
52+
[assembly: AssemblyVersion("1.1.0.0")]
53+
[assembly: AssemblyFileVersion("1.1.0.0")]

Source/NETworkManager/Resources/Localization/Resources.de-DE.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
<system:String x:Key="String_Header_Update">Update</system:String>
6565
<system:String x:Key="String_Header_Transparency">Transparenz</system:String>
6666
<system:String x:Key="String_Header_WakeOnLAN">Wake on LAN</system:String>
67-
67+
<system:String x:Key="String_Header_HelpCommandLine">Hilfe - Kommandozeile</system:String>
68+
6869
<!-- Normal strings -->
6970
<system:String x:Key="String_ProductName">NETworkManager</system:String>
7071
<system:String x:Key="String_ShowWindow">Fenster anzeigen</system:String>

Source/NETworkManager/Resources/Localization/Resources.en-US.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<system:String x:Key="String_Header_Update">Update</system:String>
6666
<system:String x:Key="String_Header_Transparency">Transparency</system:String>
6767
<system:String x:Key="String_Header_WakeOnLAN">Wake on LAN</system:String>
68+
<system:String x:Key="String_Header_HelpCommandLine">Help - Command Line</system:String>
6869

6970
<!-- Normal strings -->
7071
<system:String x:Key="String_ProductName">NETworkManager</system:String>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<Controls:MetroWindow x:Name="MetroWindowHelpCommandLine" x:Class="NETworkManager.Views.Others.HelpCommandLineWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
7+
mc:Ignorable="d"
8+
Title="NETworkManager | Help" Topmost="True" Style="{DynamicResource DefaultWindow}" Height="450" Width="550" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" IsMinButtonEnabled="False" IsMaxRestoreButtonEnabled="False" ShowInTaskbar="False">
9+
<Controls:MetroWindow.WindowButtonCommands>
10+
<Controls:WindowButtonCommands Template="{DynamicResource MahApps.Metro.Templates.WindowButtonCommands.Win10}" />
11+
</Controls:MetroWindow.WindowButtonCommands>
12+
<Grid Margin="10">
13+
<Grid.RowDefinitions>
14+
<RowDefinition Height="Auto" />
15+
<RowDefinition Height="*" />
16+
<RowDefinition Height="Auto" />
17+
<RowDefinition Height="Auto" />
18+
</Grid.RowDefinitions>
19+
<TextBlock Grid.Row="0" Text="Command Line Arguments" Style="{StaticResource HeaderTextBlock}" />
20+
<Grid Grid.Row="1" Margin="0,0,0,10">
21+
<Grid.Resources>
22+
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource DefaultTextBlock}" />
23+
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource TextBlockAsTextBox}">
24+
<Setter Property="ContextMenu" Value="{StaticResource CopyContextMenu}" />
25+
</Style>
26+
</Grid.Resources>
27+
<Grid.ColumnDefinitions>
28+
<ColumnDefinition Width="1*" />
29+
<ColumnDefinition Width="2*" />
30+
</Grid.ColumnDefinitions>
31+
<Grid.RowDefinitions>
32+
<RowDefinition Height="Auto" />
33+
<RowDefinition Height="10" />
34+
<RowDefinition Height="Auto" />
35+
</Grid.RowDefinitions>
36+
<TextBox Grid.Column="0" Grid.Row="0" Text="--help" />
37+
<TextBlock Grid.Column="1" Grid.Row="0" Text="Displays this dialog." />
38+
<TextBox Grid.Column="0" Grid.Row="2" Text="--reset-settings" />
39+
<TextBlock Grid.Column="1" Grid.Row="2" Text="Reset all settings." />
40+
</Grid>
41+
<TextBlock Grid.Row="2" Text="The application can be started normally without parameters!" Foreground="{DynamicResource AccentColorBrush}" Style="{StaticResource DefaultTextBlock}" Margin="0,0,0,10"/>
42+
<Button Grid.Row="3" Content="{DynamicResource String_Button_OK}" Click="Button_Click" HorizontalAlignment="Right" Style="{StaticResource DefaultButton}" />
43+
</Grid>
44+
</Controls:MetroWindow>

0 commit comments

Comments
 (0)