Skip to content

Commit 3d95702

Browse files
committed
dialog modified
1 parent 72dd70d commit 3d95702

4 files changed

Lines changed: 163 additions & 9 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@
323323
<system:String x:Key="String_RemainingTime">Verbleibende Zeit</system:String>
324324
<system:String x:Key="String_UserInterfaceLocked">Benutzeroberfläche gesperrt!</system:String>
325325
<system:String x:Key="String_CredentialNotFoundMessage">Die Anmeldeinformation wurde gelöscht. Bearbeiten Sie die Sitzung und wählen Sie eine andere Anmeldeinformation oder löschen die vorhandene.</system:String>
326+
<system:String x:Key="String_Credentials">Anmeldeinformationen</system:String>
327+
<system:String x:Key="String_Custom">Eigene</system:String>
328+
<system:String x:Key="String_UseCredentials">Anmeldeinformationen verwenden</system:String>
326329

327330
<!-- Help message -->
328331
<system:String x:Key="String_HelpMessage_ParameterHelp">Zeigt diesen Dialog an.</system:String>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@
323323
<system:String x:Key="String_RemainingTime">Remaining time</system:String>
324324
<system:String x:Key="String_UserInterfaceLocked">User interface locked!</system:String>
325325
<system:String x:Key="String_CredentialNotFoundMessage">Edit the session and select a different credential or delete the existing one</system:String>
326+
<system:String x:Key="String_Credentials">Credentials</system:String>
327+
<system:String x:Key="String_Custom">Custom</system:String>
328+
<system:String x:Key="String_UseCredentials">Use credentials</system:String>
326329

327330
<!-- Help message -->
328331
<system:String x:Key="String_HelpMessage_ParameterHelp">Displays this dialog.</system:String>

Source/NETworkManager/ViewModels/Dialogs/RemoteDesktopSessionConnectViewModel.cs

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Security;
23
using System.Windows.Input;
34

45
namespace NETworkManager.ViewModels.Dialogs
@@ -30,7 +31,63 @@ public string Hostname
3031
OnPropertyChanged();
3132
}
3233
}
33-
34+
35+
private bool _useCredential;
36+
public bool UseCredential
37+
{
38+
get { return _useCredential; }
39+
set
40+
{
41+
if (value == _useCredential)
42+
return;
43+
44+
_useCredential = value;
45+
OnPropertyChanged();
46+
}
47+
}
48+
49+
private bool _customCredentials = true;
50+
public bool CustomCredentials
51+
{
52+
get { return _customCredentials; }
53+
set
54+
{
55+
if (value == _customCredentials)
56+
return;
57+
58+
_customCredentials = value;
59+
OnPropertyChanged();
60+
}
61+
}
62+
63+
private string _username;
64+
public string Username
65+
{
66+
get { return _username; }
67+
set
68+
{
69+
if (value == _username)
70+
return;
71+
72+
_username = value;
73+
OnPropertyChanged();
74+
}
75+
}
76+
77+
private SecureString _password = new SecureString();
78+
public SecureString Password
79+
{
80+
get { return _password; }
81+
set
82+
{
83+
if (value == _password)
84+
return;
85+
86+
_password = value;
87+
OnPropertyChanged();
88+
}
89+
}
90+
3491
public RemoteDesktopSessionConnectViewModel(Action<RemoteDesktopSessionConnectViewModel> connectCommand, Action<RemoteDesktopSessionConnectViewModel> cancelHandler)
3592
{
3693
_connectCommand = new RelayCommand(p => connectCommand(this));

Source/NETworkManager/Views/Dialogs/RemoteDesktopSessionConnectDialog.xaml

Lines changed: 99 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,131 @@
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:Validator="clr-namespace:NETworkManager.Validators"
7-
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
7+
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
8+
xmlns:WpfHelper="clr-namespace:NETworkManager.WpfHelper"
9+
xmlns:Converter="clr-namespace:NETworkManager.Converters"
10+
xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
811
mc:Ignorable="d" Loaded="UserControl_Loaded">
12+
<UserControl.Resources>
13+
<Converter:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
14+
<Converter:BooleanReverseToVisibilityConverter x:Key="BooleanReverseToVisibilityConverter" />
15+
</UserControl.Resources>
916
<Grid Margin="0,20">
1017
<Grid.RowDefinitions>
11-
<RowDefinition Height="*" />
18+
<RowDefinition Height="Auto" />
19+
<RowDefinition Height="Auto" />
1220
<RowDefinition Height="10" />
1321
<RowDefinition Height="Auto" />
1422
</Grid.RowDefinitions>
1523
<Grid Grid.Row="0">
1624
<Grid.Resources>
1725
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource CenterTextBlock}" />
1826
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource DefaultTextBox}" />
19-
<Style TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource DefaultPasswordBox}" />
2027
</Grid.Resources>
21-
<Grid.RowDefinitions>
22-
<RowDefinition Height="Auto" />
23-
</Grid.RowDefinitions>
2428
<Grid.ColumnDefinitions>
2529
<ColumnDefinition Width="*" />
2630
<ColumnDefinition Width="10" />
2731
<ColumnDefinition Width="*" />
2832
</Grid.ColumnDefinitions>
33+
<Grid.RowDefinitions>
34+
<RowDefinition Height="Auto" />
35+
<RowDefinition Height="10" />
36+
<RowDefinition Height="Auto" />
37+
<RowDefinition Height="10" />
38+
<RowDefinition Height="Auto" />
39+
</Grid.RowDefinitions>
2940
<TextBlock Grid.Column="0" Grid.Row="0" Text="{DynamicResource String_Hostname}" />
3041
<TextBox x:Name="txtHostname" Grid.Column="2" Grid.Row="0" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_ExampleHostname}">
3142
<TextBox.Text>
32-
<Binding Path="Hostname" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" >
43+
<Binding Path="Hostname" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
3344
<Binding.ValidationRules>
3445
<Validator:EmptyValidator ValidatesOnTargetUpdated="True" />
3546
</Binding.ValidationRules>
3647
</Binding>
3748
</TextBox.Text>
3849
</TextBox>
50+
<TextBlock Grid.Column="0" Grid.Row="2" Text="{DynamicResource String_UseCredentials}" />
51+
<mah:ToggleSwitch Grid.Column="2" Grid.Row="2" OffLabel="" OnLabel="" IsChecked="{Binding UseCredential}" />
52+
<StackPanel Grid.Column="2" Grid.Row="4" Orientation="Horizontal" Visibility="{Binding UseCredential, Converter={StaticResource BooleanToVisibilityConverter}}">
53+
<RadioButton Content="{DynamicResource String_Credentials}" />
54+
<RadioButton Content="{DynamicResource String_Custom}" IsChecked="{Binding CustomCredentials}" Margin="10,0,0,0"/>
55+
</StackPanel>
56+
</Grid>
57+
<Grid Grid.Row="1" Visibility="{Binding UseCredential, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0,10,0,0">
58+
<Grid Visibility="{Binding CustomCredentials, Converter={StaticResource BooleanToVisibilityConverter}}">
59+
<Grid.Resources>
60+
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource CenterTextBlock}" />
61+
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource DefaultTextBox}" />
62+
<Style TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource DefaultPasswordBox}" />
63+
</Grid.Resources>
64+
<Grid.ColumnDefinitions>
65+
<ColumnDefinition Width="*" />
66+
<ColumnDefinition Width="10" />
67+
<ColumnDefinition Width="*" />
68+
</Grid.ColumnDefinitions>
69+
<Grid.RowDefinitions>
70+
<RowDefinition Height="Auto" />
71+
<RowDefinition Height="10" />
72+
<RowDefinition Height="Auto" />
73+
</Grid.RowDefinitions>
74+
<TextBlock Grid.Column="0" Grid.Row="0" Text="{DynamicResource String_Username}" />
75+
<TextBox x:Name="txtUsername" Grid.Column="2" Grid.Row="0" mah:TextBoxHelper.Watermark="{DynamicResource String_Watermark_ExampleUsername}">
76+
<TextBox.Text>
77+
<Binding Path="Username" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" >
78+
<Binding.ValidationRules>
79+
<Validator:EmptyValidator ValidatesOnTargetUpdated="True" />
80+
</Binding.ValidationRules>
81+
</Binding>
82+
</TextBox.Text>
83+
</TextBox>
84+
<TextBlock Grid.Column="0" Grid.Row="2" Text="{DynamicResource String_Password}" />
85+
<PasswordBox x:Name="passwordBoxPassword" Grid.Column="2" Grid.Row="2" Style="{StaticResource DefaultPasswordBox}" >
86+
<Interactivity:Interaction.Behaviors>
87+
<WpfHelper:PasswordBoxBindingBehavior Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
88+
</Interactivity:Interaction.Behaviors>
89+
</PasswordBox>
90+
</Grid>
91+
<Grid Visibility="{Binding CustomCredentials, Converter={StaticResource BooleanReverseToVisibilityConverter}}">
92+
<Grid.Resources>
93+
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource CenterTextBlock}" />
94+
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource DefaultTextBox}" />
95+
</Grid.Resources>
96+
<Grid.ColumnDefinitions>
97+
<ColumnDefinition Width="*" />
98+
<ColumnDefinition Width="10" />
99+
<ColumnDefinition Width="*" />
100+
</Grid.ColumnDefinitions>
101+
<Grid.RowDefinitions>
102+
<RowDefinition Height="Auto" />
103+
</Grid.RowDefinitions>
104+
<TextBlock Grid.Column="0" Grid.Row="0" Text="{DynamicResource String_Credential}" />
105+
<ComboBox x:Name="cbCredentialID" Grid.Column="2" Grid.Row="0" SelectedValuePath="ID" SelectedValue="{Binding CredentialID}" Style="{StaticResource DefaultComboBox}" ItemsSource="{Binding Credentials}">
106+
<ComboBox.InputBindings>
107+
<KeyBinding Command="{Binding UnselectCredentialCommand}" Key="Delete"/>
108+
</ComboBox.InputBindings>
109+
<ComboBox.ItemTemplate>
110+
<DataTemplate>
111+
<StackPanel Orientation="Horizontal">
112+
<TextBlock>
113+
<TextBlock.Text>
114+
<MultiBinding StringFormat="{}[{0}] {1}">
115+
<Binding Path="ID" />
116+
<Binding Path="Name" />
117+
</MultiBinding>
118+
</TextBlock.Text>
119+
</TextBlock>
120+
</StackPanel>
121+
</DataTemplate>
122+
</ComboBox.ItemTemplate>
123+
</ComboBox>
124+
<!--<Rectangle Width="24" Height="24" Grid.Column="3" Grid.Row="4" ToolTip="{DynamicResource String_HelpMessage_Credentials}" Visibility="{Binding ShowUnlockCredentialsHint, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource HelpImageRectangle}" Margin="10,0,0,0">
125+
<Rectangle.Resources>
126+
<Style TargetType="{x:Type ToolTip}" BasedOn="{StaticResource HelpToolTip}" />
127+
</Rectangle.Resources>
128+
</Rectangle>-->
129+
</Grid>
39130
</Grid>
40-
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
131+
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right">
41132
<Button Content="{DynamicResource String_Button_Cancel}" Command="{Binding CancelCommand}" IsCancel="True" Style="{StaticResource DefaultButton}" />
42133
<Button Content="{DynamicResource String_Button_Connect}" Command="{Binding ConnectCommand}" IsDefault="True" Margin="10,0,0,0">
43134
<Button.Style>

0 commit comments

Comments
 (0)