Layout change in CompositeKey user control

Button text is now settable
Opening database is placed in async task dispatcher to return control to the UI
This commit is contained in:
BONNEVILLE Geoffroy
2017-11-24 18:21:06 +01:00
parent 7cd05cb1d8
commit 42ac04b02c
11 changed files with 98 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.UI.Xaml;
using ModernKeePass.Common;
@@ -73,6 +74,7 @@ namespace ModernKeePass.ViewModels
_password = value;
OnPropertyChanged("PasswordComplexityIndicator");
StatusType = (int)StatusTypes.Normal;
Status = string.Empty;
}
}
@@ -104,7 +106,7 @@ namespace ModernKeePass.ViewModels
Database = database;
}
public bool OpenDatabase(bool createNew)
public async Task<bool> OpenDatabase(bool createNew)
{
var error = string.Empty;
try
@@ -118,7 +120,7 @@ namespace ModernKeePass.ViewModels
switch ((DatabaseHelper.DatabaseStatus)Database.Status)
{
case DatabaseHelper.DatabaseStatus.Opened:
RootGroup = Database.RootGroup;
await Task.Run( () => RootGroup = Database.RootGroup);
return true;
case DatabaseHelper.DatabaseStatus.CompositeKeyError:
var errorMessage = new StringBuilder("Error: wrong ");