/// <summary> /// Opens a a folder picker dialog with the path in "getter" preselected and /// if OK is returned uses "setter" to set the path /// </summary> public void ShowFolderBrowserDialogWithPreselectedPath(Func <string> getter, Action <string> setter) { string directoryInfoPath = null; try { directoryInfoPath = new DirectoryInfo(getter()).FullName; } catch { // since the DirectoryInfo stuff is for convenience we swallow exceptions } // if we do not use the DirectoryInfo then a path with slashes instead of backslashes won't work if (directoryInfoPath == null) { directoryInfoPath = getter(); } // TODO: do we need ParentForm or is "this" ok? var userSelectedPath = OsShellUtil.PickFolder(ParentForm, directoryInfoPath); if (userSelectedPath != null) { setter(userSelectedPath); } }
private void otherHomeBrowse_Click(object sender, EventArgs e) { var userSelectedPath = OsShellUtil.PickFolder(this, Environment.GetEnvironmentVariable("USERPROFILE")); if (userSelectedPath != null) { otherHomeDir.Text = userSelectedPath; } }
private void BrowseClick(object sender, EventArgs e) { var userSelectedPath = OsShellUtil.PickFolder(this); if (userSelectedPath != null) { Directory.Text = userSelectedPath; } }
private void browseButton_Click(object sender, EventArgs e) { var userSelectedPath = OsShellUtil.PickFolder(this, this._NO_TRANSLATE_destinationComboBox.Text); if (userSelectedPath != null) { this._NO_TRANSLATE_destinationComboBox.Text = userSelectedPath; } }
private void DefaultCloneDestinationBrowseClick(object sender, EventArgs e) { var userSelectedPath = OsShellUtil.PickFolder(this, cbDefaultCloneDestination.Text); if (userSelectedPath != null) { cbDefaultCloneDestination.Text = userSelectedPath; } }
private void Browse_Click(object sender, EventArgs e) { var userSelectedPath = OsShellUtil.PickFolder(this); if (userSelectedPath is not null) { OutputPath.Text = userSelectedPath; } }
private void folderBrowserButton_Click(object sender, EventArgs e) { string userSelectedPath = OsShellUtil.PickFolder(this, _NO_TRANSLATE_Directory.Text); if (!string.IsNullOrEmpty(userSelectedPath)) { _NO_TRANSLATE_Directory.Text = userSelectedPath; Load.PerformClick(); } }
private void ToBrowseClick(object sender, EventArgs e) { var userSelectedPath = OsShellUtil.PickFolder(this, _NO_TRANSLATE_To.Text); if (userSelectedPath != null) { _NO_TRANSLATE_To.Text = userSelectedPath; } ToTextUpdate(sender, e); }
private void BrowseGitBinPath_Click(object sender, EventArgs e) { CheckSettingsLogic.SolveLinuxToolsDir(GitBinPath.Text.Trim()); var userSelectedPath = OsShellUtil.PickFolder(this, AppSettings.GitBinDir); if (userSelectedPath != null) { GitBinPath.Text = userSelectedPath; } }
private void FromBrowseClick(object sender, EventArgs e) { var userSelectedPath = OsShellUtil.PickFolder(this, _NO_TRANSLATE_From.Text); if (userSelectedPath is not null) { _NO_TRANSLATE_From.Text = userSelectedPath; } FromTextUpdate(sender, e); }
private void _browseForCloneToDirbtn_Click(object sender, EventArgs e) { var initialDir = destinationTB.Text.Length > 0 ? destinationTB.Text : "C:\\"; var userSelectedPath = OsShellUtil.PickFolder(this, initialDir); if (userSelectedPath != null) { destinationTB.Text = userSelectedPath; _destinationTB_TextChanged(sender, e); } }