2020-04-21 17:13:39 +02:00
|
|
|
<UserControl x:Name="UserControl"
|
2020-04-21 11:26:02 +02:00
|
|
|
x:Class="ModernKeePass.Views.UserControls.OpenDatabaseUserControl"
|
|
|
|
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"
|
|
|
|
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
|
|
|
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
|
|
|
xmlns:converters="using:ModernKeePass.Converters"
|
|
|
|
mc:Ignorable="d" >
|
2020-04-20 20:02:43 +02:00
|
|
|
<UserControl.Resources>
|
|
|
|
<converters:EmptyStringToVisibilityConverter x:Key="EmptyStringToVisibilityConverter"/>
|
2020-04-30 11:10:10 +02:00
|
|
|
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
|
|
|
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
|
2020-04-20 20:02:43 +02:00
|
|
|
</UserControl.Resources>
|
2020-04-23 19:00:38 +02:00
|
|
|
<Grid x:Name="Grid" DataContext="{Binding Source={StaticResource Locator}, Path=OpenDatabaseControl}">
|
2020-04-30 11:10:10 +02:00
|
|
|
<Grid.Resources>
|
|
|
|
<SolidColorBrush x:Key="ErrorBrush" Color="Red" />
|
|
|
|
</Grid.Resources>
|
2020-04-20 20:02:43 +02:00
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="50" />
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="45" />
|
|
|
|
<RowDefinition Height="40" />
|
|
|
|
<RowDefinition Height="40" />
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
<CheckBox Grid.Row="0" Grid.Column="0" IsChecked="{Binding HasPassword, Mode=TwoWay}" />
|
2020-04-30 11:10:10 +02:00
|
|
|
<PasswordBox x:Name="PasswordBox" Grid.Row="0" Grid.Column="1" x:Uid="CompositeKeyPassword" Password="{Binding Password, Mode=TwoWay}" Height="30" IsPasswordRevealButtonEnabled="True" KeyDown="PasswordBox_KeyDown" >
|
2020-04-20 20:02:43 +02:00
|
|
|
<interactivity:Interaction.Behaviors>
|
|
|
|
<core:EventTriggerBehavior EventName="GotFocus">
|
|
|
|
<core:ChangePropertyAction TargetObject="{Binding}" PropertyName="HasPassword" Value="True" />
|
|
|
|
</core:EventTriggerBehavior>
|
|
|
|
</interactivity:Interaction.Behaviors>
|
|
|
|
</PasswordBox>
|
|
|
|
<CheckBox Grid.Row="1" Grid.Column="0" IsChecked="{Binding HasKeyFile, Mode=TwoWay}" />
|
|
|
|
<HyperlinkButton Grid.Row="1" Grid.Column="1" Margin="-15,0,0,0"
|
2020-04-30 11:10:10 +02:00
|
|
|
x:Name="HyperlinkButton"
|
2020-04-21 11:26:02 +02:00
|
|
|
Content="{Binding KeyFileText}"
|
|
|
|
IsEnabled="{Binding HasKeyFile}"
|
2020-04-29 16:39:20 +02:00
|
|
|
Click="KeyFileButton_Click" />
|
2020-04-20 20:02:43 +02:00
|
|
|
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2"
|
2020-04-30 11:10:10 +02:00
|
|
|
x:Uid="OpenDatabaseControlButton"
|
|
|
|
Visibility="{Binding IsOpening, Converter={StaticResource InverseBooleanToVisibilityConverter}}"
|
2020-04-21 17:13:39 +02:00
|
|
|
Command="{Binding OpenDatabaseCommand}"
|
2020-04-29 16:39:20 +02:00
|
|
|
CommandParameter="{Binding DatabaseFilePath, ElementName=UserControl}" />
|
2020-04-30 11:10:10 +02:00
|
|
|
<ProgressRing Grid.Column="0" Grid.Row="2" IsActive="{Binding IsOpening}" Visibility="{Binding IsOpening, Converter={StaticResource BooleanToVisibilityConverter}}" Foreground="{StaticResource MainColorBrush}" />
|
2020-04-20 20:02:43 +02:00
|
|
|
<TextBlock Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="3" Height="Auto" FontSize="14" FontWeight="Light"
|
2020-04-21 11:26:02 +02:00
|
|
|
Text="{Binding Status}"
|
2020-04-30 11:10:10 +02:00
|
|
|
Foreground="Red"
|
2020-04-21 11:26:02 +02:00
|
|
|
Visibility="{Binding Status, Converter={StaticResource EmptyStringToVisibilityConverter}}" />
|
2020-04-30 11:10:10 +02:00
|
|
|
|
|
|
|
<VisualStateManager.VisualStateGroups>
|
|
|
|
<VisualStateGroup x:Name="CredentialStatus">
|
|
|
|
<VisualState x:Name="Error">
|
|
|
|
<Storyboard>
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PasswordBox" Storyboard.TargetProperty="BorderBrush">
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ErrorBrush}"/>
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HyperlinkButton" Storyboard.TargetProperty="Foreground">
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ErrorBrush}"/>
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
</Storyboard>
|
|
|
|
</VisualState>
|
|
|
|
<VisualState x:Name="Initial">
|
|
|
|
<Storyboard>
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PasswordBox" Storyboard.TargetProperty="BorderBrush">
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxBorderThemeBrush}"/>
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HyperlinkButton" Storyboard.TargetProperty="Foreground">
|
|
|
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource HyperlinkForegroundThemeBrush}"/>
|
|
|
|
</ObjectAnimationUsingKeyFrames>
|
|
|
|
</Storyboard>
|
|
|
|
</VisualState>
|
|
|
|
</VisualStateGroup>
|
|
|
|
</VisualStateManager.VisualStateGroups>
|
|
|
|
<interactivity:Interaction.Behaviors>
|
|
|
|
<core:DataTriggerBehavior Binding="{Binding IsError}" Value="True">
|
|
|
|
<core:GoToStateAction StateName="Error"/>
|
|
|
|
</core:DataTriggerBehavior>
|
|
|
|
<core:DataTriggerBehavior Binding="{Binding IsError}" Value="False">
|
|
|
|
<core:GoToStateAction StateName="Initial"/>
|
|
|
|
</core:DataTriggerBehavior>
|
|
|
|
</interactivity:Interaction.Behaviors>
|
2020-04-20 20:02:43 +02:00
|
|
|
</Grid>
|
|
|
|
</UserControl>
|