mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Create database works with new Vm
Refactoring
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using ModernKeePass.Domain.AOP;
|
||||
using GalaSoft.MvvmLight;
|
||||
using ModernKeePass.Domain.Interfaces;
|
||||
|
||||
namespace ModernKeePass.ViewModels.ListItems
|
||||
{
|
||||
public class ListMenuItemVm : NotifyPropertyChangedBase, IIsEnabled, ISelectableModel
|
||||
public class ListMenuItemVm : ObservableObject, IIsEnabled, ISelectableModel
|
||||
{
|
||||
private bool _isSelected;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ModernKeePass.ViewModels.ListItems
|
||||
public bool IsSelected
|
||||
{
|
||||
get { return _isSelected; }
|
||||
set { SetProperty(ref _isSelected, value); }
|
||||
set { Set(() => IsSelected, ref _isSelected, value); }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@@ -1,10 +1,10 @@
|
||||
using ModernKeePass.Domain.AOP;
|
||||
using GalaSoft.MvvmLight;
|
||||
using ModernKeePass.Domain.Dtos;
|
||||
using ModernKeePass.Domain.Interfaces;
|
||||
|
||||
namespace ModernKeePass.ViewModels.ListItems
|
||||
{
|
||||
public class RecentItemVm: NotifyPropertyChangedBase, ISelectableModel
|
||||
public class RecentItemVm: ObservableObject, ISelectableModel
|
||||
{
|
||||
private bool _isSelected;
|
||||
private string _name;
|
||||
@@ -14,25 +14,25 @@ namespace ModernKeePass.ViewModels.ListItems
|
||||
public string Token
|
||||
{
|
||||
get { return _token; }
|
||||
set { SetProperty(ref _token, value); }
|
||||
set { Set(() => Token, ref _token, value); }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { SetProperty(ref _name, value); }
|
||||
set { Set(() => Name, ref _name, value); }
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
get { return _path; }
|
||||
set { SetProperty(ref _path, value); }
|
||||
set { Set(() => Path, ref _path, value); }
|
||||
}
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get { return _isSelected; }
|
||||
set { SetProperty(ref _isSelected, value); }
|
||||
set { Set(() => IsSelected, ref _isSelected, value); }
|
||||
}
|
||||
|
||||
public RecentItemVm(FileInfo file)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using GalaSoft.MvvmLight;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
@@ -16,12 +17,11 @@ using ModernKeePass.Application.Parameters.Models;
|
||||
using ModernKeePass.Application.Parameters.Queries.GetCiphers;
|
||||
using ModernKeePass.Application.Parameters.Queries.GetCompressions;
|
||||
using ModernKeePass.Application.Parameters.Queries.GetKeyDerivations;
|
||||
using ModernKeePass.Domain.AOP;
|
||||
|
||||
namespace ModernKeePass.ViewModels.ListItems
|
||||
{
|
||||
// TODO: implement Kdf settings
|
||||
public class SettingsDatabaseVm: NotifyPropertyChangedBase
|
||||
public class SettingsDatabaseVm: ObservableObject
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
private readonly DatabaseVm _database;
|
||||
@@ -32,7 +32,7 @@ namespace ModernKeePass.ViewModels.ListItems
|
||||
set
|
||||
{
|
||||
_mediator.Send(new SetHasRecycleBinCommand {HasRecycleBin = value}).Wait();
|
||||
OnPropertyChanged(nameof(HasRecycleBin));
|
||||
RaisePropertyChanged(nameof(HasRecycleBin));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Common;
|
||||
@@ -23,12 +24,34 @@ namespace ModernKeePass.ViewModels.ListItems
|
||||
set { _settings.PutSetting(Constants.Settings.Sample, value); }
|
||||
}
|
||||
|
||||
public IEnumerable<string> FileFormats => new []{"2", "4"};
|
||||
|
||||
public string FileFormatVersion
|
||||
public IEnumerable<DatabaseFormat> FileFormats => new []
|
||||
{
|
||||
get { return _settings.GetSetting<string>(Constants.Settings.DefaultFileFormat); }
|
||||
set { _settings.PutSetting(Constants.Settings.DefaultFileFormat, value); }
|
||||
new DatabaseFormat
|
||||
{
|
||||
Version = "4",
|
||||
DisplayText = "4 (Argon2, ChaCha20)"
|
||||
},
|
||||
new DatabaseFormat
|
||||
{
|
||||
Version = "3",
|
||||
DisplayText = "3 (AES-KDF, AES/Rijndael)"
|
||||
}
|
||||
};
|
||||
|
||||
public DatabaseFormat DatabaseFormatVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
var version = _settings.GetSetting<string>(Constants.Settings.DefaultFileFormat);
|
||||
return FileFormats.FirstOrDefault(f => f.Version == version);
|
||||
}
|
||||
set { _settings.PutSetting(Constants.Settings.DefaultFileFormat, value.Version); }
|
||||
}
|
||||
}
|
||||
|
||||
public class DatabaseFormat
|
||||
{
|
||||
public string Version { get; set; }
|
||||
public string DisplayText { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user