Better Entry URL go to button

Migrated code from code behind pages to view models
Auto select Recents if there are any recent items
WIP auto focus on password box when opening database
This commit is contained in:
2017-10-09 18:40:02 +02:00
committed by BONNEVILLE Geoffroy
parent f2794f8055
commit 98ecb0b8a1
15 changed files with 134 additions and 71 deletions

View File

@@ -7,14 +7,14 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="65"
d:DesignWidth="400">
d:DesignWidth="335" Loaded="UserControl_Loaded">
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Margin="0,-1,0,-1" >
<PasswordBox x:Name="PasswordBox" Width="300" IsPasswordRevealButtonEnabled="True" KeyDown="PasswordBox_KeyDown" PlaceholderText="Password"/>
<Button Click="OpenButton_OnClick" Width="auto">
<Button Click="OpenButton_OnClick" Width="auto" Padding="2,0">
<SymbolIcon Symbol="Forward" />
</Button>
</StackPanel>
<TextBlock x:Name="StatusTextBlock" Height="auto" Width="auto" Foreground="#FF9E1B1B" FontSize="16" />
<TextBlock x:Name="StatusTextBlock" Height="32" Width="auto" Foreground="#FFBF6969" FontSize="16" FontWeight="Bold" />
</StackPanel>
</UserControl>

View File

@@ -1,5 +1,7 @@
using System;
using System.Threading.Tasks;
using Windows.System;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
@@ -13,11 +15,10 @@ namespace ModernKeePass.Controls
public OpenDatabaseUserControl()
{
InitializeComponent();
PasswordBox.Focus(FocusState.Programmatic);
}
public delegate void PasswordCheckedEventHandler(object sender, EventArgs e);
public event PasswordCheckedEventHandler ValidationChecked;
public delegate void PasswordCheckedEventHandler(object sender, EventArgs e);
private void OpenButton_OnClick(object sender, RoutedEventArgs e)
{
@@ -30,5 +31,12 @@ namespace ModernKeePass.Controls
{
if (e.Key == VirtualKey.Enter) OpenButton_OnClick(null, null);
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
Task.Factory.StartNew(
() => Dispatcher.RunAsync(CoreDispatcherPriority.Low,
() => PasswordBox.Focus(FocusState.Programmatic)));
}
}
}