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(); } } }
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(); }
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(); }
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); } }
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(); }
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); } }
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; } }
void ContextClick(object sender, ToolStripItemClickedEventArgs e) { PathBox.Clear(); PathBox.Paste(e.ClickedItem.Text); CurrentDirectory = e.ClickedItem.Text; }
private void Button67_Click(object sender, EventArgs e) { path = @"" + PathBox.Text + @"\ReviewsAndComment.txt"; PathBox.Clear(); }
private void SetItemFocus(int index) { PathBox.SelectedIndex = index; PathBox.ScrollIntoView(Items[index]); PathBox.Focus(); }