Skip to content

Commit f0e9906

Browse files
committed
Bugfix, bugfix and bugfix... also fixed BornToBeRoot#118
1 parent 4714a05 commit f0e9906

14 files changed

Lines changed: 240 additions & 62 deletions

Source/NETworkManager/Controls/RemoteDesktopControl.xaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:mstsc ="clr-namespace:AxMSTSCLib;assembly=AxMSTSCLib"
7-
xmlns:Converter="clr-namespace:NETworkManager.Converters"
7+
xmlns:Converter="clr-namespace:NETworkManager.Converters"
8+
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
89
mc:Ignorable="d" Loaded="UserControl_Loaded">
910
<UserControl.Resources>
11+
<Converter:BooleanReverseConverter x:Key="BooleanReverseConverter" />
1012
<Converter:BooleanReverseToVisibilityConverter x:Key="BooleanReverseToVisibilityConverter" />
13+
<Converter:BooleanReverseToVisibilityHiddenConverter x:Key="BooleanReverseToVisibilityHiddenConverter" />
1114
<Converter:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
1215
</UserControl.Resources>
1316
<Grid x:Name="rdpGrid" SizeChanged="RDPGrid_SizeChanged">
@@ -21,9 +24,10 @@
2124
<RowDefinition Height="20" />
2225
<RowDefinition Height="Auto" />
2326
</Grid.RowDefinitions>
24-
<TextBlock Grid.Row="0" Text="{DynamicResource String_Header_Disconnected}" Style="{StaticResource HeaderTextBlock}" />
25-
<TextBlock Grid.Row="1" Foreground="{DynamicResource AccentColorBrush}" Text="{Binding DisconnectReason}" Style="{DynamicResource DefaultTextBlock}" />
26-
<Button Grid.Row="4" Content="{DynamicResource String_Button_Reconnect}" Command="{Binding ReconnectCommand}" IsDefault="True" Style="{StaticResource DefaultButton}"/>
27+
<TextBlock Grid.Row="0" Text="{DynamicResource String_Header_Disconnected}" Style="{StaticResource HeaderTextBlock}" Visibility="{Binding Reconnecting, Converter={StaticResource BooleanReverseToVisibilityHiddenConverter}}" />
28+
<TextBlock Grid.Row="1" Foreground="{DynamicResource AccentColorBrush}" Text="{Binding DisconnectReason}" Style="{DynamicResource DefaultTextBlock}" Visibility="{Binding Reconnecting, Converter={StaticResource BooleanReverseToVisibilityHiddenConverter}}" />
29+
<Controls:ProgressRing Grid.Row="0" Grid.RowSpan="2" Height="50" Width="50" IsActive="{Binding Reconnecting}" Visibility="{Binding Reconnecting, Converter={StaticResource BooleanToVisibilityConverter}}"/>
30+
<Button Grid.Row="4" Content="{DynamicResource String_Button_Reconnect}" Command="{Binding ReconnectCommand}" IsDefault="True" IsEnabled="{Binding Reconnecting, Converter={StaticResource BooleanReverseConverter}}" Style="{StaticResource DefaultButton}"/>
2731
</Grid>
2832
</Grid>
2933
</UserControl>

Source/NETworkManager/Controls/RemoteDesktopControl.xaml.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Windows.Threading;
99
using NETworkManager.Utilities;
1010
using NETworkManager.Models.Settings;
11+
using System.Diagnostics;
1112

1213
namespace NETworkManager.Controls
1314
{
@@ -27,7 +28,7 @@ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName
2728

2829
private const string RemoteDesktopDisconnectReasonIdentifier = "String_RemoteDesktopDisconnectReason_";
2930

30-
private Models.RemoteDesktop.RemoteDesktopSessionInfo _rdpProfileInfo;
31+
private RemoteDesktopSessionInfo _rdpProfileInfo;
3132

3233
DispatcherTimer reconnectAdjustScreenTimer = new DispatcherTimer();
3334

@@ -75,6 +76,20 @@ public bool Connected
7576
}
7677
}
7778

79+
private bool _reconnecting;
80+
public bool Reconnecting
81+
{
82+
get { return _reconnecting; }
83+
set
84+
{
85+
if (value == _reconnecting)
86+
return;
87+
88+
_reconnecting = value;
89+
OnPropertyChanged();
90+
}
91+
}
92+
7893
private string _disconnectReason;
7994
public string DisconnectReason
8095
{
@@ -91,7 +106,7 @@ public string DisconnectReason
91106
#endregion
92107

93108
#region Constructor, load
94-
public RemoteDesktopControl(Models.RemoteDesktop.RemoteDesktopSessionInfo info)
109+
public RemoteDesktopControl(RemoteDesktopSessionInfo info)
95110
{
96111
InitializeComponent();
97112
DataContext = this;
@@ -181,6 +196,8 @@ private void Connect()
181196

182197
private void Reconnect()
183198
{
199+
Reconnecting = true;
200+
184201
if (_rdpProfileInfo.AdjustScreenAutomatically)
185202
{
186203
rdpClient.DesktopWidth = (int)rdpGrid.ActualWidth;
@@ -341,6 +358,7 @@ private void RdpClient_OnConnected(object sender, EventArgs e)
341358
private void RdpClient_OnDisconnected(object sender, AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEvent e)
342359
{
343360
Connected = false;
361+
Reconnecting = false;
344362

345363
DisconnectReason = GetDisconnectReason(e.discReason);
346364
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows;
4+
using System.Windows.Data;
5+
6+
namespace NETworkManager.Converters
7+
{
8+
public sealed class BooleanReverseToVisibilityHiddenConverter : IValueConverter
9+
{
10+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11+
{
12+
return (value is bool && (bool)value) ? Visibility.Hidden : Visibility.Visible;
13+
}
14+
15+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
16+
{
17+
throw new NotImplementedException();
18+
}
19+
}
20+
}

Source/NETworkManager/NETworkManager.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@
224224
</Compile>
225225
<Compile Include="Converters\AutoRefreshTimeToStringConverter.cs" />
226226
<Compile Include="Converters\BigIntegerToStringConverter.cs" />
227+
<Compile Include="Converters\BooleanReverseToVisibilityHiddenConverter.cs" />
227228
<Compile Include="Converters\TcpStateToStringConverter.cs" />
228229
<Compile Include="Converters\StringIsNotNullOrEmptyToBoolConverter.cs" />
229230
<Compile Include="Converters\StringIsNotNullOrEmptyToVisibilityConverter.cs" />

Source/NETworkManager/ViewModels/RemoteDesktopHostViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ private async void ConnectProfile()
567567
DataContext = credentialsMasterPasswordViewModel
568568
};
569569

570-
570+
ConfigurationManager.Current.IsDialogOpen = true;
571571
await dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
572572
}
573573
else // Connect already unlocked

Source/NETworkManager/Views/DNSLookupHostView.xaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@
1919
<dragablz:TabablzControl.InterTabController>
2020
<dragablz:InterTabController InterTabClient="{Binding InterTabClient}" MoveWindowWithSolitaryTabs="False" x:Name="InterTabController" />
2121
</dragablz:TabablzControl.InterTabController>
22+
<dragablz:TabablzControl.HeaderSuffixContent>
23+
<Grid HorizontalAlignment="Right" Width="40" Height="44">
24+
<Button Style="{StaticResource CleanButton}" Command="{Binding AddTabCommand}" ToolTip="{DynamicResource String_NewTab}" Focusable="False">
25+
<Rectangle Width="20" Height="20">
26+
<Rectangle.OpacityMask>
27+
<VisualBrush Stretch="Fill" Visual="{IconPacks:Material Kind=Plus}" />
28+
</Rectangle.OpacityMask>
29+
<Rectangle.Style>
30+
<Style TargetType="{x:Type Rectangle}">
31+
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
32+
<Style.Triggers>
33+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
34+
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
35+
</DataTrigger>
36+
</Style.Triggers>
37+
</Style>
38+
</Rectangle.Style>
39+
</Rectangle>
40+
</Button>
41+
</Grid>
42+
</dragablz:TabablzControl.HeaderSuffixContent>
2243
</dragablz:TabablzControl>
2344
<Grid VerticalAlignment="Center">
2445
<Grid.Style>

Source/NETworkManager/Views/HTTPHeadersHostView.xaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@
1919
<dragablz:TabablzControl.InterTabController>
2020
<dragablz:InterTabController InterTabClient="{Binding InterTabClient}" MoveWindowWithSolitaryTabs="False" x:Name="InterTabController" />
2121
</dragablz:TabablzControl.InterTabController>
22+
<dragablz:TabablzControl.HeaderSuffixContent>
23+
<Grid HorizontalAlignment="Right" Width="40" Height="44">
24+
<Button Style="{StaticResource CleanButton}" Command="{Binding AddTabCommand}" ToolTip="{DynamicResource String_NewTab}" Focusable="False">
25+
<Rectangle Width="20" Height="20">
26+
<Rectangle.OpacityMask>
27+
<VisualBrush Stretch="Fill" Visual="{IconPacks:Material Kind=Plus}" />
28+
</Rectangle.OpacityMask>
29+
<Rectangle.Style>
30+
<Style TargetType="{x:Type Rectangle}">
31+
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
32+
<Style.Triggers>
33+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
34+
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
35+
</DataTrigger>
36+
</Style.Triggers>
37+
</Style>
38+
</Rectangle.Style>
39+
</Rectangle>
40+
</Button>
41+
</Grid>
42+
</dragablz:TabablzControl.HeaderSuffixContent>
2243
</dragablz:TabablzControl>
2344
<Grid VerticalAlignment="Center">
2445
<Grid.Style>

Source/NETworkManager/Views/IPScannerHostView.xaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,27 @@
2727
<dragablz:TabablzControl.InterTabController>
2828
<dragablz:InterTabController InterTabClient="{Binding InterTabClient}" MoveWindowWithSolitaryTabs="False" x:Name="InterTabController" />
2929
</dragablz:TabablzControl.InterTabController>
30+
<dragablz:TabablzControl.HeaderSuffixContent>
31+
<Grid HorizontalAlignment="Right" Width="40" Height="44">
32+
<Button Style="{StaticResource CleanButton}" Command="{Binding AddTabCommand}" ToolTip="{DynamicResource String_NewTab}" Focusable="False">
33+
<Rectangle Width="20" Height="20">
34+
<Rectangle.OpacityMask>
35+
<VisualBrush Stretch="Fill" Visual="{IconPacks:Material Kind=Plus}" />
36+
</Rectangle.OpacityMask>
37+
<Rectangle.Style>
38+
<Style TargetType="{x:Type Rectangle}">
39+
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
40+
<Style.Triggers>
41+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
42+
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
43+
</DataTrigger>
44+
</Style.Triggers>
45+
</Style>
46+
</Rectangle.Style>
47+
</Rectangle>
48+
</Button>
49+
</Grid>
50+
</dragablz:TabablzControl.HeaderSuffixContent>
3051
</dragablz:TabablzControl>
3152
<Grid Grid.Column="0" VerticalAlignment="Center">
3253
<Grid.Style>

Source/NETworkManager/Views/PingHostView.xaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,27 @@
2626
<dragablz:TabablzControl.InterTabController>
2727
<dragablz:InterTabController InterTabClient="{Binding InterTabClient}" MoveWindowWithSolitaryTabs="False" x:Name="InterTabController" />
2828
</dragablz:TabablzControl.InterTabController>
29+
<dragablz:TabablzControl.HeaderSuffixContent>
30+
<Grid HorizontalAlignment="Right" Width="40" Height="44">
31+
<Button Style="{StaticResource CleanButton}" Command="{Binding AddTabCommand}" ToolTip="{DynamicResource String_NewTab}" Focusable="False">
32+
<Rectangle Width="20" Height="20">
33+
<Rectangle.OpacityMask>
34+
<VisualBrush Stretch="Fill" Visual="{IconPacks:Material Kind=Plus}" />
35+
</Rectangle.OpacityMask>
36+
<Rectangle.Style>
37+
<Style TargetType="{x:Type Rectangle}">
38+
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
39+
<Style.Triggers>
40+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
41+
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
42+
</DataTrigger>
43+
</Style.Triggers>
44+
</Style>
45+
</Rectangle.Style>
46+
</Rectangle>
47+
</Button>
48+
</Grid>
49+
</dragablz:TabablzControl.HeaderSuffixContent>
2950
</dragablz:TabablzControl>
3051
<Grid Grid.Column="0" Grid.Row="0" VerticalAlignment="Center">
3152
<Grid.Style>

Source/NETworkManager/Views/PortScannerHostView.xaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,28 @@
2727
<dragablz:TabablzControl.InterTabController>
2828
<dragablz:InterTabController InterTabClient="{Binding InterTabClient}" MoveWindowWithSolitaryTabs="False" x:Name="InterTabController" />
2929
</dragablz:TabablzControl.InterTabController>
30-
</dragablz:TabablzControl>
30+
<dragablz:TabablzControl.HeaderSuffixContent>
31+
<Grid HorizontalAlignment="Right" Width="40" Height="44">
32+
<Button Style="{StaticResource CleanButton}" Command="{Binding AddTabCommand}" ToolTip="{DynamicResource String_NewTab}" Focusable="False">
33+
<Rectangle Width="20" Height="20">
34+
<Rectangle.OpacityMask>
35+
<VisualBrush Stretch="Fill" Visual="{IconPacks:Material Kind=Plus}" />
36+
</Rectangle.OpacityMask>
37+
<Rectangle.Style>
38+
<Style TargetType="{x:Type Rectangle}">
39+
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
40+
<Style.Triggers>
41+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
42+
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
43+
</DataTrigger>
44+
</Style.Triggers>
45+
</Style>
46+
</Rectangle.Style>
47+
</Rectangle>
48+
</Button>
49+
</Grid>
50+
</dragablz:TabablzControl.HeaderSuffixContent>
51+
</dragablz:TabablzControl>
3152
<Grid Grid.Column="0" Grid.Row="0" VerticalAlignment="Center">
3253
<Grid.Style>
3354
<Style TargetType="{x:Type Grid}">

0 commit comments

Comments
 (0)