private void SelectNewDB() { string db; ResponseType result = FileDialog.Show(FileChooserAction.Save, this, S._("Please enter the name for the new database"), out db); if (result == ResponseType.Ok && db.Length > 0) { if (System.IO.Path.GetExtension(db).Length == 0) { db += ".vdb"; } bool create = true; if (File.Exists(db)) { create = (MsgDialog.Show(this, MessageType.Question, ButtonsType.YesNo, S._("Database exists"), S._("Database already exists. Overwrite?")) == ResponseType.Yes); } if (create) { OpenDB(db, true, false, ShowDBProperties); // no async list refresh necessary - new database //ShowDBProperties(); } } }
void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { Logger.Fatal("Application Error", e.Exception); MsgDialog.Show("Sorry, some errors occurred, the error message is saved in log"); Application.Current.Shutdown(); e.Handled = true;//使用这一行代码告诉运行时,该异常被处理了,不再作为UnhandledException抛出了。 }
private void Button_Click(object sender, RoutedEventArgs e) { if (_taskList.SelectedItem == null) { ErrorDialog.Show("Please select a DCP!"); return; } var info = (RunningDcpInfo)_taskList.SelectedItem; info.CTS.Cancel(); MsgDialog.Show($"Cancel task success"); TaskList.Remove(info); }
private void RemoveVolume() { TreeIter iter; if (!tvVolumes.GetSelectedIter(out iter)) { return; } ResponseType result = MsgDialog.Show(this, MessageType.Question, ButtonsType.YesNo, S._("Confirmation"), S._("Are you sure you really want to remove the selected volume?")); if (result == ResponseType.Yes) { PurgeVolume(iter); } }
private void OpenOrCreateDefaultDB(bool confirmCreation) { // do not overwrite existing db if (File.Exists(App.DefaultDB)) { // opens existing default db and if successful, // sets the db path and calls settings.Save() OpenDB(App.DefaultDB, false, true, null); } else { if (confirmCreation && !(MsgDialog.Show(this, MessageType.Question, ButtonsType.YesNo, S._("Database not found"), S._("Default database not found. Create?")) == ResponseType.Yes)) { return; } // creates default db and if successful, // sets the db path and calls settings.Save() OpenDB(App.DefaultDB, true, true, null); } }
private void Save() { /* * general settings */ if (cmbIconTheme.ActiveText == SYSTEM_ICON_THEME_NAME) { // prevent non-GNOME users from changing the only custom theme (Tango) // into the incomplete and ugly GTK default theme. if (Platform.Common.Diagnostics.CurrentPlatform.IsGnome) { App.Settings.CustomThemeName = string.Empty; } else { if (iconThemeChanged) { MsgDialog.Show(this, MessageType.Error, ButtonsType.Ok, S._("Unsupported theme"), string.Format(S._("The selected icon theme is currently not supported on your system."))); // do not notify that a restart is required iconThemeChanged = false; } } } else { App.Settings.CustomThemeName = cmbIconTheme.ActiveText; } App.Settings.OpenMostRecentDB = chkReopenDB.Active; App.Settings.ShowItemInfo = chkShowItemInfo.Active; App.Settings.ShowThumbsInItemLists = chkShowThumbs.Active; App.Settings.ShowHiddenItems = chkShowHiddenFiles.Active; /* * scanner settings */ string scannerDevice = string.Empty; if (cmbScannerDevice.Active > 0) { TreeIter iter; cmbScannerDevice.GetActiveIter(out iter); scannerDevice = (string)cmbScannerDevice.Model.GetValue(iter, 1); } App.Settings.ScannerDevice = scannerDevice; // App.Settings.ScannerBufferSize = (int)scaleBufferSize.Value; App.Settings.ScannerGenerateThumbnails = chkGenerateThumbnails.Active; App.Settings.ScannerExtractMetaData = chkExtractMetaData.Active; App.Settings.ScannerDiscardSymLinks = chkDiscardSymLinks.Active; App.Settings.ScannerComputeHashs = chkComputeHashs.Active; App.Settings.ScannerEnableMusicBrainz = chkMusicBrainz.Active; App.Settings.Save(); if (iconThemeChanged) { MsgDialog.Show(this, MessageType.Info, ButtonsType.Ok, S._("Restart required"), string.Format(S._("You must restart {0} for icontheme changes to take effect."), App.Name)); } }
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Logger.Fatal("Application Error", (Exception)e.ExceptionObject); MsgDialog.Show("Sorry, some errors occurred, the error message is saved in log"); Application.Current.Shutdown(); }