Skip to content

Commit 6f09b2a

Browse files
committed
Chore: Refactoring & Cleanup & Docs
1 parent 7b433a1 commit 6f09b2a

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

Source/NETworkManager/Controls/WebConsoleControl.xaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:NETworkManager.Controls"
77
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
8-
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
98
xmlns:validators="clr-namespace:NETworkManager.Validators;assembly=NETworkManager.Validators"
109
xmlns:converters="clr-namespace:NETworkManager.Converters;assembly=NETworkManager.Converters"
1110
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
11+
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
1212
xmlns:webview="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
1313
mah:DialogParticipation.Register="{Binding}"
1414
mc:Ignorable="d" Loaded="UserControl_Loaded" d:DataContext="{d:DesignInstance local:WebConsoleControl}">
@@ -24,7 +24,9 @@
2424
<RowDefinition Height="Auto" />
2525
<RowDefinition Height="*" />
2626
</Grid.RowDefinitions>
27-
<Grid Grid.Row="0" Margin="10" Visibility="{Binding ShowAddressBar, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">
27+
<Grid Grid.Column="0" Grid.Row="0"
28+
Margin="10"
29+
Visibility="{Binding Source={x:Static Member=settings:SettingsManager.Current}, Path=WebConsole_ShowAddressBar, Converter={StaticResource ResourceKey=BooleanToVisibilityCollapsedConverter}}">
2830
<Grid.ColumnDefinitions>
2931
<ColumnDefinition Width="Auto" />
3032
<ColumnDefinition Width="10" />

Source/NETworkManager/Controls/WebConsoleControl.xaml.cs

-13
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public string Url
5959
}
6060
}
6161

62-
public bool ShowAddressBar => SettingsManager.Current.WebConsole_ShowAddressBar;
6362
#endregion
6463

6564
#region Constructor, load
@@ -74,8 +73,6 @@ public WebConsoleControl(WebConsoleSessionInfo sessionInfo)
7473
Browser2.NavigationCompleted += Browser2_NavigationCompleted;
7574
Browser2.SourceChanged += Browser2_SourceChanged;
7675

77-
SettingsManager.Current.PropertyChanged += Current_PropertyChanged;
78-
7976
Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
8077
}
8178

@@ -179,16 +176,6 @@ private void Browser2_NavigationCompleted(object sender, CoreWebView2NavigationC
179176
IsLoading = false;
180177
}
181178

182-
private void Current_PropertyChanged(object sender, PropertyChangedEventArgs e)
183-
{
184-
switch (e.PropertyName)
185-
{
186-
case nameof(SettingsInfo.WebConsole_ShowAddressBar):
187-
OnPropertyChanged(nameof(ShowAddressBar));
188-
break;
189-
}
190-
}
191-
192179
private void Dispatcher_ShutdownStarted(object sender, EventArgs e)
193180
{
194181
CloseTab();

Source/NETworkManager/Views/WebConsoleHostView.xaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<Grid Height="32">
7575
<Grid.ContextMenu>
7676
<ContextMenu>
77-
<MenuItem Header="{x:Static localization:Strings.Reload}" Command="{Binding Data.ReloadCommand, Source={StaticResource BindingProxy}}" CommandParameter="{Binding View}">
77+
<MenuItem Header="{x:Static localization:Strings.Reload}" Command="{Binding Path=Data.(viewModels:WebConsoleHostViewModel.ReloadCommand), Source={StaticResource BindingProxy}}" CommandParameter="{Binding View}">
7878
<MenuItem.Icon>
7979
<Rectangle Width="16" Height="16" Fill="{DynamicResource MahApps.Brushes.Gray3}">
8080
<Rectangle.OpacityMask>
@@ -318,7 +318,7 @@
318318
<ColumnDefinition Width="10" />
319319
<ColumnDefinition Width="Auto" />
320320
</Grid.ColumnDefinitions>
321-
<Rectangle Grid.Column="0" Grid.ColumnSpan="4" Fill="Transparent" />
321+
<Rectangle Grid.Column="0" Grid.ColumnSpan="3" Fill="Transparent" />
322322
<TextBlock Grid.Column="0" Text="{Binding (CollectionViewGroup.Name)}" Style="{DynamicResource ProfileGroupTextBlock}" />
323323
<Button Grid.Column="2" ToolTip="{x:Static localization:Strings.EditGroupDots}" Command="{Binding DataContext.EditGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBox}}}" CommandParameter="{Binding (CollectionViewGroup.Name)}" Visibility="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" Style="{StaticResource CleanButton}">
324324
<Rectangle Width="16" Height="16">
@@ -467,7 +467,7 @@
467467
</ToggleButton>
468468
<TextBlock Grid.Column="0" Grid.Row="2"
469469
Text="{Binding Source={x:Static settings:ConfigurationManager.Current}, Path=ProfileManagerErrorMessage}"
470-
Style="{StaticResource MessageTextBlock}" VerticalAlignment="Center" HorizontalAlignment="Center"
470+
Style="{StaticResource MessageTextBlock}"
471471
Margin="0,0,0,10" />
472472
</Grid>
473473
</Grid>

Source/NETworkManager/Views/WebConsoleHostView.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace NETworkManager.Views;
88

99
public partial class WebConsoleHostView
1010
{
11-
private readonly WebConsoleHostViewModel _viewModel = new WebConsoleHostViewModel(DialogCoordinator.Instance);
11+
private readonly WebConsoleHostViewModel _viewModel = new(DialogCoordinator.Instance);
1212

1313
public WebConsoleHostView()
1414
{

0 commit comments

Comments
 (0)