WIP Split composite key user control

Some refactoring
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-20 20:02:43 +02:00
parent 73670e8689
commit 310bd777b2
54 changed files with 849 additions and 1200 deletions

View File

@@ -31,7 +31,7 @@ namespace ModernKeePass.ViewModels
set
{
SetProperty(ref _hasPassword, value);
OnPropertyChanged("IsValid");
OnPropertyChanged(nameof(IsValid));
}
}
@@ -41,21 +41,11 @@ namespace ModernKeePass.ViewModels
set
{
SetProperty(ref _hasKeyFile, value);
OnPropertyChanged("IsValid");
OnPropertyChanged(nameof(IsValid));
}
}
public bool HasUserAccount
{
get { return _hasUserAccount; }
set
{
SetProperty(ref _hasUserAccount, value);
OnPropertyChanged("IsValid");
}
}
public bool IsValid => !_isOpening && (HasPassword || HasKeyFile && KeyFilePath != null || HasUserAccount);
public bool IsValid => !_isOpening && (HasPassword || HasKeyFile && KeyFilePath != null);
public string Status
{
@@ -103,7 +93,6 @@ namespace ModernKeePass.ViewModels
private bool _hasPassword;
private bool _hasKeyFile;
private bool _hasUserAccount;
private bool _isOpening;
private string _password = string.Empty;
private string _status;
@@ -160,7 +149,6 @@ namespace ModernKeePass.ViewModels
var errorMessage = new StringBuilder($"{_resource.GetResourceValue("CompositeKeyErrorOpen")}\n");
if (HasPassword) errorMessage.AppendLine(_resource.GetResourceValue("CompositeKeyErrorUserPassword"));
if (HasKeyFile) errorMessage.AppendLine(_resource.GetResourceValue("CompositeKeyErrorUserKeyFile"));
if (HasUserAccount) errorMessage.AppendLine(_resource.GetResourceValue("CompositeKeyErrorUserAccount"));
UpdateStatus(errorMessage.ToString(), StatusTypes.Error);
}
catch (Exception e)
@@ -171,7 +159,7 @@ namespace ModernKeePass.ViewModels
finally
{
_isOpening = false;
OnPropertyChanged("IsValid");
OnPropertyChanged(nameof(IsValid));
}
return false;
}