Skip to content

Commit a7c40ac

Browse files
committed
Connect as dialog improved
1 parent 1c1bfae commit a7c40ac

File tree

9 files changed

+61
-17
lines changed

9 files changed

+61
-17
lines changed

Source/NETworkManager/Controls/RemoteDesktopControl.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private void Connect()
152152
{
153153
rdpClient.Server = _rdpSessionInfo.Hostname;
154154

155-
if(_rdpSessionInfo.CustomCredentials)
155+
if (_rdpSessionInfo.CustomCredentials)
156156
{
157157
rdpClient.UserName = _rdpSessionInfo.Username;
158158
rdpClient.AdvancedSettings9.ClearTextPassword = SecureStringHelper.ConvertToString(_rdpSessionInfo.Password);
@@ -192,7 +192,7 @@ private void Connect()
192192

193193
rdpClient.Connect();
194194
}
195-
195+
196196
private void Reconnect()
197197
{
198198
if (_rdpSessionInfo.AdjustScreenAutomatically)
@@ -345,7 +345,7 @@ private void RdpClient_OnConnected(object sender, EventArgs e)
345345
Disconnected = false;
346346
Connected = true;
347347
}
348-
348+
349349
private void RdpClient_OnDisconnected(object sender, AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEvent e)
350350
{
351351
Connected = false;

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
<system:String x:Key="String_Header_ConfigureNetworkInterface">Konfiguriere Netzwerkinterface</system:String>
9696
<system:String x:Key="String_Header_Authentication">Authentifizierung</system:String>
9797
<system:String x:Key="String_Header_CredentialNotFound">Anmeldeinformation nicht gefunden!</system:String>
98-
98+
<system:String x:Key="String_Header_ConnectAs">Verbinden als</system:String>
99+
99100
<!-- Normal strings -->
100101
<system:String x:Key="String_ProductName">NETworkManager</system:String>
101102
<system:String x:Key="String_Slogan">Ein leistungsstarkes Tool zum Verwalten von Netzwerken und zur Behebung von Netzwerkproblemen!</system:String>
@@ -424,7 +425,8 @@
424425
<system:String x:Key="String_Watermark_ExampleTags">server; dmz</system:String>
425426
<system:String x:Key="String_Watermark_ExampleUsername">Admin</system:String>
426427
<system:String x:Key="String_Watermark_ExampleCredentialName">Windows-Testbenutzer</system:String>
427-
428+
<system:String x:Key="String_Watermark_ExampleRemoteDesktopSessionName">Webserver</system:String>
429+
428430
<!-- ShowProgress -->
429431
<system:String x:Key="String_Progress_SetStaticIPAddress">Setze statische IP-Adresse und Gateway...</system:String>
430432
<system:String x:Key="String_Progress_SetDynamicIPAddress">Setze dynamische IP-Adresse...</system:String>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@
424424
<system:String x:Key="String_Watermark_ExampleTags">server; dmz</system:String>
425425
<system:String x:Key="String_Watermark_ExampleUsername">Admin</system:String>
426426
<system:String x:Key="String_Watermark_ExampleCredentialName">Windows-Testuser</system:String>
427+
<system:String x:Key="String_Watermark_ExampleRemoteDesktopSessionName">Webserver</system:String>
428+
<system:String x:Key="String_Header_ConnectAs">Connect as</system:String>
427429

428430
<!-- ShowProgress -->
429431
<system:String x:Key="String_Progress_SetStaticIPAddress">Set static IP address and gateway...</system:String>

Source/NETworkManager/ViewModels/Applications/ARPTableViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using MahApps.Metro.Controls.Dialogs;
1010
using NETworkManager.ViewModels.Dialogs;
1111
using NETworkManager.Views.Dialogs;
12-
using System.Threading.Tasks;
1312

1413
namespace NETworkManager.ViewModels.Applications
1514
{

Source/NETworkManager/ViewModels/Applications/RemoteDesktopViewModel.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private async void ConnectSessionAsAction()
336336
{
337337
CustomDialog customDialog = new CustomDialog()
338338
{
339-
Title = Application.Current.Resources["String_Header_Connect"] as string
339+
Title = Application.Current.Resources["String_Header_ConnectAs"] as string
340340
};
341341

342342
RemoteDesktopSessionConnectViewModel connectRemoteDesktopSessionViewModel = new RemoteDesktopSessionConnectViewModel(instance =>
@@ -367,14 +367,16 @@ private async void ConnectSessionAsAction()
367367
}
368368
}
369369

370-
ConnectSession(remoteDesktopSessionInfo);
370+
ConnectSession(remoteDesktopSessionInfo, instance.Name);
371371
}, instance =>
372372
{
373373
dialogCoordinator.HideMetroDialogAsync(this, customDialog);
374374
ConfigurationManager.Current.FixAirspace = false;
375375
});
376376

377-
// Set the hostname
377+
// Set name, hostname
378+
connectRemoteDesktopSessionViewModel.ConnectAs = true;
379+
connectRemoteDesktopSessionViewModel.Name = SelectedSession.Name;
378380
connectRemoteDesktopSessionViewModel.Hostname = SelectedSession.Hostname;
379381

380382
// Request credentials

Source/NETworkManager/ViewModels/Dialogs/RemoteDesktopSessionConnectViewModel.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,34 @@ public ICommand CancelCommand
2121
get { return _cancelCommand; }
2222
}
2323

24+
private bool _connectAs;
25+
public bool ConnectAs
26+
{
27+
get { return _connectAs; }
28+
set
29+
{
30+
if (value == _connectAs)
31+
return;
32+
33+
_connectAs = value;
34+
OnPropertyChanged();
35+
}
36+
}
37+
38+
private string _name;
39+
public string Name
40+
{
41+
get { return _name; }
42+
set
43+
{
44+
if (value == _name)
45+
return;
46+
47+
_name = value;
48+
OnPropertyChanged();
49+
}
50+
}
51+
2452
private string _hostname;
2553
public string Hostname
2654
{

Source/NETworkManager/Views/Applications/RemoteDesktopView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<MenuItem.Icon>
7878
<Rectangle Width="16" Height="16" Fill="{DynamicResource BlackColorBrush}">
7979
<Rectangle.OpacityMask>
80-
<VisualBrush Stretch="Uniform" Visual="{IconPacks:FontAwesome Kind=Desktop}" />
80+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:Octicons Kind=DeviceDesktop}" />
8181
</Rectangle.OpacityMask>
8282
</Rectangle>
8383
</MenuItem.Icon>
@@ -86,7 +86,7 @@
8686
<MenuItem.Icon>
8787
<Rectangle Width="16" Height="16" Fill="{DynamicResource BlackColorBrush}">
8888
<Rectangle.OpacityMask>
89-
<VisualBrush Stretch="Uniform" Visual="{IconPacks:FontAwesome Kind=Desktop}" />
89+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:Octicons Kind=DeviceDesktop}" />
9090
</Rectangle.OpacityMask>
9191
</Rectangle>
9292
</MenuItem.Icon>

Source/NETworkManager/Views/Dialogs/RemoteDesktopSessionConnectDialog.xaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,25 @@
3232
<ColumnDefinition Width="*" />
3333
</Grid.ColumnDefinitions>
3434
<Grid.RowDefinitions>
35+
<RowDefinition Height="Auto" />
3536
<RowDefinition Height="Auto" />
3637
<RowDefinition Height="10" />
3738
<RowDefinition Height="Auto" />
3839
<RowDefinition Height="10" />
3940
<RowDefinition Height="Auto" />
4041
</Grid.RowDefinitions>
41-
<TextBlock Grid.Column="0" Grid.Row="0" Text="{DynamicResource String_Hostname}" />
42-
<TextBox x:Name="txtHostname" Grid.Column="2" Grid.Row="0" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_ExampleHostname}">
42+
<TextBlock Grid.Column="0" Grid.Row="0" Text="{DynamicResource String_Name}" Visibility="{Binding ConnectAs, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0,0,0,10" />
43+
<TextBox x:Name="txtName" Grid.Column="2" Grid.Row="0" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_ExampleRemoteDesktopSessionName}" Visibility="{Binding ConnectAs, Converter={StaticResource BooleanToVisibilityConverter}}" IsEnabled="{Binding ConnectAs, Converter={StaticResource BooleanReverseConverter}}" Margin="0,0,0,10">
44+
<TextBox.Text>
45+
<Binding Path="Name" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
46+
<Binding.ValidationRules>
47+
<Validator:EmptyValidator ValidatesOnTargetUpdated="True" />
48+
</Binding.ValidationRules>
49+
</Binding>
50+
</TextBox.Text>
51+
</TextBox>
52+
<TextBlock Grid.Column="0" Grid.Row="1" Text="{DynamicResource String_Hostname}" />
53+
<TextBox x:Name="txtHostname" Grid.Column="2" Grid.Row="1" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_ExampleHostname}" IsEnabled="{Binding ConnectAs, Converter={StaticResource BooleanReverseConverter}}">
4354
<TextBox.Text>
4455
<Binding Path="Hostname" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
4556
<Binding.ValidationRules>
@@ -48,9 +59,9 @@
4859
</Binding>
4960
</TextBox.Text>
5061
</TextBox>
51-
<TextBlock Grid.Column="0" Grid.Row="2" Text="{DynamicResource String_UseCredentials}" />
52-
<mah:ToggleSwitch Grid.Column="2" Grid.Row="2" OffLabel="" OnLabel="" IsChecked="{Binding UseCredentials}" />
53-
<StackPanel Grid.Column="2" Grid.Row="4" Orientation="Horizontal" Visibility="{Binding UseCredentials, Converter={StaticResource BooleanToVisibilityConverter}}">
62+
<TextBlock Grid.Column="0" Grid.Row="3" Text="{DynamicResource String_UseCredentials}" />
63+
<mah:ToggleSwitch Grid.Column="2" Grid.Row="3" OffLabel="" OnLabel="" IsChecked="{Binding UseCredentials}" IsEnabled="{Binding ConnectAs, Converter={StaticResource BooleanReverseConverter}}" />
64+
<StackPanel Grid.Column="2" Grid.Row="5" Orientation="Horizontal" Visibility="{Binding UseCredentials, Converter={StaticResource BooleanToVisibilityConverter}}">
5465
<RadioButton Content="{DynamicResource String_Credentials}" IsEnabled="{Binding CredentialsLocked, Converter={StaticResource BooleanReverseConverter}}" />
5566
<RadioButton Content="{DynamicResource String_Custom}" IsChecked="{Binding CustomCredentials}" Margin="10,0,0,0"/>
5667
</StackPanel>

Source/NETworkManager/Views/Dialogs/RemoteDesktopSessionDialog.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<ColumnDefinition Width="Auto" />
4141
</Grid.ColumnDefinitions>
4242
<TextBlock Grid.Column="0" Grid.Row="0" Text="{DynamicResource String_Name}" />
43-
<TextBox x:Name="txtName" Grid.Column="2" Grid.Row="0" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_ExampleHostname}">
43+
<TextBox x:Name="txtName" Grid.Column="2" Grid.Row="0" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_ExampleRemoteDesktopSessionName}">
4444
<TextBox.Text>
4545
<Binding Path="Name" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
4646
<Binding.ValidationRules>

0 commit comments

Comments
 (0)