private void HandleSaveFailed(object sender, INTV.Shared.Model.Program.ProgramCollectionSaveFailedEventArgs e) { // FIXME: If this is ever invoked from a non-UI thread -- I'm looking at you, Mac, it may be trouble. var title = Resources.Strings.RomList_SaveFailed_Title; var message = Resources.Strings.RomList_SaveFailed_Message; var buttons = OSMessageBoxButton.OK; if (!string.IsNullOrEmpty(e.RomListBackupPath) && System.IO.File.Exists(e.RomListBackupPath)) { message += Resources.Strings.RomList_SaveFailed_PromptToRestoreMessage; buttons = OSMessageBoxButton.YesNo; } var result = OSMessageBox.Show(message, title, e.Error, buttons, OSMessageBoxIcon.Error); if ((result == OSMessageBoxResult.Yes) && !string.IsNullOrEmpty(e.RomListBackupPath) && System.IO.File.Exists(e.RomListBackupPath)) { var romsConfiguration = INTV.Shared.Model.RomListConfiguration.Instance; System.IO.File.Replace(e.RomListPath, romsConfiguration.RomFilesPath, null); InitializeRomList(romsConfiguration.RomFilesPath); } }
private static void OnClearEmulatorFile(object parameter, EmulatorFile whichFile) { CommandLineArgumentHelpers.CheckCommandLineArgumentStrings(); var viewModel = parameter as JzIntvSettingsPageViewModel; switch (whichFile) { case EmulatorFile.JzIntv: viewModel.EmulatorPath = null; break; case EmulatorFile.Exec: viewModel.ExecRomPath = null; break; case EmulatorFile.Grom: viewModel.GromRomPath = null; break; case EmulatorFile.Ecs: viewModel.EcsRomPath = null; break; case EmulatorFile.KeyboardConfig: viewModel.DefaultKeyboardConfigPath = null; break; case EmulatorFile.Cgc0Config: viewModel.JzIntvCgc1ConfigPath = null; break; case EmulatorFile.Cgc1Config: viewModel.JzIntvCgc1ConfigPath = null; break; default: OSMessageBox.Show(string.Format(Resources.Strings.ConfigurationFile_UnknownEmulatorFile_Error_Message_Format, whichFile), Resources.Strings.ConfigurationFile_UnknownEmulatorFile_Error_Title); break; } }
/// <summary> /// Report firmware command errors to the user. /// </summary> /// <param name="command">The firmware-related command that failed.</param> /// <param name="errorMessage">The message generated from the command execution code.</param> /// <param name="exception">The exception that caused the error, if applicable.</param> /// <returns><c>true</c> if the error was reported to the user.</returns> internal static bool ErrorHandler(INTV.LtoFlash.Model.Commands.ProtocolCommandId command, string errorMessage, System.Exception exception) { var handled = false; var title = string.Empty; var messageFormat = string.Empty; switch (command) { case Model.Commands.ProtocolCommandId.FirmwareEraseSecondary: handled = true; title = Resources.Strings.RestoreFirmwareCommand_Failed_Title; messageFormat = Resources.Strings.RestoreFirmwareCommand_Failed_Message_Format; break; case Model.Commands.ProtocolCommandId.FirmwareProgramSecondary: handled = true; title = Resources.Strings.Firmware_UpdateFirmwareCommand_Failed_Title; messageFormat = Resources.Strings.Firmware_UpdateFirmwareCommand_Failed_Message_Format; break; case Model.Commands.ProtocolCommandId.FirmwareGetRevisions: handled = true; title = Resources.Strings.GetFirmwareRevisionsCommand_Failed_Title; messageFormat = Resources.Strings.GetFirmwareRevisionsCommand_Failed_Message_Format; break; case Model.Commands.ProtocolCommandId.FirmwareValidateImageInRam: handled = true; title = Resources.Strings.ProtocolCommandId_FirmwareValidateImageInRam_Title; messageFormat = Resources.Strings.ProtocolCommandId_FirmwareValidateImageInRam_Failed; break; } if (handled) { var message = string.Format(System.Globalization.CultureInfo.CurrentCulture, messageFormat, errorMessage); OSMessageBox.Show(message, title); } return(handled); }
private static void DownloadRom(IntellicartViewModel intellicart, IProgramDescription program) { if (program != null) { var isCompatible = intellicart.Model.IsRomCompatible(program); if (!isCompatible) { var message = string.Format(Resources.Strings.DownloadCommand_IncompatibleRom_Message_Format, program.Name); isCompatible = OSMessageBox.Show(message, Resources.Strings.DownloadCommand_IncompatibleRom_Title, OSMessageBoxButton.YesNo) == OSMessageBoxResult.Yes; } if (isCompatible) { if ((program != null) && (program.Rom != null) && !program.Rom.Validate()) { OSMessageBox.Show(string.Format(Resources.Strings.DownloadCommand_Missing_Message_Format, program.Name, program.Rom.RomPath), string.Format(Resources.Strings.DownloadCommand_Failed_Title_Format, program.Name)); } else { intellicart.Model.DownloadRom(program.Name, program.Rom, OnDownloadError); } } } }
private static void InstallSDLComplete(AsyncTaskData taskData) { var data = (InstallSDLTaskData)taskData; var diskImageInfo = data.DiskImageInfo; if (!string.IsNullOrEmpty(data.ErrorMessage) || (data.Error != null)) { var message = string.Format(CultureInfo.CurrentCulture, Resources.Strings.SDLInstall_GeneralFailureMessage, diskImageInfo.Version); var title = string.Format(CultureInfo.CurrentCulture, Resources.Strings.SDLInstall_Failure_Title, diskImageInfo.Version); var dialog = INTV.Shared.View.ReportDialog.Create(title, message); dialog.TextWrapping = OSTextWrapping.Wrap; dialog.ShowSendEmailButton = false; dialog.ReportText = data.ErrorMessage; dialog.Exception = data.Error; dialog.ShowDialog(Resources.Strings.ReportErrorDialogButtonText); } else { var message = string.Format(CultureInfo.CurrentCulture, Resources.Strings.SDLInstall_Success_Message, diskImageInfo.Version); var title = string.Format(CultureInfo.CurrentCulture, Resources.Strings.SDLInstall_Success_Title, diskImageInfo.Version); OSMessageBox.Show(message, title); } }
private static void HandleLoadError(string romListFile, Exception exception) { var backupCopyPath = romListFile.GetUniqueBackupFilePath(); var errorDialog = INTV.Shared.View.ReportDialog.Create(Resources.Strings.RomList_LoadFailed_Title, Resources.Strings.RomList_LoadFailed_Message); errorDialog.ReportText = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.RomList_LoadFailed_Error_Format, backupCopyPath, exception); errorDialog.BeginInvokeDialog( Resources.Strings.RomList_LoadFailed_BackupButton_Text, new System.Action <bool?>((result) => { if (result.HasValue && result.Value) { try { File.Copy(romListFile, backupCopyPath); } catch (System.Exception x) { var message = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.RomList_LoadFailed_BackupFailed_Message_Format, x.Message); OSMessageBox.Show(message, Resources.Strings.RomList_LoadFailed_Title, x, OSMessageBoxButton.OK, OSMessageBoxIcon.Error); } } })); }
/// <summary> /// Mac-specific error handler. /// </summary> /// <param name="emulator">The emulator instance that was running.</param> /// <param name="message">The error message.</param> /// <param name="exitCode">The exit code of the emulator.</param> /// <param name="exception">The exception that occurred.</param> static partial void OSErrorHandler(Emulator emulator, string message, int exitCode, Exception exception) { if (IsSDLMissingError(exitCode)) { var sdlVersionInfo = IncludedSDLVersion; var errorMessage = string.Format(CultureInfo.CurrentCulture, Resources.Strings.SDLNotFound_ErrorMessage, sdlVersionInfo.Version); // Check to see if we can determine the missing SDL version from the error message. // If the missing version is not the same as the included version, we must get the "other" version. // Also, check to see if we already have the included SDL installed. If we do, but the failure still indicates // that it's missing, then it's possible the version of jzIntv being run requires the "other" version of SDL. // Switch over to the 'other' version for reporting the error if such is the case. var missingVersion = GetMissingSDLVersionFromErrorMessage(message); if ((missingVersion != SDLVersion.Unknown) && (missingVersion != IncludedSDLVersion.Version) || sdlVersionInfo.IsAlreadyInstalled) { sdlVersionInfo = sdlVersionInfo.GetOtherSDLVersionInfo(); errorMessage = string.Format( CultureInfo.CurrentCulture, Resources.Strings.SDLNotFound_DownloadMissingVersion_Format, sdlVersionInfo.Version, sdlVersionInfo.VersionNumber, sdlVersionInfo.DownloadUrl); } var errorTitle = string.Format(CultureInfo.CurrentCulture, Resources.Strings.SDLNotFound_ErrorTitle, sdlVersionInfo.Version); if (OSMessageBox.Show(errorMessage, errorTitle, OSMessageBoxButton.YesNo) == OSMessageBoxResult.Yes) { var installSDLTask = new AsyncTaskWithProgress("InstallSDL", allowsCancel: false, isIndeterminate: true, progressDisplayDelay: 0); var installTitle = string.Format(CultureInfo.CurrentCulture, Resources.Strings.SDLInstall_Title, sdlVersionInfo.Version); installSDLTask.UpdateTaskTitle(installTitle); var installSDLTaskData = new InstallSDLTaskData(installSDLTask, sdlVersionInfo); installSDLTask.RunTask(installSDLTaskData, InstallSDL, InstallSDLComplete); } } }
private bool ErrorHandler(DeviceStatusFlags deviceStatusFlags, ProtocolCommandId commandId, string errorMessage, System.Exception exception) { bool handled = false; var title = string.Empty; var messageFormat = string.Empty; var showMessageBox = false; switch (commandId) { case ProtocolCommandId.SetConfiguration: handled = true; showMessageBox = handled; switch (deviceStatusFlags.Lo) { case DeviceStatusFlagsLo.IntellivisionIIStatusMask: title = Resources.Strings.SetConfigurationCommand_IntellivisionII_Failed_Title; messageFormat = Resources.Strings.SetConfigurationCommand_IntellivisionII_Failed_Message_Format; break; case DeviceStatusFlagsLo.EcsStatusMask: title = Resources.Strings.SetConfigurationCommand_Ecs_Failed_Title; messageFormat = Resources.Strings.SetConfigurationCommand_Ecs_Failed_Message_Format; break; case DeviceStatusFlagsLo.ShowTitleScreenMask: title = Resources.Strings.SetConfigurationCommand_ShowTitleScreen_Failed_Title; messageFormat = Resources.Strings.SetConfigurationCommand_ShowTitleScreen_Failed_Message_Format; break; case DeviceStatusFlagsLo.SaveMenuPositionMask: title = Resources.Strings.SetConfigurationCommand_SaveMenuPosition_Failed_Title; messageFormat = Resources.Strings.SetConfigurationCommand_SaveMenuPosition_Failed_Message_Format; break; case DeviceStatusFlagsLo.BackgroundGC: title = Resources.Strings.SetConfigurationCommand_BackgroundGC_Failed_Title; messageFormat = Resources.Strings.SetConfigurationCommand_BackgroundGC_Failed_Message_Format; break; case DeviceStatusFlagsLo.Keyclicks: title = Resources.Strings.SetConfigurationCommand_Keyclicks_Failed_Title; messageFormat = Resources.Strings.SetConfigurationCommand_Keyclicks_Failed_Message_Format; break; case DeviceStatusFlagsLo.ZeroRamBeforeLoad: title = Resources.Strings.SetConfigurationCommand_RandomizeLtoFlashRam_Failed_Title; messageFormat = Resources.Strings.SetConfigurationCommand_RandomizeLtoFlashRam_Failed_Message_Format; break; } break; case ProtocolCommandId.DownloadCrashLog: handled = true; showMessageBox = handled; title = Resources.Strings.GetErrorAndCrashLogs_Failed_Title; messageFormat = Resources.Strings.GetErrorAndCrashLogs_Failed_Message_Format; break; case ProtocolCommandId.UnknownCommand: handled = true; var application = SingleInstanceApplication.Instance; if ((application != null) && (application.MainWindow != null)) { var portName = "<null>"; if ((Device != null) && (Device.Port != null)) { portName = Device.Port.Name; } var message = string.Format(CultureInfo.CurrentCulture, Resources.Strings.DeviceValidation_Failed_Message_Format, portName); var dialog = INTV.Shared.View.ReportDialog.Create(Resources.Strings.DeviceValidation_Failed_Title, message); dialog.ReportText = errorMessage; dialog.ShowSendEmailButton = false; dialog.ShowCopyToClipboardButton = false; dialog.BeginInvokeDialog(Resources.Strings.OK, null); } break; default: break; } if (showMessageBox && handled) { var message = string.Format(CultureInfo.CurrentCulture, messageFormat, errorMessage); OSMessageBox.Show(message, title, SingleInstanceApplication.SharedSettings.ShowDetailedErrors ? exception : null, (r) => { }); } return(handled); }
private static void SyncDeviceToHostCompleteDialog(bool cancelled, bool didShowProgress, LtoFlashViewModel ltoFlashViewModel, FileSystemSyncErrors syncErrors) { ltoFlashViewModel.HostPCMenuLayout.ShowOverlay = ltoFlashViewModel.HostPCMenuLayout.Items.Count == 0; bool showDialog = true; var title = string.Empty; var message = string.Empty; var icon = OSMessageBoxIcon.None; if (syncErrors.Any) { icon = OSMessageBoxIcon.Information; title = Resources.Strings.SyncDeviceToHostCommandComplete_WarningTitle; var briefReport = new System.Text.StringBuilder().AppendLine(Resources.Strings.SyncDeviceToHostCommandComplete_WarningsMessage); if (syncErrors.FailedToCreateEntries.Any()) { briefReport.AppendFormat(" " + Resources.Strings.SyncErrors_MissingEntriesFormat, syncErrors.FailedToCreateEntries.Count).AppendLine(); } if (syncErrors.UnableToRetrieveForks.Any()) { briefReport.Append(" ").AppendFormat(Resources.Strings.SyncErrors_UnableToRetrieveForksFormat, syncErrors.UnableToRetrieveForks.Count).AppendLine(); } if (syncErrors.OrphanedForks.Any()) { briefReport.Append(" ").AppendFormat(Resources.Strings.SyncErrors_OrphanedForksFormat, syncErrors.OrphanedForks.Count).AppendLine(); } if (syncErrors.UnsupportedForks.Any()) { briefReport.Append(" ").AppendFormat(Resources.Strings.SyncErrors_UnsupportedForksFormat, syncErrors.UnsupportedForks.Count).AppendLine(); briefReport.AppendLine().AppendLine(Resources.Strings.SyncErrors_UnsupportedForksInfo); } briefReport.AppendLine().AppendLine(Resources.Strings.SyncDeviceToHostCommandComplete_DireWarning); message = briefReport.ToString(); syncErrors.RecordErrors(Configuration.Instance.ErrorLogDirectory, "SYNC_LTOFLASH_TO_COMPUTER", "SyncDeviceToHost" + PathUtils.GetTimeString() + ".txt"); } else { if (cancelled && (ltoFlashViewModel.ActiveLtoFlashDevice.Device.FileSystem.Status == LfsDirtyFlags.None)) { showDialog = false; } else if (!cancelled && !didShowProgress) { showDialog = false; } if (showDialog) { title = cancelled ? Resources.Strings.SyncDeviceToHostCommandCancelled_Title : Resources.Strings.SyncDeviceToHostCommandComplete_Title; if (cancelled) { message = Resources.Strings.SyncDeviceToHostCommandCancelled_Message; } else { message = Resources.Strings.SyncDeviceToHostCommandComplete_Message; } } } if (showDialog) { OSMessageBox.Show(message, title, OSMessageBoxButton.OK, icon); } ltoFlashViewModel.ActiveLtoFlashDevice.Device.GetFileSystemStatistics(GetFileSystemStatisticsErrorHandler); }
private static void SyncHostToDeviceCompleteDialog(bool cancelled, bool didShowProgress, LtoFlashViewModel ltoFlashViewModel, IDictionary <string, FailedOperationException> warnings) { ltoFlashViewModel.HostPCMenuLayout.ShowOverlay = false; bool showDialog = true; if (cancelled && (ltoFlashViewModel.ActiveLtoFlashDevice.Device.FileSystem.Status == LfsDirtyFlags.None)) { showDialog = false; } if (showDialog) { var title = cancelled ? Resources.Strings.SyncHostToDeviceCommandCancelled_Title : Resources.Strings.SyncHostToDeviceCommandComplete_Title; var message = string.Empty; if (cancelled) { if (ltoFlashViewModel.ActiveLtoFlashDevice.Device.FileSystem.Status == LfsDirtyFlags.None) { message = Resources.Strings.SyncHostToDeviceCommandCancelledNoChanges_Message; } else { message = Resources.Strings.SyncHostToDeviceCommandCancelled_Message; } } else { message = Resources.Strings.SyncHostToDeviceCommandComplete_Message; } var result = OSMessageBoxResult.Yes; if ((warnings != null) && warnings.Any()) { var reportDialog = ReportDialog.Create(title, message); reportDialog.ShowSendEmailButton = false; var warningsBuilder = new System.Text.StringBuilder(Resources.Strings.SyncHostToDeviceCommand_WarningMessage).AppendLine().AppendLine(); foreach (var warning in warnings) { warningsBuilder.AppendFormat(Resources.Strings.SyncHostToDeviceCommand_WarningFormat, warning.Key, warning.Value.Message).AppendLine().AppendLine(); } if (SingleInstanceApplication.SharedSettings.ShowDetailedErrors) { warningsBuilder.AppendLine(Resources.Strings.SyncHostToDeviceCommand_WarningDetailHeader).AppendLine("------------------------------------------------"); foreach (var exception in warnings.Values) { warningsBuilder.AppendLine(exception.ToString()).AppendLine(); } } reportDialog.ReportText = warningsBuilder.ToString(); reportDialog.TextWrapping = OSTextWrapping.Wrap; reportDialog.ShowDialog(Resources.Strings.OK); } else { var buttons = cancelled ? OSMessageBoxButton.YesNo : OSMessageBoxButton.OK; result = OSMessageBox.Show(message, title, buttons); } if (cancelled && (result == OSMessageBoxResult.Yes) && CanSyncHostToDevicePreview(ltoFlashViewModel)) { SyncHostToDevicePreview(ltoFlashViewModel); } } ltoFlashViewModel.ActiveLtoFlashDevice.Device.GetFileSystemStatistics(GetFileSystemStatisticsErrorHandler); }
/// <summary> /// Prompts to confirm a firmware update operation and then executes the update if so instructed. /// </summary> /// <param name="device">The target device of the firmware upgrade.</param> /// <param name="firmwareFile">Absolute path to the file containing the firmware update bits.</param> /// <param name="additionalMessagePrefix">Additional optional message prefix.</param> /// <param name="additionalMessageSuffix">Additional optional message suffix.</param> internal static void UpdateFirmware(Device device, string firmwareFile, string additionalMessagePrefix, string additionalMessageSuffix) { string message = string.Empty; if (string.IsNullOrWhiteSpace(firmwareFile) || !System.IO.File.Exists(firmwareFile)) { message = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.UpdateFirmwareCommand_FileNotFoundErrorMessageFormat, firmwareFile); OSMessageBox.Show(message, Resources.Strings.UpdateFirmwareCommand_FileNotFoundErrorTitle); return; } var fileInfo = new System.IO.FileInfo(firmwareFile); if ((fileInfo.Length > Device.TotalRAMSize) || (fileInfo.Length < MinimumFirmwareUpdateFileSize)) { var badFileSizetitle = Resources.Strings.UpdateFirmwareCommand_FileTooLargeErrorTitle; var messageFormat = Resources.Strings.UpdateFirmwareCommand_FileTooLargeErrorMessageFormat; if (fileInfo.Length < MinimumFirmwareUpdateFileSize) { badFileSizetitle = Resources.Strings.UpdateFirmwareCommand_FileTooSmallErrorTitle; messageFormat = Resources.Strings.UpdateFirmwareCommand_FileTooSmallErrorMessageFormat; } message = string.Format(System.Globalization.CultureInfo.CurrentCulture, messageFormat, firmwareFile, fileInfo.Length); OSMessageBox.Show(message, badFileSizetitle); return; } var firmwareRevisions = device.FirmwareRevisions; int currentVersion = firmwareRevisions.Current & ~FirmwareRevisions.SecondaryMask; int primaryVersion = firmwareRevisions.Primary; bool isValidFirmwareFile; int updateVersion = ExtractFirmwareUpdateVersion(firmwareFile, out isValidFirmwareFile); string title = string.Empty; var dialogButtons = OSMessageBoxButton.YesNo; var icon = OSMessageBoxIcon.Question; var updateMode = FirmwareUpdateMode.None; var flags = (updateVersion == currentVersion) ? 0 : FirmwareRevisions.SecondaryMask; if (firmwareRevisions.Secondary != FirmwareRevisions.UnavailableFirmwareVersion) { var secondaryVersion = firmwareRevisions.Secondary & ~FirmwareRevisions.SecondaryMask; if (updateVersion == secondaryVersion) { updateMode = FirmwareUpdateMode.ReapplySecondary; } else if (updateVersion == primaryVersion) { updateMode = FirmwareUpdateMode.RevertToPrimary; } else if (updateVersion > secondaryVersion) { updateMode = FirmwareUpdateMode.UpgradeSecondary; } else if (updateVersion < secondaryVersion) { updateMode = FirmwareUpdateMode.DowngradeSecondary; } } else { // No secondary firmware -- still running primary. if (updateVersion > primaryVersion) { updateMode = FirmwareUpdateMode.UpgradeSecondary; } else if (updateVersion < primaryVersion) { updateMode = FirmwareUpdateMode.DowngradeSecondary; } ////else // proposed update is same as primary, so do nothing } var currentVersionString = FirmwareRevisions.FirmwareVersionToString(firmwareRevisions.Current, false); var updateVersionString = FirmwareRevisions.FirmwareVersionToString(updateVersion | flags, false); switch (updateMode) { case FirmwareUpdateMode.None: title = Resources.Strings.FirmwareUpdate_SameAsFactory_Title; message = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.FirmwareUpdate_SameAsFactory_Message, currentVersionString); icon = OSMessageBoxIcon.Information; dialogButtons = OSMessageBoxButton.OK; break; case FirmwareUpdateMode.UpgradeSecondary: flags |= FirmwareRevisions.SecondaryMask; title = Resources.Strings.FirmwareUpdate_Title; message = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.FirmwareUpdate_MessageFormat, currentVersionString, updateVersionString); icon = OSMessageBoxIcon.Question; break; case FirmwareUpdateMode.DowngradeSecondary: flags |= FirmwareRevisions.SecondaryMask; title = Resources.Strings.FirmwareUpdate_Downgrade_Title; message = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.FirmwareUpdate_Downgrade_MessageFormat, currentVersionString, updateVersionString); icon = OSMessageBoxIcon.Exclamation; break; case FirmwareUpdateMode.ReapplySecondary: flags |= FirmwareRevisions.SecondaryMask; title = Resources.Strings.FirmwareUpdate_Reapply_Title; message = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.FirmwareUpdate_Reapply_Message, currentVersionString); break; case FirmwareUpdateMode.RevertToPrimary: title = Resources.Strings.FirmwareRestore_Title; message = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.FirmwareUpdate_SameAsFactoryRestore_Message, FirmwareRevisions.FirmwareVersionToString(firmwareRevisions.Primary, false)); break; } if (!string.IsNullOrEmpty(additionalMessagePrefix)) { message = additionalMessagePrefix + System.Environment.NewLine + System.Environment.NewLine + message; } if (!string.IsNullOrEmpty(additionalMessageSuffix)) { message += System.Environment.NewLine + System.Environment.NewLine + additionalMessageSuffix; } var warningDialogResult = OSMessageBoxResult.No; try { SingleInstanceApplication.Instance.IsBusy = true; warningDialogResult = OSMessageBox.Show(message, title, dialogButtons, icon, OSMessageBoxResult.No); } finally { SingleInstanceApplication.Instance.IsBusy = false; } if (warningDialogResult == OSMessageBoxResult.Yes) { // Actually apply the firmware update! if (updateMode == FirmwareUpdateMode.RevertToPrimary) { device.RemoveSecondaryFirmware(FirmwareRestoreCompleteHandler, (m, e) => ErrorHandler(Model.Commands.ProtocolCommandId.FirmwareEraseSecondary, m, e)); } else { device.UpdateFirmware(firmwareFile, updateVersion | flags, (c, p, r) => FirmwareUpdateCompleteHandler(c, p, r, firmwareFile), (m, e) => ErrorHandler(Model.Commands.ProtocolCommandId.FirmwareProgramSecondary, m, e)); } } }
private static void OnSelectEmulatorFile(object parameter, EmulatorFile whichFile) { var viewModel = parameter as JzIntvSettingsPageViewModel; var selectionPrompt = string.Empty; switch (whichFile) { case EmulatorFile.JzIntv: selectionPrompt = Resources.Strings.Locate_jzIntv_Prompt; break; case EmulatorFile.Exec: selectionPrompt = Resources.Strings.Locate_EXEC_Prompt; break; case EmulatorFile.Grom: selectionPrompt = Resources.Strings.Locate_GROM_Prompt; break; case EmulatorFile.Ecs: selectionPrompt = Resources.Strings.Locate_ECS_Prompt; break; case EmulatorFile.KeyboardConfig: selectionPrompt = Resources.Strings.Select_Hackfile_Prompt; break; case EmulatorFile.Cgc0Config: selectionPrompt = Resources.Strings.Select_CGC_Console_Prompt; break; case EmulatorFile.Cgc1Config: selectionPrompt = Resources.Strings.Select_CGC_ECS_Prompt; break; default: break; } if (!string.IsNullOrEmpty(selectionPrompt)) { var browser = FileDialogHelpers.Create(); browser.EnsureFileExists = true; browser.Title = selectionPrompt; if ((whichFile == EmulatorFile.JzIntv) && !string.IsNullOrEmpty(PathUtils.ProgramSuffix)) { browser.AddFilter("jzIntv", new[] { PathUtils.ProgramSuffix }); } var result = browser.ShowDialog(); if (result == FileBrowserDialogResult.Ok) { var path = PathUtils.ResolvePathForSettings(browser.FileNames.First()); switch (whichFile) { case EmulatorFile.JzIntv: viewModel.EmulatorPath = path; break; case EmulatorFile.Exec: viewModel.ExecRomPath = path; break; case EmulatorFile.Grom: viewModel.GromRomPath = path; break; case EmulatorFile.Ecs: viewModel.EcsRomPath = path; break; case EmulatorFile.KeyboardConfig: viewModel.DefaultKeyboardConfigPath = path; break; case EmulatorFile.Cgc0Config: viewModel.JzIntvCgc0ConfigPath = path; break; case EmulatorFile.Cgc1Config: viewModel.JzIntvCgc1ConfigPath = path; break; default: break; } } } else { OSMessageBox.Show(string.Format(Resources.Strings.ConfigurationFile_UnknownSelection_Error_Message_Format, whichFile), Resources.Strings.ConfigurationFile_UnknownSelection_Error_Title); } }
private static void OnDownloadError(string message, Exception exception) { OSMessageBox.Show(message, Resources.Strings.DownloadCommandErrorMessage_Title, SingleInstanceApplication.SharedSettings.ShowDetailedErrors ? exception : null, null); }