Пример #1
0
        /**
         * Handles the start migration button's functionality.
         */
        public static void StartMigrationHandler()
        {
            string isStarted = SettingsHandler.GetSetting("started");

            if (isStarted.Equals("1"))
            {
                if (HistoryHandler.RevertChanges())
                {
                    SettingsHandler.SetSetting("started", "0");
                    startMigrateButton.Text = START_MIGRATION_TEXT;
                    EnableMigrationCombos();
                    StopSpecialAddonListeners();
                }
                else
                {
                    MessageBox.Show("An error has occured, please try again or contact the developer for support.");
                }
            }
            else
            {
                DisableMigrationCombos();

                if (!FileListeners.InitStaticListeners())
                {
                    HistoryHandler.RevertChanges();
                    MessageBox.Show("An error has occured, please try again or contact the developer for support.");
                    EnableMigrationCombos();

                    return;
                }

                if (!RegistryHandler.SetSourceAsTarget())
                {
                    FileListeners.RemoveListeners();
                    HistoryHandler.RevertChanges();
                    MessageBox.Show("An error has occured, please try again or contact the developer for support.");
                    EnableMigrationCombos();

                    return;
                }

                StartSpecialAddonListeners();

                FilesHandler.CreateFakeFsxExecutable(GetSelectedTargetSimulator().GetSimPath());

                startMigrateButton.Text = STOP_MIGRATION_TEXT;
                SettingsHandler.SetSetting("started", "1");
            }
        }