Files
modernkeepass/Win10App/Views/EntryPage.xaml

169 lines
10 KiB
Plaintext
Raw Permalink Normal View History

<Page
x:Class="ModernKeePass.Views.EntryPage"
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:userControls="using:ModernKeePass.Views.UserControls"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:actions="using:ModernKeePass.Actions"
xmlns:converters="using:ModernKeePass.Converters"
xmlns:listItems="using:ModernKeePass.ViewModels.ListItems"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter" />
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToForegroungBrushComplexityConverter" />
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter" />
<converters:IconToSymbolConverter x:Key="IntToSymbolConverter" />
</Page.Resources>
<Grid>
<Pivot>
<Pivot.TitleTemplate>
<DataTemplate x:DataType="listItems:EntryItemVm">
<Grid>
<TextBlock Text="{x:Bind Name}" Style="{ThemeResource HeaderTextBlockStyle}" />
</Grid>
</DataTemplate>
</Pivot.TitleTemplate>
<PivotItem Header="Main" Margin="0">
<Grid Background="White">
<RelativePanel>
<StackPanel Margin="20">
<StackPanel.Resources>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="0,20,0,0"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<Style TargetType="CheckBox">
<Setter Property="Margin" Value="0,20,0,0"/>
<Setter Property="FontSize" Value="18"/>
</Style>
<Style TargetType="TextBox" x:Key="EntryTextBoxWithButtonStyle">
<Setter Property="Width" Value="350"/>
<Setter Property="Height" Value="32"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
</StackPanel.Resources>
<TextBlock x:Uid="EntryLogin" />
<TextBox
Text="{x:Bind Vm.UserName, Mode=TwoWay}"
Style="{StaticResource EntryTextBoxWithButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ButtonClick">
<actions:ClipboardAction Text="{x:Bind Vm.UserName}" />
<actions:ToastAction x:Uid="ToastCopyLogin" Title="{x:Bind Vm.Name}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</TextBox>
<TextBlock x:Uid="EntryPassword" />
<PasswordBox x:Name="Password"
HorizontalAlignment="Left"
Password="{x:Bind Vm.Password, Mode=TwoWay}"
Width="350"
Height="32"
PasswordRevealMode="Hidden">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ButtonClick">
<actions:ClipboardAction Text="{x:Bind Vm.Password}" />
<actions:ToastAction x:Uid="ToastCopyPassword" Title="{x:Bind Vm.Name}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</PasswordBox>
<ProgressBar
Maximum="128"
Width="350"
HorizontalAlignment="Left"
Value="{x:Bind Vm.PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}, Mode=OneWay}"
Foreground="{x:Bind Vm.PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroungBrushComplexityConverter}, Mode=OneWay}" />
<CheckBox
x:Uid="EntryShowPassword"
HorizontalAlignment="Left"
Margin="0">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Checked">
<core:ChangePropertyAction TargetObject="{Binding ElementName=Password}" PropertyName="PasswordRevealMode" Value="Visible" />
</core:EventTriggerBehavior>
<core:EventTriggerBehavior EventName="Unchecked">
<core:ChangePropertyAction TargetObject="{Binding ElementName=Password}" PropertyName="PasswordRevealMode" Value="Hidden" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</CheckBox>
<TextBlock TextWrapping="Wrap" Text="URL" FontSize="18"/>
<TextBox
Text="{x:Bind Vm.Url, Mode=TwoWay}"
MaxLength="256"
Style="{StaticResource EntryTextBoxWithButtonStyle}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ButtonClick">
<actions:NavigateToUrlAction Url="{x:Bind Vm.Url}" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</TextBox>
<TextBlock x:Uid="EntryNotes" />
<TextBox
HorizontalAlignment="Left"
TextWrapping="Wrap"
Text="{x:Bind Vm.Notes, Mode=TwoWay}"
Width="350"
Height="200"
AcceptsReturn="True"
IsSpellCheckEnabled="True" />
<CheckBox
x:Uid="EntryExpirationDate"
IsChecked="{x:Bind Vm.HasExpirationDate, Mode=TwoWay}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<SymbolIcon
Grid.Column="0"
Symbol="Important"
Foreground="DarkRed"
Visibility="{x:Bind Vm.HasExpired}">
<ToolTipService.ToolTip>
<ToolTip x:Uid="EntryExpirationTooltip" />
</ToolTipService.ToolTip>
</SymbolIcon>
<StackPanel
Grid.Column="1"
x:Name="ExpirationDatePanel"
Visibility="{x:Bind Vm.HasExpirationDate, Mode=OneWay}">
<DatePicker
Date="{x:Bind Vm.ExpiryDate, Mode=TwoWay}"
Style="{StaticResource MainColorDatePicker}" />
<TimePicker
Margin="0,10,0,0"
Time="{x:Bind Vm.ExpiryTime, Mode=TwoWay}"
Style="{StaticResource MainColorTimePicker}" />
</StackPanel>
</Grid>
</StackPanel>
</RelativePanel>
</Grid>
</PivotItem>
<PivotItem Header="Additional">
<StackPanel Orientation="Vertical">
<TextBlock x:Uid="EntryIcon" />
<userControls:SymbolPickerUserControl
SelectedSymbol="{x:Bind Vm.Icon, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=0, Mode=TwoWay}" />
<TextBlock x:Uid="EntryBackgroundColor" />
<userControls:ColorPickerUserControl
HorizontalAlignment="Left"
SelectedColor="{x:Bind Vm.BackgroundColor, Converter={StaticResource ColorToBrushConverter}, Mode=TwoWay}" />
<TextBlock x:Uid="EntryForegroundColor" />
<userControls:ColorPickerUserControl
SelectedColor="{x:Bind Vm.ForegroundColor, Converter={StaticResource ColorToBrushConverter}, Mode=TwoWay}" />
</StackPanel>
</PivotItem>
<PivotItem Header="History" />
</Pivot>
</Grid>
</Page>