Added context menu item for showing status/settings window.
parent
f88c6ef6b0
commit
525f059ecc
|
@ -23,6 +23,9 @@
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Header="Pause for 5 minutes"
|
<MenuItem Header="Pause for 5 minutes"
|
||||||
ToolTip="Restores interfaces to original status."/>
|
ToolTip="Restores interfaces to original status."/>
|
||||||
|
<MenuItem Header="Status and Settings"
|
||||||
|
ToolTip=""
|
||||||
|
Click="ContextMenu_StatusSettings"/>
|
||||||
<MenuItem Header="Quit"
|
<MenuItem Header="Quit"
|
||||||
Click="ContextMenu_Quit"
|
Click="ContextMenu_Quit"
|
||||||
Icon="{StaticResource CloseIcon}"
|
Icon="{StaticResource CloseIcon}"
|
||||||
|
|
|
@ -33,10 +33,7 @@ namespace WifiSitterGui
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_windowVm = new MainWindowViewModel();
|
_windowVm = new MainWindowViewModel();
|
||||||
|
ShowStatusSettingsWindow();
|
||||||
_statusGui = new MainWindow();
|
|
||||||
_statusGui.DataContext = _windowVm;
|
|
||||||
_statusGui.Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,9 +47,30 @@ namespace WifiSitterGui
|
||||||
#endregion // properties
|
#endregion // properties
|
||||||
|
|
||||||
#region methods
|
#region methods
|
||||||
|
|
||||||
|
void ShowStatusSettingsWindow() {
|
||||||
|
_statusGui = new MainWindow();
|
||||||
|
_statusGui.DataContext = _windowVm;
|
||||||
|
_statusGui.Closed += (s, e) => {
|
||||||
|
this.Dispatcher.Invoke(new Action(() => { _statusGui = null; }));
|
||||||
|
};
|
||||||
|
_statusGui.Show();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion // methods
|
#endregion // methods
|
||||||
|
|
||||||
#region eventhandlers
|
#region eventhandlers
|
||||||
|
|
||||||
|
private void ContextMenu_StatusSettings(object sender, RoutedEventArgs e) {
|
||||||
|
if (_statusGui == null) {
|
||||||
|
ShowStatusSettingsWindow();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_statusGui.WindowState = WindowState.Normal;
|
||||||
|
_statusGui.Activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ContextMenu_Quit(object sender, RoutedEventArgs e) {
|
private void ContextMenu_Quit(object sender, RoutedEventArgs e) {
|
||||||
_statusGui?.Close();
|
_statusGui?.Close();
|
||||||
|
|
Loading…
Reference in New Issue