private void PathBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (!IsConnection || string.IsNullOrEmpty(NowBucket))
            {
                return;
            }

            if (e.KeyCode == Keys.Return)
            {
                var path = PathBox.Text;
                if (!path.EndsWith("/"))
                {
                    path += "/";
                }
                var checkDir = new ObjectStorageDirectoryInfo(OciResources.GetObjectStorageClient(), NameSpaceName, NowBucket, path);
                if (checkDir.Exists)
                {
                    SetPath(path);
                    SetDir(path);
                }
                else
                {
                    DialogManagement.ShowMessageDialog("エラー", $"{path} が見つかりませんでした", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    PathBox.SelectAll();
                }
            }
        }
Exemple #2
0
        private void SetDirButton_Click(object sender, RoutedEventArgs e)
        {
            var index = PathBox.SelectedIndex;

            if (index == -1)
            {
                return;
            }

            var fbd    = new System.Windows.Forms.FolderBrowserDialog();
            var result = fbd.ShowDialog();

            if (result != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            string dir = fbd.SelectedPath;

            if (!Directory.Exists(dir))
            {
                return;
            }

            Items[index].Path = dir;
            PathBox.Focus();
        }
Exemple #3
0
        void SelectPath(object sender, RoutedEventArgs e)
        {
            dynamic ai;

            if (isFullBox)
            {
                ai = (Addin)DataContext;
            }
            else
            {
                ai = (GlobalAddin)DataContext;
            }

            if (!String.IsNullOrWhiteSpace(ai.Path))
            {
                initialFolder = Path.GetDirectoryName(ai.Path);
            }

            var ofd = new OpenFileDialog {
                DereferenceLinks = true,
                Filter           = "Add-ins (*.xlam;*.xla;*.xll)|*.xlam;*.xla;*.xll|Excel Files (*.xls*)|*.xls*|All files (*.*)|*.*",
                FilterIndex      = index,
                InitialDirectory = initialFolder,
                Title            = "Select file"
            };

            if (ofd.ShowDialog(this) == false)
            {
                return;
            }

            index   = ofd.FilterIndex;
            ai.Path = ofd.FileName;

            if (isFullBox)
            {
                if (Path.GetExtension(ai.Path).Equals(".XLL", StringComparison.OrdinalIgnoreCase))
                {
                    ai.Arch = Configuration.Instance.LocalSettings.ExcelArch.ToString();
                }
                else
                {
                    ai.Arch = Addin.ANY;
                }

                ArchBox.GetBindingExpression(ComboBox.SelectedItemProperty).UpdateTarget();
            }

            PathBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
            PathBox.Focus();
        }
Exemple #4
0
 void BrowseClick(object sender, EventArgs e)
 {
     try
     {
         DialogResult Result = this.Browser.ShowDialog();
         if (Result == DialogResult.OK)
         {
             CurrentDirectory = Browser.SelectedPath;
             PathBox.Clear();
             PathBox.Paste(Browser.SelectedPath);
         }
     }
     catch (Exception E) { MessageBox.Show(E.Message); }
 }
Exemple #5
0
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     PathReader.SavePathToRegistry(PathType, PathReader.ItemsToPathString(Items));
     if (PathType == PathType.User)
     {
         PathReader.SavePathToRegistry(PathType, PathReader.ItemsToPathString(Items));
     }
     else
     {
         BatchMode.UseBatchModeAsAdmin(Items);
     }
     DisabledItems.SaveDisabledItems(PathType, Items);
     PathBox.Focus();
 }
Exemple #6
0
        void OnDragDrop(object sender, DragEventArgs e)
        {
            try
            {
                string[] FileDrop = (string[])e.Data.GetData(DataFormats.FileDrop);

                if (Directory.Exists(FileDrop[0]))
                {
                    PathBox.Clear();
                    PathBox.Paste(FileDrop[0]);
                    CurrentDirectory = FileDrop[0];
                }
            }
            catch (Exception E) { MessageBox.Show(E.Message); }
        }
Exemple #7
0
 private async void GetFile()
 {
     try {
         if (string.IsNullOrEmpty(state.FilePath.Trim()))
         {
             PathBox.Focus();
             throw new Exception("请输入路径");
         }
         await Task.Run(() =>
         {
             state.IsEnabled = false;
             GetFileList(state.FilePath);
         });
     } catch (Exception ex) {
         ShowMessage(ex.Message);
     } finally {
         state.IsEnabled = true;
     }
 }
Exemple #8
0
 void ContextClick(object sender, ToolStripItemClickedEventArgs e)
 {
     PathBox.Clear();
     PathBox.Paste(e.ClickedItem.Text);
     CurrentDirectory = e.ClickedItem.Text;
 }
Exemple #9
0
 private void Button67_Click(object sender, EventArgs e)
 {
     path = @"" + PathBox.Text + @"\ReviewsAndComment.txt";
     PathBox.Clear();
 }
Exemple #10
0
 private void SetItemFocus(int index)
 {
     PathBox.SelectedIndex = index;
     PathBox.ScrollIntoView(Items[index]);
     PathBox.Focus();
 }