Projects STRLCPY NETworkManager Commits 96e5beac
🤬
  • ■ ■ ■ ■
    Source/NETworkManager/Controls/DragablzTabHostWindow.xaml
    skipped 467 lines
    468 468   <MenuItem.Icon>
    469 469   <Rectangle Width="16" Height="16" Fill="{DynamicResource MahApps.Brushes.Gray3}">
    470 470   <Rectangle.OpacityMask>
    471  - <VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=Restart}" />
     471 + <VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=Refresh}" />
    472 472   </Rectangle.OpacityMask>
    473 473   </Rectangle>
    474 474   </MenuItem.Icon>
    skipped 56 lines
  • ■ ■ ■ ■ ■
    Source/NETworkManager/Controls/WebConsoleControl.xaml
    skipped 5 lines
    6 6   xmlns:networkManagerControls="clr-namespace:NETworkManager.Controls;assembly=NETworkManager"
    7 7   xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
    8 8   xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
     9 + xmlns:validators="clr-namespace:NETworkManager.Validators;assembly=NETworkManager.Validators"
    9 10   xmlns:converters="clr-namespace:NETworkManager.Converters;assembly=NETworkManager.Converters"
    10 11   xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
    11 12   xmlns:webview="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
    12 13   mah:DialogParticipation.Register="{Binding}"
    13 14   mc:Ignorable="d" Loaded="UserControl_Loaded" d:DataContext="{d:DesignInstance networkManagerControls:WebConsoleControl}">
    14 15   <UserControl.Resources>
     16 + <converters:BooleanReverseConverter x:Key="BooleanReverseConverter" />
    15 17   <converters:BooleanReverseToVisibilityCollapsedConverter x:Key="BooleanReverseToVisibilityCollapsedConverter" />
    16 18   <converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
     19 + <converters:BooleanToVisibilityHiddenConverter x:Key="BooleanToVisibilityHiddenConverter" />
    17 20   </UserControl.Resources>
    18 21   <Grid>
    19 22   <Grid.RowDefinitions>
    skipped 1 lines
    21 24   <RowDefinition Height="Auto" />
    22 25   <RowDefinition Height="*" />
    23 26   </Grid.RowDefinitions>
    24  - <Grid Grid.Row="0" Margin="10">
     27 + <Grid Grid.Row="0" Margin="10,10,10,5">
    25 28   <Grid.ColumnDefinitions>
    26 29   <ColumnDefinition Width="Auto" />
    27 30   <ColumnDefinition Width="10" />
    skipped 6 lines
    34 37   <ColumnDefinition Width="Auto" />
    35 38   </Grid.ColumnDefinitions>
    36 39   <Button Command="{Binding GoBackCommand}" Grid.Column="0" Style="{StaticResource CleanButton}">
    37  - <Rectangle Width="24" Height="24" >
     40 + <Rectangle Width="20" Height="20" >
    38 41   <Rectangle.OpacityMask>
    39 42   <VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=ArrowLeftCircleOutline}" />
    40 43   </Rectangle.OpacityMask>
    skipped 9 lines
    50 53   </Rectangle.Style>
    51 54   </Rectangle>
    52 55   </Button>
    53  - <Button Command="{Binding GoForwardCommand}" Grid.Column="2" Style="{StaticResource CleanButton}">
    54  - <Rectangle Width="24" Height="24" >
     56 + <Button Command="{Binding GoForwardCommand}" Grid.Column="2" Style="{StaticResource CleanButton}">
     57 + <Rectangle Width="20" Height="20" >
    55 58   <Rectangle.OpacityMask>
    56 59   <VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=ArrowRightCircleOutline}" />
    57 60   </Rectangle.OpacityMask>
    skipped 10 lines
    68 71   </Rectangle>
    69 72   </Button>
    70 73   <Button Command="{Binding ReloadCommand}" Grid.Column="4" Style="{StaticResource CleanButton}">
    71  - <Rectangle Width="24" Height="24" >
     74 + <Rectangle Width="20" Height="20" >
    72 75   <Rectangle.OpacityMask>
    73 76   <VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=Refresh}" />
    74 77   </Rectangle.OpacityMask>
    skipped 9 lines
    84 87   </Rectangle.Style>
    85 88   </Rectangle>
    86 89   </Button>
    87  - <TextBox x:Name="txtBoxAddress" Text="{Binding Url, UpdateSourceTrigger=PropertyChanged}" Grid.Column="6" Style="{StaticResource DefaultTextBox}" />
    88  - <Button Command="{Binding NavigateCommand}" IsDefault="True" Grid.Column="8" Style="{StaticResource CleanButton}">
    89  - <Rectangle Width="24" Height="24" >
     90 + <TextBox x:Name="TextBoxUrl" Grid.Column="6" Style="{StaticResource DefaultTextBox}">
     91 + <TextBox.Text>
     92 + <Binding Path="Url" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
     93 + <Binding.ValidationRules>
     94 + <validators:EmptyValidator ValidatesOnTargetUpdated="True" />
     95 + <validators:HttpAndHttpsUriValidator ValidatesOnTargetUpdated="True" />
     96 + </Binding.ValidationRules>
     97 + </Binding>
     98 + </TextBox.Text>
     99 + </TextBox>
     100 + <Button Command="{Binding NavigateCommand}" IsDefault="{Binding IsLoading, Converter={StaticResource BooleanReverseConverter}}" Visibility="{Binding IsLoading,Converter={StaticResource BooleanReverseToVisibilityCollapsedConverter}}" Grid.Column="8">
     101 + <Button.Style>
     102 + <Style TargetType="{x:Type Button}" BasedOn="{StaticResource CleanButton}">
     103 + <Setter Property="IsEnabled" Value="False" />
     104 + <Style.Triggers>
     105 + <DataTrigger Binding="{Binding Path=(Validation.HasError), ElementName=TextBoxUrl}" Value="False">
     106 + <Setter Property="IsEnabled" Value="True" />
     107 + </DataTrigger>
     108 + </Style.Triggers>
     109 + </Style>
     110 + </Button.Style>
     111 + <Rectangle Width="20" Height="20" >
    90 112   <Rectangle.OpacityMask>
    91 113   <VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=Play}" />
    92 114   </Rectangle.OpacityMask>
    93 115   <Rectangle.Style>
    94 116   <Style TargetType="{x:Type Rectangle}">
    95 117   <Setter Property="Fill" Value="{DynamicResource MahApps.Brushes.Gray3}" />
     118 + <Setter Property="IsEnabled" Value="True" />
    96 119   <Style.Triggers>
    97 120   <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
    98 121   <Setter Property="Fill" Value="{DynamicResource MahApps.Brushes.Gray5}" />
    skipped 3 lines
    102 125   </Rectangle.Style>
    103 126   </Rectangle>
    104 127   </Button>
     128 + <Button Command="{Binding StopCommand}" IsCancel="{Binding IsLoading}" Style="{StaticResource CleanButton}" Visibility="{Binding IsLoading,Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" Grid.Column="8">
     129 + <Rectangle Width="20" Height="20" >
     130 + <Rectangle.OpacityMask>
     131 + <VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=WindowClose}" />
     132 + </Rectangle.OpacityMask>
     133 + <Rectangle.Style>
     134 + <Style TargetType="{x:Type Rectangle}">
     135 + <Setter Property="Fill" Value="{DynamicResource MahApps.Brushes.Gray3}" />
     136 + <Setter Property="IsEnabled" Value="True" />
     137 + <Style.Triggers>
     138 + <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
     139 + <Setter Property="Fill" Value="Red" />
     140 + </DataTrigger>
     141 + </Style.Triggers>
     142 + </Style>
     143 + </Rectangle.Style>
     144 + </Rectangle>
     145 + </Button>
    105 146   </Grid>
    106  - <mah:MetroProgressBar Grid.Row="1" IsIndeterminate="True" Visibility="{Binding IsLoading, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" Margin="0,0,0,10"/>
     147 + <mah:MetroProgressBar Grid.Row="1" IsIndeterminate="True" Visibility="{Binding IsLoading, Converter={StaticResource BooleanToVisibilityHiddenConverter}}" Margin="0,0,0,5" />
    107 148   <webview:WebView2 Grid.Row="2" x:Name="Browser2">
    108 149   <webview:WebView2.Style>
    109 150   <Style TargetType="{x:Type webview:WebView2}">
    skipped 11 lines
  • ■ ■ ■ ■ ■ ■
    Source/NETworkManager/Controls/WebConsoleControl.xaml.cs
    skipped 79 lines
    80 80   
    81 81   Browser2.NavigationStarting += Browser2_NavigationStarting;
    82 82   Browser2.NavigationCompleted += Browser2_NavigationCompleted;
    83  - Browser2.WebMessageReceived += Browser2_WebMessageReceived;
     83 + Browser2.SourceChanged += Browser2_SourceChanged;
    84 84   
    85 85   Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
    86 86   }
    87 87   
     88 + private void Browser2_SourceChanged(object sender, CoreWebView2SourceChangedEventArgs e)
     89 + {
     90 + Url = Browser2.Source.ToString();
     91 + }
     92 + 
    88 93   private async void UserControl_Loaded(object sender, RoutedEventArgs e)
    89 94   {
    90 95   // Connect after the control is drawn and only on the first init
    skipped 4 lines
    95 100   var webView2Environment = await CoreWebView2Environment.CreateAsync(null, GlobalStaticConfiguration.WebConsole_Cache);
    96 101   await Browser2.EnsureCoreWebView2Async(webView2Environment);
    97 102   
    98  - Connect();
     103 + Navigate(_sessionInfo.Url);
    99 104   
    100 105   _initialized = true;
    101 106   }
     107 + #endregion
    102 108   
    103  - private void Dispatcher_ShutdownStarted(object sender, EventArgs e)
    104  - {
    105  - CloseTab();
    106  - }
    107  - #endregion
    108 109   
    109 110   #region ICommands & Actions
    110  - public ICommand NavigateCommand
    111  - {
    112  - get { return new RelayCommand(p => NavigateAction(), NavigateCommand_CanExecute); }
    113  - }
     111 + 
     112 + private bool NavigateCommand_CanExecute(object obj) => !IsLoading;
    114 113   
    115  - private bool NavigateCommand_CanExecute(object obj)
    116  - {
    117  - return !IsLoading;
    118  - }
     114 + public ICommand NavigateCommand => new RelayCommand(p => NavigateAction(), NavigateCommand_CanExecute);
    119 115   
    120 116   private void NavigateAction()
    121 117   {
    122  - Browser2.CoreWebView2.Navigate(Url);
     118 + Navigate(Url);
    123 119   }
    124 120   
    125  - public ICommand ReloadCommand
    126  - {
    127  - get { return new RelayCommand(p => ReloadAction(), ReloadCommand_CanExecute); }
    128  - }
     121 + private bool StopCommand_CanExecute(object obj) => IsLoading;
    129 122   
    130  - private bool ReloadCommand_CanExecute(object obj)
     123 + public ICommand StopCommand => new RelayCommand(p => StopAction(), StopCommand_CanExecute);
     124 + 
     125 + private void StopAction()
    131 126   {
    132  - return !IsLoading;
     127 + Stop();
    133 128   }
    134 129   
     130 + private bool ReloadCommand_CanExecute(object obj) => !IsLoading;
     131 + 
     132 + public ICommand ReloadCommand => new RelayCommand(p => ReloadAction(), ReloadCommand_CanExecute);
     133 +
    135 134   private void ReloadAction()
    136 135   {
    137 136   Browser2.Reload();
    138 137   }
    139 138   
    140  - public ICommand GoBackCommand
    141  - {
    142  - get { return new RelayCommand(p => GoBackAction(), GoBackCommand_CanExecute); }
    143  - }
     139 + private bool GoBackCommand_CanExecute(object obj) => !IsLoading && Browser2.CanGoBack;
    144 140   
    145  - private bool GoBackCommand_CanExecute(object obj)
    146  - {
    147  - return !IsLoading && Browser2.CanGoBack;
    148  - }
     141 + public ICommand GoBackCommand => new RelayCommand(p => GoBackAction(), GoBackCommand_CanExecute);
    149 142   
    150 143   private void GoBackAction()
    151 144   {
    152 145   Browser2.GoBack();
    153 146   }
    154 147   
    155  - public ICommand GoForwardCommand
    156  - {
    157  - get { return new RelayCommand(p => GoForwardAction(), GoForwardCommand_CanExecute); }
    158  - }
     148 + private bool GoForwardCommand_CanExecute(object obj) => !IsLoading && Browser2.CanGoForward;
    159 149   
    160  - private bool GoForwardCommand_CanExecute(object obj)
    161  - {
    162  - return !IsLoading && Browser2.CanGoForward;
    163  - }
     150 + public ICommand GoForwardCommand => new RelayCommand(p => GoForwardAction(), GoForwardCommand_CanExecute);
    164 151   
    165 152   private void GoForwardAction()
    166 153   {
    skipped 2 lines
    169 156   #endregion
    170 157   
    171 158   #region Methods
    172  - private void Connect()
     159 + private void Navigate(string url)
    173 160   {
    174  - Browser2.Source = new Uri(_sessionInfo.Url);
     161 + Browser2.Source = new Uri(url);
     162 + }
     163 + 
     164 + private void Stop()
     165 + {
     166 + Browser2.Stop();
    175 167   }
    176 168   
    177 169   public void CloseTab()
    skipped 3 lines
    181 173   #endregion
    182 174   
    183 175   #region Events
     176 + private void Browser2_NavigationStarting(object sender, CoreWebView2NavigationStartingEventArgs e)
     177 + {
     178 + IsLoading = true;
     179 + }
     180 +
    184 181   private void Browser2_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e)
    185 182   {
    186 183   if (FirstLoad)
    skipped 2 lines
    189 186   IsLoading = false;
    190 187   }
    191 188   
    192  - private void Browser2_NavigationStarting(object sender, CoreWebView2NavigationStartingEventArgs e)
     189 + private void Dispatcher_ShutdownStarted(object sender, EventArgs e)
    193 190   {
    194  - IsLoading = true;
    195  - 
    196  - Url = e.Uri.ToString();
    197  - }
    198  - 
    199  - private void Browser2_WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs e)
    200  - {
    201  - string uri = e.TryGetWebMessageAsString();
    202  - Url = uri;
     191 + CloseTab();
    203 192   }
    204 193   #endregion
    205 194  }
    skipped 1 lines
  • ■ ■ ■ ■
    Source/NETworkManager/Views/WebConsoleHostView.xaml
    skipped 78 lines
    79 79   <MenuItem.Icon>
    80 80   <Rectangle Width="16" Height="16" Fill="{DynamicResource MahApps.Brushes.Gray3}">
    81 81   <Rectangle.OpacityMask>
    82  - <VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=Restart}" />
     82 + <VisualBrush Stretch="Uniform" Visual="{iconPacks:Material Kind=Refresh}" />
    83 83   </Rectangle.OpacityMask>
    84 84   </Rectangle>
    85 85   </MenuItem.Icon>
    skipped 410 lines
  • ■ ■ ■ ■ ■ ■
    docs/Changelog/next-release.md
    skipped 31 lines
    32 32   - Option added to limit the number of concurrent threads per host scan (256) & port scan (5). Increasing the values can speed up the scan, but can also lead to resource problems. [#2026](https://github.com/BornToBeRoot/NETworkManager/pull/2026){:target="\_blank"}
    33 33  - **Port Scanner**
    34 34   - Option added to limit the number of concurrent threads per host scan (5) & port scan (256). Increasing the values can speed up the scan, but can also lead to resource problems. [#2026](https://github.com/BornToBeRoot/NETworkManager/pull/2026){:target="\_blank"}
     35 +- **Web Console**
     36 + - Add cancel button (and `Esc` key) to stop navigation to a website [#2069](https://github.com/BornToBeRoot/NETworkManager/pull/2069){:target="\_blank"}
    35 37   
    36 38  ## Bugfixes
    37 39   
    skipped 16 lines
    54 56   - Resize command in TabControl context menu in a dragged out window not working [#2060](https://github.com/BornToBeRoot/NETworkManager/pull/2060){:target="\_blank"}
    55 57  - **Web Console**
    56 58   - Reload command in TabControl context menu in main window not working [#2060](https://github.com/BornToBeRoot/NETworkManager/pull/2060){:target="\_blank"}
     59 + - Validate URL in the bar to prevent app crash [#2069](https://github.com/BornToBeRoot/NETworkManager/pull/2069){:target="\_blank"}
     60 + - Update URL in the bar when the source (WebView2) has changed [#2069](https://github.com/BornToBeRoot/NETworkManager/pull/2069){:target="\_blank"}
    57 61  - **Lookup - OUI**
    58 62   - Export to CSV fixed if `Vendor` contains a comma [#2026](https://github.com/BornToBeRoot/NETworkManager/pull/2026){:target="\_blank"}
    59 63  - **Lookup - Port**
    skipped 8 lines
Please wait...
Page is in error, reload to recover