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; } }
public ImportEventArgs(ConfigAndGestures confAndGest, ImportOption gestImpOpt, ImportOption confImpOpt) { Success = true; ConfigAndGestures = confAndGest; GesturesImportOption = gestImpOpt; ConfigImportOption = confImpOpt; }
public static ConfigAndGestures Combine(ConfigAndGestures old, ConfigAndGestures current, MergeOption mergeOption) { var config = null as PlistConfig; var gestures = null as JsonGestureIntentStore; if (MergeOption.Config == (mergeOption & MergeOption.Config)) { config = new PlistConfig(); //旧的应该覆盖新的 config.Import(current.Config, old.Config); } if (MergeOption.Gestures == (mergeOption & MergeOption.Gestures)) { gestures = current.GestureIntentStore.Clone(); gestures.Import(old.GestureIntentStore); } return(new ConfigAndGestures(config, gestures)); }
public static ConfigAndGestures Combine(ConfigAndGestures old, ConfigAndGestures current, MergeOption mergeOption) { var config = null as PlistConfig; var gestures = null as JsonGestureIntentStore; if (MergeOption.Config == (mergeOption & MergeOption.Config)) { config = new PlistConfig(); //旧的应该覆盖新的 config.Import(current.Config, old.Config); } if (MergeOption.Gestures == (mergeOption & MergeOption.Gestures)) { gestures = current.GestureIntentStore.Clone(); gestures.Import(old.GestureIntentStore); } return new ConfigAndGestures(config, gestures); }
internal void Import(ConfigAndGestures configAndGestures, bool importConfig, bool importGestures, bool mergeGestures) { //config 必然是合并 if (importConfig) { _config.Import(configAndGestures.Config); ReApplyConfig(); } if (importGestures) { _intentStore.Import(configAndGestures.GestureIntentStore, replace: !mergeGestures); OnPropertyChanged("IntentStore"); } }