/// <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);
            }
        }
예제 #2
0
        private void otherHomeBrowse_Click(object sender, EventArgs e)
        {
            var userSelectedPath = OsShellUtil.PickFolder(this, Environment.GetEnvironmentVariable("USERPROFILE"));

            if (userSelectedPath != null)
            {
                otherHomeDir.Text = userSelectedPath;
            }
        }
예제 #3
0
        private void BrowseClick(object sender, EventArgs e)
        {
            var userSelectedPath = OsShellUtil.PickFolder(this);

            if (userSelectedPath != null)
            {
                Directory.Text = userSelectedPath;
            }
        }
예제 #4
0
        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;
            }
        }
예제 #5
0
        private void DefaultCloneDestinationBrowseClick(object sender, EventArgs e)
        {
            var userSelectedPath = OsShellUtil.PickFolder(this, cbDefaultCloneDestination.Text);

            if (userSelectedPath != null)
            {
                cbDefaultCloneDestination.Text = userSelectedPath;
            }
        }
예제 #6
0
        private void Browse_Click(object sender, EventArgs e)
        {
            var userSelectedPath = OsShellUtil.PickFolder(this);

            if (userSelectedPath is not null)
            {
                OutputPath.Text = userSelectedPath;
            }
        }
예제 #7
0
        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();
            }
        }
예제 #8
0
        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);
        }
예제 #9
0
        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;
            }
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
            }
        }