2017-10-16 16:16:58 +02:00
|
|
|
<UserControl x:Name="UserControl"
|
2017-12-08 19:38:33 +01:00
|
|
|
x:Class="ModernKeePass.Views.UserControls.CompositeKeyUserControl"
|
2017-09-30 09:00:32 -04:00
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
2017-10-26 12:38:34 +02:00
|
|
|
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
|
|
|
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
2017-11-04 12:11:30 -04:00
|
|
|
xmlns:converters="using:ModernKeePass.Converters"
|
2017-11-07 18:45:35 +01:00
|
|
|
xmlns:viewModels="using:ModernKeePass.ViewModels"
|
2017-11-24 18:21:06 +01:00
|
|
|
mc:Ignorable="d" >
|
2017-10-12 17:30:29 +02:00
|
|
|
<UserControl.Resources>
|
2017-11-04 12:11:30 -04:00
|
|
|
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter"/>
|
2017-11-07 18:45:35 +01:00
|
|
|
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToForegroungBrushConverter"/>
|
2017-11-04 12:11:30 -04:00
|
|
|
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
2017-11-07 18:45:35 +01:00
|
|
|
<converters:DiscreteIntToSolidColorBrushConverter x:Key="DiscreteIntToSolidColorBrushConverter"/>
|
2017-11-24 18:21:06 +01:00
|
|
|
<converters:EmptyStringToVisibilityConverter x:Key="EmptyStringToVisibilityConverter"/>
|
2017-10-12 17:30:29 +02:00
|
|
|
</UserControl.Resources>
|
2017-11-07 18:45:35 +01:00
|
|
|
<Grid x:Name="Grid">
|
|
|
|
<!-- DataContext is not set at the root of the control because of issues happening when displaying it -->
|
|
|
|
<Grid.DataContext>
|
|
|
|
<viewModels:CompositeKeyVm />
|
|
|
|
</Grid.DataContext>
|
2017-11-03 15:48:55 +01:00
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="50" />
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.RowDefinitions>
|
2017-11-04 12:11:30 -04:00
|
|
|
<RowDefinition Height="45" />
|
2017-11-03 15:48:55 +01:00
|
|
|
<RowDefinition Height="40" />
|
2017-11-24 18:21:06 +01:00
|
|
|
<RowDefinition Height="40" />
|
2018-06-05 18:40:23 +02:00
|
|
|
<RowDefinition Height="Auto" />
|
2017-11-03 15:48:55 +01:00
|
|
|
</Grid.RowDefinitions>
|
2018-06-05 16:23:09 +02:00
|
|
|
<CheckBox Grid.Row="0" Grid.Column="0" IsChecked="{Binding HasPassword, Mode=TwoWay}" />
|
|
|
|
<PasswordBox Grid.Row="0" Grid.Column="1" x:Uid="CompositeKeyPassword" Password="{Binding Password, Mode=TwoWay}" Height="30" IsPasswordRevealButtonEnabled="True" KeyDown="PasswordBox_KeyDown" BorderBrush="{Binding StatusType, Converter={StaticResource DiscreteIntToSolidColorBrushConverter}}" >
|
2017-11-03 18:32:00 +01:00
|
|
|
<interactivity:Interaction.Behaviors>
|
2018-06-04 18:38:48 +02:00
|
|
|
<core:EventTriggerBehavior EventName="GotFocus">
|
2018-06-05 16:23:09 +02:00
|
|
|
<core:ChangePropertyAction TargetObject="{Binding}" PropertyName="HasPassword" Value="True" />
|
2018-06-04 18:38:48 +02:00
|
|
|
</core:EventTriggerBehavior>
|
2017-11-03 18:32:00 +01:00
|
|
|
</interactivity:Interaction.Behaviors>
|
|
|
|
</PasswordBox>
|
2017-11-07 18:45:35 +01:00
|
|
|
<ProgressBar Grid.Row="0" Grid.Column="1"
|
|
|
|
Maximum="128" VerticalAlignment="Bottom"
|
|
|
|
Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}"
|
|
|
|
Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroungBrushConverter}}"
|
|
|
|
Visibility="{Binding ShowComplexityIndicator, ElementName=UserControl, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
|
|
|
<CheckBox Grid.Row="1" Grid.Column="0" IsChecked="{Binding HasKeyFile, Mode=TwoWay}" />
|
2017-11-13 11:28:14 +01:00
|
|
|
<HyperlinkButton Grid.Row="1" Grid.Column="1" Margin="-15,0,0,0" Content="{Binding KeyFileText}" IsEnabled="{Binding HasKeyFile}" Click="KeyFileButton_Click" />
|
2017-11-23 19:02:49 +01:00
|
|
|
<HyperlinkButton Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Visibility="{Binding ShowComplexityIndicator, ElementName=UserControl, Converter={StaticResource BooleanToVisibilityConverter}}" IsEnabled="{Binding HasKeyFile}" Click="CreateKeyFileButton_Click">
|
2017-11-24 18:21:06 +01:00
|
|
|
<SymbolIcon Symbol="Add">
|
|
|
|
<ToolTipService.ToolTip>
|
2017-11-28 18:53:10 +01:00
|
|
|
<ToolTip x:Uid="CompositeKeyNewKeyFileTooltip" />
|
2017-11-24 18:21:06 +01:00
|
|
|
</ToolTipService.ToolTip>
|
|
|
|
</SymbolIcon>
|
2017-11-23 19:02:49 +01:00
|
|
|
</HyperlinkButton>
|
2017-12-26 17:54:13 +01:00
|
|
|
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2" Content="{Binding ButtonLabel, ElementName=UserControl}" Click="OpenButton_OnClick" Background="{ThemeResource ListViewItemSelectedPointerOverBorderThemeBrush}" Foreground="{ThemeResource TextBoxBackgroundThemeBrush}" IsEnabled="{Binding IsValid}" />
|
2018-06-05 18:40:23 +02:00
|
|
|
<TextBlock Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="3" Height="Auto" FontSize="14" FontWeight="Light" Text="{Binding Status}" Foreground="{Binding StatusType, Converter={StaticResource DiscreteIntToSolidColorBrushConverter}}" Visibility="{Binding Status, Converter={StaticResource EmptyStringToVisibilityConverter}}" />
|
2017-11-03 15:48:55 +01:00
|
|
|
</Grid>
|
2017-09-30 09:00:32 -04:00
|
|
|
</UserControl>
|