private void ButtonAdd_OnClick(object sender, RoutedEventArgs e) { string s = Environment.ExpandEnvironmentVariables(Directory.Text); if (!System.IO.Directory.Exists(s)) { System.Windows.MessageBox.Show(_context.API.GetTranslation("wox_plugin_program_invalid_path")); return; } if (_editing == null) { var source = new ProgramSource { Location = Directory.Text, }; _settings.ProgramSources.Insert(0, source); } else { _editing.Location = Directory.Text; } DialogResult = true; Close(); }
private void ButtonAdd_OnClick(object sender, RoutedEventArgs e) { int max; if (!int.TryParse(MaxDepth.Text, out max)) { max = -1; } if (_editing == null) { var source = new ProgramSource { Location = Directory.Text, MaxDepth = max, Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator), Type = "FileSystemProgramSource", Enabled = true }; _settings.ProgramSources.Add(source); } else { _editing.Location = Directory.Text; _editing.MaxDepth = max; _editing.Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator); } DialogResult = true; Close(); }
public AddProgramSource(ProgramSource edit) : this() { this._editing = edit; this.Directory.Text = this._editing.Location; this.MaxDepth.Text = this._editing.MaxDepth.ToString(); this.Suffixes.Text = this._editing.Suffixes; }
private void ButtonAdd_OnClick(object sender, RoutedEventArgs e) { int max; if(!int.TryParse(MaxDepth.Text, out max)) { max = -1; } if(_editing == null) { var source = new ProgramSource { Location = Directory.Text, MaxDepth = max, Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator), Type = "FileSystemProgramSource", Enabled = true }; _settings.ProgramSources.Add(source); } else { _editing.Location = Directory.Text; _editing.MaxDepth = max; _editing.Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator); } DialogResult = true; Close(); }
private void ButtonAdd_OnClick(object sender, RoutedEventArgs e) { string s = Directory.Text; if (!System.IO.Directory.Exists(s)) { System.Windows.MessageBox.Show(_context.API.GetTranslation("wox_plugin_program_invalid_path")); return; } if (_editing == null) { if (!ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == Directory.Text)) { var source = new ProgramSource { Location = Directory.Text, UniqueIdentifier = Directory.Text }; _settings.ProgramSources.Insert(0, source); ProgramSetting.ProgramSettingDisplayList.Add(source); } } else { _editing.Location = Directory.Text; } DialogResult = true; Close(); }
public AddProgramSource(ProgramSource edit) : this() { _editing = edit; Directory.Text = _editing.Location; MaxDepth.Text = _editing.MaxDepth.ToString(); Suffixes.Text = _editing.Suffixes; }
public AddProgramSource(ProgramSource edit, Settings settings) { _editing = edit; _settings = settings; InitializeComponent(); Directory.Text = _editing.Location; }
public AddProgramSource(ProgramSource edit, ProgramStorage settings) { _editing = edit; Directory.Text = _editing.Location; MaxDepth.Text = _editing.MaxDepth.ToString(); Suffixes.Text = string.Join(";", _editing.Suffixes); _settings = settings; InitializeComponent(); }
public AddProgramSource(ProgramSource edit, Settings settings) { _editing = edit; _settings = settings; InitializeComponent(); Directory.Text = _editing.Location; MaxDepth.Text = _editing.MaxDepth.ToString(); Suffixes.Text = string.Join(";", _editing.Suffixes); }
private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e) { ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource; if (selectedProgramSource != null) { var add = new AddProgramSource(selectedProgramSource); if (add.ShowDialog() ?? false) { ReIndexing(); } } else { string msg = context.API.GetTranslation("wox_plugin_program_pls_select_program_source"); MessageBox.Show(msg); } }
private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e) { ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource; if (selectedProgramSource != null) { string msg = string.Format(context.API.GetTranslation("wox_plugin_program_delete_program_source"), selectedProgramSource.Location); if (MessageBox.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { _settings.ProgramSources.Remove(selectedProgramSource); ReIndexing(); } } else { string msg = context.API.GetTranslation("wox_plugin_program_pls_select_program_source"); MessageBox.Show(msg); } }