Error messages are now caught at the app level (see if it's a good solution in the long term)

Redesign of the create key file button
This commit is contained in:
BONNEVILLE Geoffroy
2017-11-23 19:02:49 +01:00
parent 675a718107
commit 1b2d25e171
11 changed files with 54 additions and 47 deletions

View File

@@ -105,6 +105,7 @@ namespace ModernKeePass.Common
catch (Exception ex)
{
Status = (int)DatabaseStatus.Error;
throw;
}
}
@@ -112,38 +113,20 @@ namespace ModernKeePass.Common
/// Save the current database to another file and open it
/// </summary>
/// <param name="file">The new database file</param>
public bool Save(StorageFile file)
public void Save(StorageFile file)
{
DatabaseFile = file;
try
{
_pwDatabase.SaveAs(IOConnectionInfo.FromFile(DatabaseFile), true, new NullStatusLogger());
Status = (int)DatabaseStatus.Opened;
return true;
}
catch (Exception ex)
{
return false;
}
_pwDatabase.SaveAs(IOConnectionInfo.FromFile(DatabaseFile), true, new NullStatusLogger());
Status = (int)DatabaseStatus.Opened;
}
/// <summary>
/// Commit the changes to the currently opened database to file
/// </summary>
public bool Save()
public void Save()
{
if (_pwDatabase == null || !_pwDatabase.IsOpen) return false;
try
{
_pwDatabase.Save(new NullStatusLogger());
return true;
}
catch (Exception ex)
{
return false;
// TODO: put this at a better place (e.g. in views)
MessageDialogHelper.ShowErrorDialog(ex);
}
if (_pwDatabase == null || !_pwDatabase.IsOpen) return;
_pwDatabase.Save(new NullStatusLogger());
}
/// <summary>