mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
OpenDatabaseUserControl works
This commit is contained in:
@@ -221,9 +221,12 @@ namespace ModernKeePass
|
|||||||
{
|
{
|
||||||
ToastNotificationHelper.ShowErrorToast(exception);
|
ToastNotificationHelper.ShowErrorToast(exception);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
await SuspensionManager.SaveAsync().ConfigureAwait(false);
|
await SuspensionManager.SaveAsync().ConfigureAwait(false);
|
||||||
deferral.Complete();
|
deferral.Complete();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when application is launched from opening a file in Windows Explorer
|
/// Invoked when application is launched from opening a file in Windows Explorer
|
||||||
|
@@ -165,7 +165,7 @@
|
|||||||
<data name="CompositeKeyNewKeyFileTooltip.Content" xml:space="preserve">
|
<data name="CompositeKeyNewKeyFileTooltip.Content" xml:space="preserve">
|
||||||
<value>Create new key file</value>
|
<value>Create new key file</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CompositeKeyOpenButton.ButtonLabel" xml:space="preserve">
|
<data name="OpenDatabaseControlButton.Content" xml:space="preserve">
|
||||||
<value>Open</value>
|
<value>Open</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CompositeKeyPassword.PlaceholderText" xml:space="preserve">
|
<data name="CompositeKeyPassword.PlaceholderText" xml:space="preserve">
|
||||||
|
@@ -165,7 +165,7 @@
|
|||||||
<data name="CompositeKeyNewKeyFileTooltip.Content" xml:space="preserve">
|
<data name="CompositeKeyNewKeyFileTooltip.Content" xml:space="preserve">
|
||||||
<value>Créer un nouveau fichier de clé</value>
|
<value>Créer un nouveau fichier de clé</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CompositeKeyOpenButton.ButtonLabel" xml:space="preserve">
|
<data name="OpenDatabaseControlButton.Content" xml:space="preserve">
|
||||||
<value>Ouvrir</value>
|
<value>Ouvrir</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CompositeKeyPassword.PlaceholderText" xml:space="preserve">
|
<data name="CompositeKeyPassword.PlaceholderText" xml:space="preserve">
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
<Border HorizontalAlignment="Left" BorderThickness="1" BorderBrush="AliceBlue" Width="550" Visibility="{Binding IsFileSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
|
<Border HorizontalAlignment="Left" BorderThickness="1" BorderBrush="AliceBlue" Width="550" Visibility="{Binding IsFileSelected, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
<StackPanel Margin="25,0,25,0">
|
<StackPanel Margin="25,0,25,0">
|
||||||
<TextBlock Text="{Binding Name}" />
|
<TextBlock Text="{Binding Name}" />
|
||||||
<userControls:OpenDatabaseUserControl x:Uid="CompositeKeyOpenButton" DatabaseFilePath="{Binding Token}">
|
<userControls:OpenDatabaseUserControl DatabaseFilePath="{Binding Token}">
|
||||||
<interactivity:Interaction.Behaviors>
|
<interactivity:Interaction.Behaviors>
|
||||||
<core:EventTriggerBehavior EventName="DatabaseOpened">
|
<core:EventTriggerBehavior EventName="DatabaseOpened">
|
||||||
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
<core:NavigateToPageAction TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Row="0" Text="{Binding Name}" Padding="5,0,0,0" />
|
<TextBlock Grid.Row="0" Text="{Binding Name}" Padding="5,0,0,0" />
|
||||||
<TextBlock Grid.Row="1" Text="{Binding Path}" Padding="5,0,0,0" FontSize="10" />
|
<TextBlock Grid.Row="1" Text="{Binding Path}" Padding="5,0,0,0" FontSize="10" />
|
||||||
<userControls:OpenDatabaseUserControl Grid.Row="2" x:Uid="CompositeKeyOpenButton" HorizontalAlignment="Stretch" MinWidth="400" Margin="0,10,0,0" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}" DatabaseFilePath="{Binding Token}">
|
<userControls:OpenDatabaseUserControl Grid.Row="2" HorizontalAlignment="Stretch" MinWidth="400" Margin="0,10,0,0" Visibility="{Binding IsSelected, Converter={StaticResource BooleanToVisibilityConverter}}" DatabaseFilePath="{Binding Token}">
|
||||||
<interactivity:Interaction.Behaviors>
|
<interactivity:Interaction.Behaviors>
|
||||||
<core:EventTriggerBehavior EventName="DatabaseOpening">
|
<core:EventTriggerBehavior EventName="DatabaseOpening">
|
||||||
<core:CallMethodAction TargetObject="{Binding}" MethodName="UpdateAccessTime" />
|
<core:CallMethodAction TargetObject="{Binding}" MethodName="UpdateAccessTime" />
|
||||||
|
@@ -38,18 +38,19 @@
|
|||||||
</PasswordBox>
|
</PasswordBox>
|
||||||
<CheckBox Grid.Row="1" Grid.Column="0" IsChecked="{Binding HasKeyFile, Mode=TwoWay}" />
|
<CheckBox Grid.Row="1" Grid.Column="0" IsChecked="{Binding HasKeyFile, Mode=TwoWay}" />
|
||||||
<HyperlinkButton Grid.Row="1" Grid.Column="1" Margin="-15,0,0,0"
|
<HyperlinkButton Grid.Row="1" Grid.Column="1" Margin="-15,0,0,0"
|
||||||
Content="{Binding KeyFileText, Mode=OneWay}"
|
Content="{Binding KeyFileText}"
|
||||||
IsEnabled="{Binding HasKeyFile, Mode=OneWay}"
|
IsEnabled="{Binding HasKeyFile}"
|
||||||
Click="KeyFileButton_Click"
|
Click="KeyFileButton_Click"
|
||||||
Style="{StaticResource MainColorHyperlinkButton}" />
|
Style="{StaticResource MainColorHyperlinkButton}" />
|
||||||
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2"
|
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2"
|
||||||
Content="{Binding ButtonLabel, ElementName=UserControl}"
|
x:Name="OpenButton"
|
||||||
|
x:Uid="OpenDatabaseControlButton"
|
||||||
Click="OpenButton_OnClick"
|
Click="OpenButton_OnClick"
|
||||||
IsEnabled="{Binding IsValid}"
|
IsEnabled="{Binding IsValid}"
|
||||||
Style="{StaticResource MainColorButton}" />
|
Style="{StaticResource MainColorButton}" />
|
||||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="3" Height="Auto" FontSize="14" FontWeight="Light"
|
<TextBlock Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="3" Height="Auto" FontSize="14" FontWeight="Light"
|
||||||
Text="{Binding Status, Mode=OneWay}"
|
Text="{Binding Status}"
|
||||||
Foreground="{Binding StatusType, Mode=OneWay, Converter={StaticResource DiscreteIntToSolidColorBrushConverter}}"
|
Foreground="{Binding StatusType, Converter={StaticResource DiscreteIntToSolidColorBrushConverter}}"
|
||||||
Visibility="{Binding Status, Mode=OneWay, Converter={StaticResource EmptyStringToVisibilityConverter}}" />
|
Visibility="{Binding Status, Converter={StaticResource EmptyStringToVisibilityConverter}}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@@ -26,18 +26,6 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
private readonly IResourceProxy _resource;
|
private readonly IResourceProxy _resource;
|
||||||
public OpenDatabaseControlVm Model => Grid.DataContext as OpenDatabaseControlVm;
|
public OpenDatabaseControlVm Model => Grid.DataContext as OpenDatabaseControlVm;
|
||||||
|
|
||||||
public string ButtonLabel
|
|
||||||
{
|
|
||||||
get { return (string)GetValue(ButtonLabelProperty); }
|
|
||||||
set { SetValue(ButtonLabelProperty, value); }
|
|
||||||
}
|
|
||||||
public static readonly DependencyProperty ButtonLabelProperty =
|
|
||||||
DependencyProperty.Register(
|
|
||||||
nameof(ButtonLabel),
|
|
||||||
typeof(string),
|
|
||||||
typeof(OpenDatabaseUserControl),
|
|
||||||
new PropertyMetadata("OK", (o, args) => { }));
|
|
||||||
|
|
||||||
public string DatabaseFilePath
|
public string DatabaseFilePath
|
||||||
{
|
{
|
||||||
get { return (string)GetValue(DatabaseFilePathProperty); }
|
get { return (string)GetValue(DatabaseFilePathProperty); }
|
||||||
@@ -121,14 +109,14 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
|
|
||||||
private async Task OpenDatabase()
|
private async Task OpenDatabase()
|
||||||
{
|
{
|
||||||
var oldLabel = ButtonLabel;
|
var oldLabel = OpenButton.Content;
|
||||||
ButtonLabel = _resource.GetResourceValue("CompositeKeyOpening");
|
OpenButton.Content = _resource.GetResourceValue("CompositeKeyOpening");
|
||||||
if (await Dispatcher.RunTaskAsync(async () => await Model.OpenDatabase(DatabaseFilePath)))
|
if (await Dispatcher.RunTaskAsync(async () => await Model.OpenDatabase(DatabaseFilePath)))
|
||||||
{
|
{
|
||||||
DatabaseOpened?.Invoke(this, new PasswordEventArgs(Model.RootGroupId));
|
DatabaseOpened?.Invoke(this, new PasswordEventArgs(Model.RootGroupId));
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonLabel = oldLabel;
|
OpenButton.Content = oldLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,19 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
public sealed partial class UpdateCredentialsUserControl
|
public sealed partial class UpdateCredentialsUserControl
|
||||||
{
|
{
|
||||||
public UpdateCredentialsViewModel ViewModel => Grid.DataContext as UpdateCredentialsViewModel;
|
public UpdateCredentialsViewModel ViewModel => Grid.DataContext as UpdateCredentialsViewModel;
|
||||||
|
|
||||||
|
public string ButtonLabel
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(ButtonLabelProperty); }
|
||||||
|
set { SetValue(ButtonLabelProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty ButtonLabelProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
nameof(ButtonLabel),
|
||||||
|
typeof(string),
|
||||||
|
typeof(UpdateCredentialsUserControl),
|
||||||
|
new PropertyMetadata("OK", (o, args) => { }));
|
||||||
|
|
||||||
public string DatabaseFilePath
|
public string DatabaseFilePath
|
||||||
{
|
{
|
||||||
get { return (string) GetValue(DatabaseFilePathProperty); }
|
get { return (string) GetValue(DatabaseFilePathProperty); }
|
||||||
|
Reference in New Issue
Block a user