/// <summary> /// Write the given batabase to the storage /// </summary> /// <param name="database"></param> /// <param name="password"></param> /// <returns></returns> public bool WriteDatabase(DatabaseModel database, string password) { encryptionService.Initialize(password); cache = database; var result = InternalWriteDatabase(); if (!result) { encryptionService.Clear(); } return(result); }
/// <summary> /// Reset the view to the database selection view and remove all the database related ressources /// </summary> private void CloseDatabase() { MainViewVisibility = false; DatabaseOpeningGroupVisibility = true; DatabaseName = string.Empty; var path = settingsService.GetDatabasePath(); databaseRepository.UnloadDatabase(); iconsService.UnloadIcons(); encryptionService.Clear(); Messenger.Default.Send(new DatabaseUnloadedMessage(this)); Messenger.Default.Send(new ShowDatabaseSelectionViewMessage(this, path)); }