Exemplo n.º 1
0
        private static void ValidateRoms(object parameter)
        {
            var romListViewModel = parameter as RomListViewModel;

            if (romListViewModel != null)
            {
                var validateRomsTask = new AsyncTaskWithProgress("ValidateRoms", false, false);
                validateRomsTask.UpdateTaskTitle(Resources.Strings.ValidateRomsCommand_ProgressTitle);
                var validateRomsTaskData = new ValidateRomsTaskData(validateRomsTask, romListViewModel);
                validateRomsTask.RunTask(validateRomsTaskData, ValidateRoms, ValidateRomsComplete);
            }
        }
Exemplo n.º 2
0
 private static void OnCheckForUpdates(object parameter)
 {
     if (CanCheckForUpdates(parameter))
     {
         var checkingAtStartup = false;
         if ((parameter != null) && (parameter.GetType() == typeof(bool)))
         {
             checkingAtStartup = (bool)parameter;
         }
         var checkForUpdatesTask = new AsyncTaskWithProgress("CheckForUpdates", false, true, !checkingAtStartup, 2);
         checkForUpdatesTask.UpdateTaskTitle(CheckForUpdatesCommand.Name);
         var checkForUpdatesTaskData = new CheckForUpdatesTaskData(checkForUpdatesTask, checkingAtStartup);
         checkForUpdatesTask.RunTask(checkForUpdatesTaskData, CheckForUpdates, CheckForUpdatesComplete);
     }
 }
Exemplo n.º 3
0
        private static void OnRestoreRomList(object parameter)
        {
            var configuration = INTV.Shared.Model.RomListConfiguration.Instance;
            var message       = Resources.Strings.RestoreRomListCommand_Message;
            var title         = Resources.Strings.RestoreRomListCommand_MessageTitle;
            var doRestore     = OSMessageBox.Show(message, title, OSMessageBoxButton.YesNo, OSMessageBoxIcon.Exclamation);

            if (doRestore == OSMessageBoxResult.Yes)
            {
                var backupDirectory    = configuration.BackupDataDirectory;
                var backupFileName     = INTV.Shared.Model.RomListConfiguration.Instance.DefaultRomsFileName;
                var selectBackupDialog = SelectBackupDialog.Create(backupDirectory, backupFileName, null, false);
                selectBackupDialog.Title = Resources.Strings.RestoreRomListCommand_SelectBackupTitle;
                var doRestoreResult = selectBackupDialog.ShowDialog();
                if (doRestoreResult == true)
                {
                    var romsConfiguration = INTV.Shared.Model.RomListConfiguration.Instance;
                    var backupRomListFile = System.IO.Path.Combine(selectBackupDialog.SelectedBackupDirectory, romsConfiguration.DefaultRomsFileName);
                    var romsFileExists    = System.IO.File.Exists(backupRomListFile);
                    if (romsFileExists)
                    {
                        var restoreRomListTask = new AsyncTaskWithProgress("RestoreRomList", false, true, 0);
                        restoreRomListTask.UpdateTaskTitle(Resources.Strings.RestoreRomListCommand_MessageTitle);
                        var restoreMenuLayoutTaskData = new RestoreRomListTaskData(restoreRomListTask, backupRomListFile, parameter as RomListViewModel);
                        restoreRomListTask.RunTask(restoreMenuLayoutTaskData, RestoreRomList, RestoreRomListComplete);
                    }
                    else
                    {
                        var errorMessage = new System.Text.StringBuilder(Resources.Strings.RestoreRomListCommand_MissingFileErrorMessage).AppendLine().AppendLine();
                        errorMessage.AppendLine(selectBackupDialog.SelectedBackupDirectory).AppendLine();
                        if (!romsFileExists)
                        {
                            errorMessage.AppendLine(romsConfiguration.DefaultRomsFileName);
                        }
                        message = errorMessage.ToString();
                        title   = Resources.Strings.RestoreRomListCommand_MissingFileErrorTitle;
                        OSMessageBox.Show(message, title, 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);
                }
            }
        }