private void OnResetDatabase() { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); if (dlgYesNo != null) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(927)); // Warning dlgYesNo.SetLine(1, GUILocalizeStrings.Get(300026)); //Are you sure... dlgYesNo.DoModal(GetID); if (dlgYesNo.IsConfirmed) { string database = Config.GetFile(Config.Dir.Database, "PictureDatabase.db3"); if (File.Exists(database)) { PictureDatabase.Dispose(); try { File.Delete(database); } catch (Exception ex) { Log.Error("GUISettingsPictures: OnResetDatabase {0}", ex.Message); } finally { PictureDatabase.ReOpen(); } } } } }
/// <summary> /// /// </summary> private bool ClearDatabase() { string database = Config.GetFile(Config.Dir.Database, PictureDatabase.DatabaseName); if (File.Exists(database)) { PictureDatabase.Dispose(); try { File.Delete(database); } catch (Exception) { return(false); } finally { PictureDatabase.ReOpen(); } } return(true); }