Better suspend/resume handling

This commit is contained in:
BONNEVILLE Geoffroy
2018-06-21 16:40:04 +02:00
parent 4393aada3e
commit d533abada5
7 changed files with 33 additions and 27 deletions

View File

@@ -20,6 +20,7 @@ namespace ModernKeePass.Services
private readonly ISettingsService _settings;
private StorageFile _databaseFile;
private GroupVm _recycleBin;
private CompositeKey _compositeKey;
public GroupVm RootGroup { get; set; }
@@ -40,9 +41,7 @@ namespace ModernKeePass.Services
get { return _pwDatabase.RecycleBinEnabled; }
set { _pwDatabase.RecycleBinEnabled = value; }
}
public CompositeKey CompositeKey { get; set; }
public PwUuid DataCipher
{
get { return _pwDatabase.DataCipherUuid; }
@@ -87,12 +86,16 @@ namespace ModernKeePass.Services
{
try
{
if (databaseFile == null)
{
throw new ArgumentNullException(nameof(databaseFile));
}
if (key == null)
{
throw new ArgumentNullException(nameof(key));
}
CompositeKey = key;
_compositeKey = key;
var ioConnection = IOConnectionInfo.FromFile(databaseFile);
if (createNew)
{
@@ -122,7 +125,7 @@ namespace ModernKeePass.Services
public void ReOpen()
{
Open(_databaseFile, CompositeKey);
Open(_databaseFile, _compositeKey);
}
/// <summary>
@@ -180,6 +183,11 @@ namespace ModernKeePass.Services
RecycleBin.IsSelected = true;
RecycleBin.IconId = (int)PwIcon.TrashBin;
}
public void UpdateCompositeKey(CompositeKey newCompositeKey)
{
if (newCompositeKey != null) _compositeKey = newCompositeKey;
}
private void CreateSampleData()
{