コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: AddProgramSource.xaml.cs プロジェクト: znatz/Wox
        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();
        }
コード例 #3
0
ファイル: AddProgramSource.xaml.cs プロジェクト: dylandee/Wox
 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;
 }
コード例 #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();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
ファイル: AddProgramSource.xaml.cs プロジェクト: WELL-E/Wox
 public AddProgramSource(ProgramSource edit) : this()
 {
     _editing = edit;
     Directory.Text = _editing.Location;
     MaxDepth.Text = _editing.MaxDepth.ToString();
     Suffixes.Text = _editing.Suffixes;
 }
コード例 #7
0
ファイル: AddProgramSource.xaml.cs プロジェクト: wuxingya/Wox
 public AddProgramSource(ProgramSource edit) : this()
 {
     _editing       = edit;
     Directory.Text = _editing.Location;
     MaxDepth.Text  = _editing.MaxDepth.ToString();
     Suffixes.Text  = _editing.Suffixes;
 }
コード例 #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;
 }
コード例 #9
0
        public AddProgramSource(ProgramSource edit, Settings settings)
        {
            _editing  = edit;
            _settings = settings;

            InitializeComponent();
            Directory.Text = _editing.Location;
        }
コード例 #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();
 }
コード例 #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);
        }
コード例 #12
0
ファイル: ProgramSetting.xaml.cs プロジェクト: wuxingya/Wox
        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);
            }
        }
コード例 #13
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);
                    ReIndexing();
                }
            }
            else
            {
                string msg = context.API.GetTranslation("wox_plugin_program_pls_select_program_source");
                MessageBox.Show(msg);
            }
        }