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();
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 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;
 }
Beispiel #4
0
        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();
        }
Beispiel #6
0
 public AddProgramSource(ProgramSource edit) : this()
 {
     _editing = edit;
     Directory.Text = _editing.Location;
     MaxDepth.Text = _editing.MaxDepth.ToString();
     Suffixes.Text = _editing.Suffixes;
 }
Beispiel #7
0
 public AddProgramSource(ProgramSource edit) : this()
 {
     _editing       = edit;
     Directory.Text = _editing.Location;
     MaxDepth.Text  = _editing.MaxDepth.ToString();
     Suffixes.Text  = _editing.Suffixes;
 }
Beispiel #8
0
 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;
 }
        public AddProgramSource(ProgramSource edit, Settings settings)
        {
            _editing  = edit;
            _settings = settings;

            InitializeComponent();
            Directory.Text = _editing.Location;
        }
Beispiel #10
0
 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();
 }
Beispiel #11
0
        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);
        }
Beispiel #12
0
        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);
            }
        }