Add MVVM Light library

Updated nuget packages
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-21 13:07:17 +02:00
parent 75f6e2f840
commit a1085b6010
16 changed files with 204 additions and 66 deletions

View File

@@ -1,18 +1,21 @@
<Application
x:Class="ModernKeePass.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
RequestedTheme="Light">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ResourceDictionaries/TextBoxWithButtonStyle.xaml" />
<ResourceDictionary Source="ResourceDictionaries/HamburgerButtonStyle.xaml" />
<ResourceDictionary Source="ResourceDictionaries/ListViewLeftIndicatorStyle.xaml" />
<ResourceDictionary Source="ResourceDictionaries/NoBorderButtonStyle.xaml" />
<ResourceDictionary Source="ResourceDictionaries/NoBorderToggleButtonStyle.xaml" />
<ResourceDictionary Source="ResourceDictionaries/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
<Application x:Class="ModernKeePass.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" RequestedTheme="Light" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ResourceDictionaries/TextBoxWithButtonStyle.xaml">
</ResourceDictionary>
</Application.Resources>
</Application>
<ResourceDictionary Source="ResourceDictionaries/HamburgerButtonStyle.xaml">
</ResourceDictionary>
<ResourceDictionary Source="ResourceDictionaries/ListViewLeftIndicatorStyle.xaml">
</ResourceDictionary>
<ResourceDictionary Source="ResourceDictionaries/NoBorderButtonStyle.xaml">
</ResourceDictionary>
<ResourceDictionary Source="ResourceDictionaries/NoBorderToggleButtonStyle.xaml">
</ResourceDictionary>
<ResourceDictionary Source="ResourceDictionaries/Styles.xaml">
<!--<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="using:ModernKeePass.ViewModel" />-->
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -10,6 +10,7 @@ using Windows.Storage.Pickers;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using GalaSoft.MvvmLight.Views;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.HockeyApp;
@@ -37,6 +38,7 @@ namespace ModernKeePass
private readonly IResourceProxy _resource;
private readonly IMediator _mediator;
private readonly ISettingsProxy _settings;
private readonly INavigationService _navigation;
public static IServiceProvider Services { get; private set; }
@@ -62,12 +64,13 @@ namespace ModernKeePass
serviceCollection.AddInfrastructureCommon();
serviceCollection.AddInfrastructureKeePass();
serviceCollection.AddInfrastructureUwp();
serviceCollection.AddAppAutomapper();
serviceCollection.AddWin81App();
Services = serviceCollection.BuildServiceProvider();
_mediator = Services.GetService<IMediator>();
_resource = Services.GetService<IResourceProxy>();
_settings = Services.GetService<ISettingsProxy>();
_navigation = Services.GetService<INavigationService>();
}
#region Event Handlers
@@ -157,7 +160,8 @@ namespace ModernKeePass
var launchActivatedEventArgs = e as LaunchActivatedEventArgs;
if (launchActivatedEventArgs != null && rootFrame.Content == null)
rootFrame.Navigate(typeof(MainPage), launchActivatedEventArgs.Arguments);
//rootFrame.Navigate(typeof(MainPage), launchActivatedEventArgs.Arguments);
_navigation.NavigateTo(Constants.Navigation.MainPage, launchActivatedEventArgs.Arguments);
// Ensure the current window is active
Window.Current.Activate();
@@ -247,11 +251,13 @@ namespace ModernKeePass
Name = file.DisplayName,
Path = file.Path
};
rootFrame.Navigate(typeof(MainPage), fileInfo);
//rootFrame.Navigate(typeof(MainPage), fileInfo);
_navigation.NavigateTo(Constants.Navigation.MainPage, fileInfo);
}
else
{
rootFrame.Navigate(typeof(MainPage));
//rootFrame.Navigate(typeof(MainPage));
_navigation.NavigateTo(Constants.Navigation.MainPage);
}
Window.Current.Content = rootFrame;

View File

@@ -1,17 +1,29 @@
using System.Reflection;
using AutoMapper;
using GalaSoft.MvvmLight.Views;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Common;
using ModernKeePass.Views;
namespace ModernKeePass
{
public static class DependencyInjection
{
public static IServiceCollection AddAppAutomapper(this IServiceCollection services)
public static IServiceCollection AddWin81App(this IServiceCollection services)
{
var applicationAssembly = typeof(Application.DependencyInjection).GetTypeInfo().Assembly;
var infrastructureAssembly = typeof(Infrastructure.DependencyInjection).GetTypeInfo().Assembly;
services.AddAutoMapper(applicationAssembly, infrastructureAssembly);
services.AddSingleton<INavigationService>(provider =>
{
var nav = new NavigationService();
nav.Configure(Constants.Navigation.MainPage, typeof(MainPage));
nav.Configure(Constants.Navigation.EntryPage, typeof(EntryDetailPage));
nav.Configure(Constants.Navigation.GroupPage, typeof(GroupDetailPage));
return nav;
});
return services;
}
}

View File

@@ -0,0 +1,34 @@
using GalaSoft.MvvmLight;
namespace ModernKeePass.ViewModel
{
/// <summary>
/// This class contains properties that the main View can data bind to.
/// <para>
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// You can also use Blend to data bind with the tool's support.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase
{
/// <summary>
/// Initializes a new instance of the MainViewModel class.
/// </summary>
public MainViewModel()
{
////if (IsInDesignMode)
////{
//// // Code runs in Blend --> create design time data.
////}
////else
////{
//// // Code runs "for real"
////}
}
}
}

View File

@@ -0,0 +1,55 @@
/*
In App.xaml:
<Application.Resources>
<vm:ViewModelLocator xmlns:vm="clr-namespace:ModernKeePass"
x:Key="Locator" />
</Application.Resources>
In the View:
DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}"
You can also use Blend to do all this with the tool's support.
See http://www.galasoft.ch/mvvm
*/
using CommonServiceLocator;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
namespace ModernKeePass.ViewModel
{
/// <summary>
/// This class contains static references to all the view models in the
/// application and provides an entry point for the bindings.
/// </summary>
public class ViewModelLocator
{
/// <summary>
/// Initializes a new instance of the ViewModelLocator class.
/// </summary>
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
////if (ViewModelBase.IsInDesignModeStatic)
////{
//// // Create design time view services and models
//// SimpleIoc.Default.Register<IDataService, DesignDataService>();
////}
////else
////{
//// // Create run time view services and models
//// SimpleIoc.Default.Register<IDataService, DataService>();
////}
SimpleIoc.Default.Register<MainViewModel>();
}
public MainViewModel Main => ServiceLocator.Current.GetInstance<MainViewModel>();
public static void Cleanup()
{
// TODO Clear the ViewModels
}
}
}

View File

@@ -5,6 +5,7 @@ using System.Linq;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using GalaSoft.MvvmLight.Command;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Database.Commands.SaveDatabase;
@@ -22,7 +23,6 @@ using ModernKeePass.Application.Group.Commands.RemoveEntry;
using ModernKeePass.Application.Group.Queries.GetGroup;
using ModernKeePass.Application.Security.Commands.GeneratePassword;
using ModernKeePass.Application.Security.Queries.EstimatePasswordComplexity;
using ModernKeePass.Common;
using ModernKeePass.Domain.Enums;
using ModernKeePass.Interfaces;
using ModernKeePass.Application.Group.Models;

View File

@@ -5,6 +5,7 @@ using System.Collections.Specialized;
using System.Linq;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;
using GalaSoft.MvvmLight.Command;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Database.Commands.SaveDatabase;
@@ -24,7 +25,6 @@ using ModernKeePass.Application.Group.Commands.UpdateGroup;
using ModernKeePass.Application.Group.Models;
using ModernKeePass.Application.Group.Queries.GetGroup;
using ModernKeePass.Application.Group.Queries.SearchEntries;
using ModernKeePass.Common;
using ModernKeePass.Domain.AOP;
using ModernKeePass.Domain.Enums;
using ModernKeePass.Interfaces;

View File

@@ -1,9 +1,9 @@
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using GalaSoft.MvvmLight.Command;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Common;
using ModernKeePass.Domain.AOP;
using ModernKeePass.Domain.Interfaces;
using ModernKeePass.ViewModels.ListItems;

View File

@@ -2,12 +2,12 @@
using Windows.Storage;
using Windows.Storage.AccessCache;
using Windows.UI.Xaml.Controls;
using GalaSoft.MvvmLight.Command;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Database.Commands.CloseDatabase;
using ModernKeePass.Application.Database.Commands.SaveDatabase;
using ModernKeePass.Application.Database.Queries.GetDatabase;
using ModernKeePass.Common;
using ModernKeePass.Views;
namespace ModernKeePass.ViewModels

View File

@@ -1,14 +1,14 @@
<UserControl
x:Class="ModernKeePass.Views.UserControls.UpdateCredentialsUserControl"
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"
xmlns:viewModels="using:ModernKeePass.ViewModels"
mc:Ignorable="d" >
<UserControl x:Name="UserControl"
x:Class="ModernKeePass.Views.UserControls.UpdateCredentialsUserControl"
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"
xmlns:viewModels="using:ModernKeePass.ViewModels"
mc:Ignorable="d" >
<UserControl.Resources>
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter"/>
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToSolidColorBrushConverter"/>
@@ -18,7 +18,7 @@
<Grid x:Name="Grid">
<!-- DataContext is not set at the root of the control because of issues happening when displaying it -->
<Grid.DataContext>
<viewModels:UpdateCredentialsViewModel />
<viewModels:SetCredentialsViewModel />
</Grid.DataContext>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
@@ -60,7 +60,7 @@
</SymbolIcon>
</HyperlinkButton>
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2"
x:Uid="UpdateCredentialsOkButton"
Content="{Binding ButtonLabel, ElementName=UserControl}"
Click="UpdateButton_OnClick"
Style="{StaticResource MainColorButton}"
IsEnabled="{Binding IsValid, Mode=OneWay}" />

View File

@@ -13,7 +13,7 @@ namespace ModernKeePass.Views.UserControls
{
public sealed partial class UpdateCredentialsUserControl
{
public UpdateCredentialsViewModel ViewModel => Grid.DataContext as UpdateCredentialsViewModel;
public SetCredentialsViewModel ViewModel => Grid.DataContext as SetCredentialsViewModel;
public string ButtonLabel
{

View File

@@ -94,6 +94,8 @@
</Compile>
<Compile Include="DependencyInjection.cs" />
<Compile Include="Models\NavigationItem.cs" />
<Compile Include="ViewModel\MainViewModel.cs" />
<Compile Include="ViewModel\ViewModelLocator.cs" />
<Compile Include="Views\MainPageFrames\DonatePage.xaml.cs">
<DependentUpon>DonatePage.xaml</DependentUpon>
</Compile>
@@ -348,10 +350,26 @@
<HintPath>..\packages\Portable.BouncyCastle.1.8.5\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CommonServiceLocator, Version=2.0.5.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\packages\CommonServiceLocator.2.0.5\lib\netstandard1.0\CommonServiceLocator.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentValidation, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0, processorArchitecture=MSIL">
<HintPath>..\packages\FluentValidation.8.6.2\lib\netstandard1.1\FluentValidation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1.1\lib\windows81\GalaSoft.MvvmLight.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.4.1.0, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1.1\lib\windows81\GalaSoft.MvvmLight.Extras.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=7a953f43091b5a17, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmLightLibs.5.4.1.1\lib\windows81\GalaSoft.MvvmLight.Platform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MediatR, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediatR.3.0.1\lib\netstandard1.1\MediatR.dll</HintPath>
<Private>True</Private>
@@ -401,11 +419,11 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard1.1\System.Buffers.dll</HintPath>
<HintPath>..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Reference Include="System.Collections.Immutable, Version=1.2.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.7.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.ComponentModel.Primitives, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -420,20 +438,20 @@
<HintPath>..\packages\System.Drawing.Primitives.4.3.0\lib\netstandard1.1\System.Drawing.Primitives.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.1\lib\netstandard1.1\System.Memory.dll</HintPath>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\netstandard1.1\System.Memory.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\portable-net45+win8+wp8+wpa81\System.Numerics.Vectors.dll</HintPath>
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\portable-net45+win8+wp8+wpa81\System.Numerics.Vectors.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
<Reference Include="System.Reflection.Metadata, Version=1.4.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.8.0\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.1\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

View File

@@ -2,12 +2,13 @@
<packages>
<package id="AutoMapper" version="5.2.0" targetFramework="win81" />
<package id="AutoMapper.Extensions.Microsoft.DependencyInjection" version="1.2.0" targetFramework="win81" />
<package id="CommonServiceLocator" version="2.0.5" targetFramework="win81" />
<package id="FluentValidation" version="8.6.2" targetFramework="win81" />
<package id="HockeySDK.Core" version="4.1.6" targetFramework="win81" />
<package id="HockeySDK.WINRT" version="4.1.6" targetFramework="win81" />
<package id="MediatR" version="3.0.1" targetFramework="win81" />
<package id="MediatR.Extensions.Microsoft.DependencyInjection" version="2.0.0" targetFramework="win81" />
<package id="Microsoft.CSharp" version="4.3.0" targetFramework="win81" />
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="win81" />
<package id="Microsoft.Extensions.DependencyInjection" version="1.1.1" targetFramework="win81" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.1.1" targetFramework="win81" />
<package id="Microsoft.NETCore.Platforms" version="2.1.1" targetFramework="win81" />
@@ -15,15 +16,17 @@
<package id="Microsoft.NETCore.UniversalWindowsPlatform" version="6.1.7" targetFramework="win81" />
<package id="Microsoft.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.44.2" targetFramework="win81" />
<package id="MvvmLight" version="5.4.1.1" targetFramework="win81" />
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.5" targetFramework="win81" />
<package id="SixLabors.Core" version="1.0.0-beta0006" targetFramework="win81" />
<package id="SixLabors.ImageSharp" version="1.0.0-beta0005" targetFramework="win81" />
<package id="Splat" version="3.0.0" targetFramework="win81" />
<package id="System.Buffers" version="4.5.0" targetFramework="win81" />
<package id="System.Buffers" version="4.5.1" targetFramework="win81" />
<package id="System.Collections" version="4.3.0" targetFramework="win81" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="win81" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="win81" />
<package id="System.Collections.Immutable" version="1.7.0" targetFramework="win81" />
<package id="System.ComponentModel" version="4.3.0" targetFramework="win81" />
<package id="System.ComponentModel.Primitives" version="4.3.0" targetFramework="win81" />
<package id="System.ComponentModel.TypeConverter" version="4.3.0" targetFramework="win81" />
@@ -37,21 +40,21 @@
<package id="System.Linq" version="4.3.0" targetFramework="win81" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="win81" />
<package id="System.Linq.Queryable" version="4.3.0" targetFramework="win81" />
<package id="System.Memory" version="4.5.1" targetFramework="win81" />
<package id="System.Memory" version="4.5.4" targetFramework="win81" />
<package id="System.Net.Requests" version="4.3.0" targetFramework="win81" />
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="win81" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="win81" />
<package id="System.Reflection" version="4.3.0" targetFramework="win81" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="win81" />
<package id="System.Reflection.Metadata" version="1.6.0" targetFramework="win81" />
<package id="System.Reflection.Metadata" version="1.8.0" targetFramework="win81" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.1" targetFramework="win81" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime" version="4.3.1" targetFramework="win81" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="win81" />
<package id="System.Runtime.Extensions" version="4.3.1" targetFramework="win81" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.WindowsRuntime" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.WindowsRuntime" version="4.7.0" targetFramework="win81" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="win81" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="win81" />
<package id="System.Text.RegularExpressions" version="4.3.1" targetFramework="win81" />
<package id="System.Threading" version="4.3.0" targetFramework="win81" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="win81" />
<package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="win81" />

View File

@@ -2,6 +2,13 @@
{
public class Constants
{
public class Navigation
{
public static string MainPage => nameof(MainPage);
public static string EntryPage => nameof(EntryPage);
public static string GroupPage => nameof(GroupPage);
}
public class File
{
public static int OneMegaByte => 1048576;

View File

@@ -7,7 +7,7 @@ using ModernKeePass.Domain.Dtos;
namespace ModernKeePass.ViewModels
{
public class UpdateCredentialsViewModel : OpenDatabaseControlVm
public class SetCredentialsViewModel : OpenDatabaseControlVm
{
private readonly ICredentialsProxy _credentials;
private readonly ISettingsProxy _settings;
@@ -24,9 +24,9 @@ namespace ModernKeePass.ViewModels
public new bool IsValid => HasPassword && Password == ConfirmPassword || HasKeyFile && KeyFilePath != string.Empty;
public UpdateCredentialsViewModel(): this(App.Services.GetRequiredService<ICredentialsProxy>(), App.Services.GetRequiredService<ISettingsProxy>()) { }
public SetCredentialsViewModel(): this(App.Services.GetRequiredService<ICredentialsProxy>(), App.Services.GetRequiredService<ISettingsProxy>()) { }
public UpdateCredentialsViewModel(ICredentialsProxy credentials, ISettingsProxy settings)
public SetCredentialsViewModel(ICredentialsProxy credentials, ISettingsProxy settings)
{
_credentials = credentials;
_settings = settings;

View File

@@ -45,6 +45,6 @@
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Items\SettingsNewVm.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Items\SettingsSaveVm.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\UserControls\OpenDatabaseControlVm.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\UserControls\UpdateCredentialsViewModel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\UserControls\SetCredentialsViewModel.cs" />
</ItemGroup>
</Project>