mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
WIP ViewModelLocator - Messenger and Recent issues
Refactoring Code cleanup
This commit is contained in:
@@ -7,14 +7,12 @@
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:converters="using:ModernKeePass.Converters"
|
||||
xmlns:viewModels="using:ModernKeePass.ViewModels"
|
||||
mc:Ignorable="d" >
|
||||
<UserControl.Resources>
|
||||
<converters:DiscreteIntToSolidColorBrushConverter x:Key="DiscreteIntToSolidColorBrushConverter"/>
|
||||
<converters:EmptyStringToVisibilityConverter x:Key="EmptyStringToVisibilityConverter"/>
|
||||
<viewModels:OpenDatabaseControlVm x:Key="ViewModel"/>
|
||||
</UserControl.Resources>
|
||||
<Grid DataContext="{StaticResource ViewModel}">
|
||||
<Grid x:Name="Grid" DataContext="{Binding Source={StaticResource Locator}, Path=OpenDatabaseControl}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50" />
|
||||
<ColumnDefinition Width="*" />
|
||||
|
@@ -12,7 +12,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
{
|
||||
public sealed partial class OpenDatabaseUserControl
|
||||
{
|
||||
private OpenDatabaseControlVm Model => (OpenDatabaseControlVm)Resources["ViewModel"];
|
||||
private OpenDatabaseControlVm Model => (OpenDatabaseControlVm)Grid.DataContext;
|
||||
|
||||
public string DatabaseFilePath
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
var file = await picker.PickSingleFileAsync();
|
||||
if (file == null) return;
|
||||
|
||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
|
||||
Model.KeyFilePath = token;
|
||||
Model.KeyFileText = file.DisplayName;
|
||||
}
|
||||
|
@@ -7,16 +7,14 @@
|
||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:converters="using:ModernKeePass.Converters"
|
||||
xmlns:viewModels="using:ModernKeePass.ViewModels"
|
||||
mc:Ignorable="d" >
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter"/>
|
||||
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToSolidColorBrushConverter"/>
|
||||
<converters:DiscreteIntToSolidColorBrushConverter x:Key="DiscreteIntToSolidColorBrushConverter"/>
|
||||
<converters:EmptyStringToVisibilityConverter x:Key="EmptyStringToVisibilityConverter"/>
|
||||
<viewModels:SetCredentialsVm x:Key="ViewModel"/>
|
||||
</UserControl.Resources>
|
||||
<Grid DataContext="{StaticResource ViewModel}">
|
||||
<Grid x:Name="Grid" DataContext="{Binding Source={StaticResource Locator}, Path=SetCredentials}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50" />
|
||||
<ColumnDefinition Width="*" />
|
||||
|
@@ -11,7 +11,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
{
|
||||
public sealed partial class SetCredentialsUserControl
|
||||
{
|
||||
private SetCredentialsVm Model => (SetCredentialsVm)Resources["ViewModel"];
|
||||
private SetCredentialsVm Model => (SetCredentialsVm)Grid.DataContext;
|
||||
|
||||
public string ButtonLabel
|
||||
{
|
||||
@@ -44,7 +44,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
var file = await picker.PickSingleFileAsync();
|
||||
if (file == null) return;
|
||||
|
||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
|
||||
Model.KeyFilePath = token;
|
||||
Model.KeyFileText = file.DisplayName;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace ModernKeePass.Views.UserControls
|
||||
var file = await savePicker.PickSaveFileAsync();
|
||||
if (file == null) return;
|
||||
|
||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
|
||||
var token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
|
||||
Model.KeyFilePath = token;
|
||||
Model.KeyFileText = file.DisplayName;
|
||||
await Model.GenerateKeyFile();
|
||||
|
Reference in New Issue
Block a user