Example #1
0
        private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
        {
            int max;

            if (!int.TryParse(MaxDepth.Text, out max))
            {
                max = -1;
            }

            if (_editing == null)
            {
                _settings.ProgramSources.Add(new ProgramSource
                {
                    Location = Directory.Text,
                    MaxDepth = max,
                    Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator),
                    Type     = "FileSystemProgramSource",
                    Enabled  = true
                });
            }
            else
            {
                _editing.Location = Directory.Text;
                _editing.MaxDepth = max;
                _editing.Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator);
            }

            _settings.Save();
            DialogResult = true;
            Close();
        }
Example #2
0
        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);
                    _settings.Save();
                    ReIndexing();
                }
            }
            else
            {
                string msg = context.API.GetTranslation("wox_plugin_program_pls_select_program_source");
                MessageBox.Show(msg);
            }
        }