private void TryFindSubtitle(string strFile, int duration) { // If strFile indicates only a disk root, the movie is actually a DVD // We don't want to look up on Internet for DVD subtitles. Usually DVD's // come with their builtin subtitles. if (PathUtils.IsRootPath(strFile)) { return; } if (SubtitleDownloadProcessor.TestForExistingSubtitle(strFile)) { if (MessageDisplay.Query(Translator.Translate("TXT_OVERWRITE_SUBTITLE"), Translator.Translate("TXT_QUESTION"), MessageBoxIcon.Information) != DialogResult.Yes) { return; } } if (SubtitleDownloadProcessor.CanPerformSubtitleDownload(strFile, duration)) { // We should display a subtitle but we don't have one. // Try to grab one from internet. ThreadPool.QueueUserWorkItem( new WaitCallback(SubtitleDownloadProcessor.AttemptDownload), strFile); } }
private bool ConfirmSave() { return(MessageDisplay.Query( Translator.Translate("TXT_CONFIRM_PROPERTYSAVE"), Translator.Translate("TXT_CONFIRMSAVECHANGES"), MessageBoxIcon.Question) == DialogResult.Yes); }
private void tsbDeleteRemote_Click(object sender, EventArgs e) { try { TreeNode node = tvRemotes.SelectedNode; if (node != null) { if (node.Tag is RCCServiceConfig.RemoteControlRow && MessageDisplay.Query(Translator.Translate("TXT_CONFIRMDELETEREMOTE"), Translator.Translate("TXT_CONFIRM"), MessageBoxIcon.Question) == DialogResult.Yes) { _config.RemoteControl.RemoveRemoteControlRow(node.Tag as RCCServiceConfig.RemoteControlRow); _config.RemoteControl.AcceptChanges(); DisplayRemotes(); } else if (node.Tag is RCCServiceConfig.RemoteButtonsRow && MessageDisplay.Query(Translator.Translate("TXT_CONFIRMDELETEBUTTON"), Translator.Translate("TXT_CONFIRM"), MessageBoxIcon.Question) == DialogResult.Yes) { _config.RemoteButtons.RemoveRemoteButtonsRow(node.Tag as RCCServiceConfig.RemoteButtonsRow); _config.RemoteButtons.AcceptChanges(); DisplayRemotes(); } } } catch (Exception ex) { ErrorDispatcher.DispatchError(ex, false); } }
private void ConfirmScanAbortOnException(Exception ex) { if (ex is ThreadAbortException) { _abortScan.Set(); } else { MainThread.Post(delegate(object x) { string message = Translator.Translate("TXT_SCAN_ERROR_MSG", SourcePath, ex.Message); TaskbarThumbnailManager.Instance.SetProgressStatus(TaskbarProgressBarStatus.Paused); if (MessageDisplay.Query(message, "TXT_SCAN_ERROR", MessageBoxIcon.Exclamation) != DialogResult.Yes) { _abortScan.Set(); } else { _abortScan.Reset(); } TaskbarThumbnailManager.Instance.SetProgressStatus(TaskbarProgressBarStatus.Normal); }); } }
public static void TryFindSubtitle(string strFile, int duration, bool askToOverwrite) { try { if (SubtitleDownloadProcessor.TestForExistingSubtitle(strFile)) { if (!askToOverwrite || MessageDisplay.Query(Translator.Translate("TXT_OVERWRITE_SUBTITLE"), Translator.Translate("TXT_CONFIRM_OVERWRITE_SUBTITLE"), MessageBoxIcon.Information) != DialogResult.Yes) { return; } } if (SubtitleDownloadProcessor.CanPerformSubtitleDownload(strFile, duration)) { // We should display a subtitle but we don't have one. // Try to grab one from internet. ThreadPool.QueueUserWorkItem( new WaitCallback(SubtitleDownloadProcessor.AttemptDownload), strFile); } } finally { // This is for enforcing playlist refresh EventDispatch.DispatchEvent(LocalEvents.UpdatePlaylistNames, false); } }
private void OnRestoreDefaults(object sender, EventArgs e) { if (MessageDisplay.Query("TXT_CONFIRM_RESTORE", "TXT_RESTOREDEFAULTS", MessageBoxIcon.Question) == DialogResult.Yes) { ShortcutMapper.RestoreDefaults(true); DisplayKeys(); } }
void btnRestoreDefaults_Click(object sender, System.EventArgs e) { if (MessageDisplay.Query("TXT_CONFIRM_RESTORE", "TXT_RESTORE_DEFAULTSERVERS", MessageBoxIcon.Question) == DialogResult.Yes) { _subtitleDownloadURIs = ProTONEConfig.DefaultSubtitleURIs; BuildListFromSubtitleDownloadURIs(); Modified = true; } }
private bool VerifyShortcut(KeyEventArgs args) { OPMShortcut cmd = ShortcutMapper.MapCommand(args.KeyData); if (cmd == OPMShortcut.CmdOutOfRange) { // Key combination currently not assigned so it's OK to use it. return(true); } if (cmd == _cmd) { // Same command => ok to reassign. return(true); } string cmdOld = cmd.ToString().Replace("Cmd", string.Empty); string cmdNew = _cmd.ToString().Replace("Cmd", string.Empty); KeysConverter kc = new KeysConverter(); string key = kc.ConvertToInvariantString(args.KeyData); if ((args.KeyData == Keys.Space && ShortcutMapper.IsPlayer) || !ShortcutMapper.IsConfigurableShortcut(cmd)) { // Key combination currently assigned // to a non-configurable command (e.g. F1 = help) MessageDisplay.Show(Translator.Translate("TXT_DUP_SHORTCUT_FIXED", key, cmdOld), Translator.Translate("TXT_DUPPLICATE_SHORTCUT"), MessageBoxIcon.Warning); return(false); } if (MessageDisplay.Query(Translator.Translate("TXT_DUP_SHORTCUT_CONFIRM", key, cmdOld, cmdNew), Translator.Translate("TXT_DUPPLICATE_SHORTCUT"), MessageBoxIcon.Question) != System.Windows.Forms.DialogResult.Yes) { // Key combination already assigned and the user did not want to change it use it. return(false); } // Unassign old shortcut if (ShortcutMapper.KeyCommands[(int)cmd].KeyData == args.KeyData) { // Was used for primary shortcut ShortcutMapper.KeyCommands[(int)cmd] = new KeyEventArgs(Keys.None); } else if (ShortcutMapper.AltKeyCommands[(int)cmd].KeyData == args.KeyData) { // Was used for alternate shortcut ShortcutMapper.AltKeyCommands[(int)cmd] = new KeyEventArgs(Keys.None); } return(true); }
protected ConfirmationData ConfirmObjectAction(string tag, string objectName) { try { _fileTaskWaitEvent.Set(); TaskbarThumbnailManager.Instance.SetProgressStatus(TaskbarProgressBarStatus.Paused); ConfirmationData retVal = new ConfirmationData(); MainThread.Send(delegate(object x) { DialogResult dr = DialogResult.Abort; if (_task.ObjectsCount == 1) { dr = MessageDisplay.Query( Translator.Translate(tag, objectName), "TXT_CONFIRM"); } else { dr = MessageDisplay.QueryWithCancelAndAbort( Translator.Translate(tag, objectName), "TXT_CONFIRM", (_task.ObjectsCount > 1)); } switch (dr) { case DialogResult.Abort: CanContinue = false; break; case DialogResult.No: retVal.ConfirmationResult = false; break; case DialogResult.Yes: retVal.ConfirmationResult = true; break; case DialogResult.OK: // YES ALL retVal.ConfirmationResult = true; retVal.FlagValue = true; break; } }); return(retVal); } finally { _fileTaskWaitEvent.Reset(); TaskbarThumbnailManager.Instance.SetProgressStatus(TaskbarProgressBarStatus.Normal); } }
private void DeleteSelectedTheme() { TreeNode themeNode = GetSelectedThemeNode(); if (themeNode != null && themeNode.Tag is KeyValuePair <string, Theme> && (MessageDisplay.Query("Are you sure you want to delete the selected theme ?\nYou will not be able to undo this rmeoval !", "Confirm theme deletion") == DialogResult.Yes)) { _themeFile.DeleteTheme(((KeyValuePair <string, Theme>)themeNode.Tag).Key); DisplayThemeFile(); } }
public void RequestAbort() { try { _fileTaskWaitEvent.Set(); TaskbarThumbnailManager.Instance.SetProgressStatus(TaskbarProgressBarStatus.Paused); if (MessageDisplay.Query(Translator.Translate("TXT_CONFIRM_ABORT"), Translator.Translate("TXT_CONFIRM"), MessageBoxIcon.Question) == DialogResult.Yes) { CanContinue = false; } } finally { _fileTaskWaitEvent.Reset(); TaskbarThumbnailManager.Instance.SetProgressStatus(TaskbarProgressBarStatus.Normal); } }
private void btnDelete_Click(object sender, EventArgs e) { try { ListViewItem item = lvButtons.SelectedItems.Count > 0 ? lvButtons.SelectedItems[0] : null; if (item != null && item.Tag is RCCServiceConfig.RemoteButtonsRow && MessageDisplay.Query(Translator.Translate("TXT_CONFIRMDELETEBUTTON"), Translator.Translate("TXT_CONFIRM"), MessageBoxIcon.Question) == DialogResult.Yes) { _config.RemoteButtons.RemoveRemoteButtonsRow(item.Tag as RCCServiceConfig.RemoteButtonsRow); _config.RemoteButtons.AcceptChanges(); DisplayButtonsData(); } } catch (Exception ex) { ErrorDispatcher.DispatchError(ex, false); } }
private void ScheduleForUninstall(string assembly) { string addons = string.Empty; List <AddonInfo> itemsToDisable = new List <AddonInfo>(); foreach (AddonInfo ai in addonList.AllAddons) { string[] codebaseParts = ai.CodeBase.Split(new char[] { '|' }); if (codebaseParts.Length > 0 && codebaseParts[0].ToLowerInvariant() == assembly.ToLowerInvariant()) { addons += ai.TranslatedName; addons += "\n"; itemsToDisable.Add(ai); } } if (itemsToDisable.Count < 1) { return; } if (itemsToDisable.Count == 1 || (MessageDisplay.Query(Translator.Translate("TXT_SHAREDADDONS", addons), Translator.Translate("TXT_CAUTION"), MessageBoxIcon.Question) == DialogResult.Yes)) { // Clear for uninstalling. foreach (AddonInfo ai in itemsToDisable) { PersistenceProxy.DeleteObject(ai.Name, false); addonList.RemoveAddon(ai); } AddonsConfig.MarkForUninstall(assembly); _uninstallScheduled = true; } }
protected override void SaveInternal() { if (GetEnabledAddonCount(addonList.NavigationAddons) > 0) { if (!IsConfigurationChanged()) { //Nothing changed, therefore nothing is to be saved. return; } if (AddonsConfig.IsInitialConfig || MessageDisplay.Query(Translator.Translate("TXT_ADDONS_CHANGED_RESTART"), Translator.Translate("TXT_APP_RESTART"), MessageBoxIcon.Question) == DialogResult.Yes) { SaveGroup(addonList.NavigationAddons, "NavigationAddons"); SaveGroup(addonList.PropertyAddons, "PropertyAddons"); SaveGroup(addonList.PreviewAddons, "PreviewAddons"); if (!AddonsConfig.IsInitialConfig) { Logger.LogInfo("Updated addons configuration was saved. Requesting to reload."); SettingsForm.RequestRestart(); //AddonDetector.FireReloadAddons(); } } else if (!AddonsConfig.IsInitialConfig) { MessageDisplay.Show(Translator.Translate("TXT_ADDONS_NOT_CHANGED"), "Info", MessageBoxIcon.Information); } } else { throw new SettingsSaveException("You must enable at least one navigation addon !"); } }
private bool ConfirmCreate(string p) { return(MessageDisplay.Query(Translator.Translate("TXT_CONFIRM_CREATE", p), Translator.TranslatedAppName) == DialogResult.Yes); }