Пример #1
0
        private void btn_selectWgb_Click(object sender, EventArgs e)
        {
            var result = openFile_wgb.ShowDialog();

            if (result == DialogResult.OK)
            {
                _filePath = openFile_wgb.FileName;
                HideError();


                try
                {
                    _configAndGestures = MigrateService.Import(_filePath);
                }
                catch (MigrateException ex)
                {
                    ShowError(ex.Message);
                    return;
                }

                var containsGestures = _configAndGestures.GestureIntentStore != null;
                var containsConfig   = _configAndGestures.Config != null;

                check_importGestures.Checked = containsGestures;
                check_importGestures.Enabled = containsGestures;

                check_importConfig.Checked = containsConfig;
                check_importConfig.Enabled = containsConfig;

                txt_filePath.Text           = _filePath;
                group_importOptions.Visible = true;
            }
        }
Пример #2
0
 public SwiperMigrator(IProjectService projectService,
                       IChallengeService challengeService,
                       MigrateService migrateService,
                       UserService userService,
                       ILogger <SwiperMigrator> logger,
                       IOptions <StorageConfig> storageConfig,
                       IOptions <MigrationConfig> migrationConfig)
 {
     this.projectService   = projectService;
     this.challengeService = challengeService;
     this.migrateService   = migrateService;
     this.userService      = userService;
     this.storageConfig    = storageConfig.Value;
     this.migrationConfig  = migrationConfig.Value;
     _logger = logger;
 }
Пример #3
0
        private static void ImportPrevousVersion()
        {
            try
            {
                //导入先前版本
                var prevConfigAndGestures = MigrateService.ImportPrevousVersion();
                if (prevConfigAndGestures == null)
                {
                    return;
                }

                intentStore.Import(prevConfigAndGestures.GestureIntentStore);
                config.Import(prevConfigAndGestures.Config);

                intentStore.Save();
            }
            catch (MigrateException e)
            {
                //ignore
#if DEBUG
                throw;
#endif
            }
        }
Пример #4
0
 internal void RestoreDefaultGestures()
 {
     _intentStore.Import(MigrateService.Import(AppSettings.DefaultGesturesFilePath).GestureIntentStore, replace: true);
     OnPropertyChanged("IntentStore");
 }
Пример #5
0
 internal void ExportTo(string filePath)
 {
     MigrateService.ExportTo(filePath);
 }