private void openFileWithToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var fileName = SaveSelectedItemToTempFile();

            if (fileName != null)
            {
                OsShellUtil.OpenAs(fileName);
            }
        }
Esempio n. 2
0
        private void Browse_Click(object sender, EventArgs e)
        {
            var userSelectedPath = OsShellUtil.PickFolder(this);

            if (userSelectedPath != null)
            {
                OutputPath.Text = userSelectedPath;
            }
        }
Esempio n. 3
0
        private void DefaultCloneDestinationBrowseClick(object sender, EventArgs e)
        {
            var userSelectedPath = OsShellUtil.PickFolder(this, cbDefaultCloneDestination.Text);

            if (userSelectedPath != null)
            {
                cbDefaultCloneDestination.Text = userSelectedPath;
            }
        }
        private void BrowseClick(object sender, EventArgs e)
        {
            var userSelectedPath = OsShellUtil.PickFolder(this, Directory.Text);

            if (userSelectedPath != null)
            {
                Directory.Text = userSelectedPath;
            }
        }
            public void OpenRemoteUrlInBrowser()
            {
                if (!IsRemoteUrlUsingHttp)
                {
                    return;
                }

                OsShellUtil.OpenUrlInDefaultBrowser(_remote.FetchUrl);
            }
Esempio n. 6
0
        private void otherHomeBrowse_Click(object sender, EventArgs e)
        {
            var userSelectedPath = OsShellUtil.PickFolder(this, Environment.GetEnvironmentVariable("USERPROFILE"));

            if (userSelectedPath != null)
            {
                otherHomeDir.Text = userSelectedPath;
            }
        }
Esempio n. 7
0
        private void BrowseClick(object sender, EventArgs e)
        {
            var userSelectedPath = OsShellUtil.PickFolder(this);

            if (userSelectedPath is not null)
            {
                _NO_TRANSLATE_Directory.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();
            }
        }
 public static void ShowFileOrFolderInFileExplorer(string path)
 {
     if (File.Exists(path))
     {
         OsShellUtil.SelectPathInFileExplorer(path);
     }
     else if (Directory.Exists(path))
     {
         OsShellUtil.OpenWithFileExplorer(path);
     }
 }
Esempio n. 10
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;
            }
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
 private void openWithToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (tvGitTree.SelectedNode?.Tag is GitItem gitItem && gitItem.ObjectType == GitObjectType.Blob)
     {
         var fileName = _fullPathResolver.Resolve(gitItem.FileName);
         if (File.Exists(fileName))
         {
             OsShellUtil.OpenAs(fileName.ToNativePath());
         }
     }
 }
Esempio n. 13
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);
        }
Esempio n. 14
0
        private void diffOpenWorkingDirectoryFileWithToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (DiffFiles.SelectedItem == null)
            {
                return;
            }

            var fileName = _fullPathResolver.Resolve(DiffFiles.SelectedItem.Name);

            OsShellUtil.OpenAs(fileName.ToNativePath());
        }
        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);
            }
        }
Esempio n. 16
0
        public static void ShowFileOrParentFolderInFileExplorer(string path)
        {
            var fileInfo = new FileInfo(path);

            if (fileInfo.Exists)
            {
                OsShellUtil.SelectPathInFileExplorer(fileInfo.FullName);
            }
            else if (fileInfo.Directory.Exists)
            {
                OsShellUtil.OpenWithFileExplorer(fileInfo.Directory.FullName);
            }
        }
 public static void ShowFileOrParentFolderInFileExplorer(string path)
 {
     if (File.Exists(path))
     {
         FileInfo fileInfo = new(path);
         OsShellUtil.SelectPathInFileExplorer(fileInfo.FullName);
     }
     else if (Directory.Exists(path))
     {
         FileInfo fileInfo = new(path);
         OsShellUtil.OpenWithFileExplorer(fileInfo.Directory.FullName);
     }
 }
Esempio n. 18
0
        private void LaunchUrl(LaunchType launchType)
        {
            switch (launchType)
            {
            case LaunchType.ChangeLog:
                OsShellUtil.OpenUrlInDefaultBrowser(@"https://github.com/gitextensions/gitextensions/blob/master/GitUI/Resources/ChangeLog.md");
                break;

            case LaunchType.DirectDownload:
                OsShellUtil.OpenUrlInDefaultBrowser(UpdateUrl);
                break;
            }
        }
Esempio n. 19
0
        private void openWithToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var gitItem = tvGitTree.SelectedNode?.Tag as GitItem;

            if (gitItem == null || gitItem.ObjectType != GitObjectType.Blob)
            {
                return;
            }

            var fileName = Path.Combine(Module.WorkingDir, gitItem.FileName);

            OsShellUtil.OpenAs(fileName.ToNativePath());
        }
        }                                            // for focusing

        public BuildReportTabPageExtension(Func <IGitModule> getModule, TabControl tabControl, string caption)
        {
            _getModule  = getModule;
            _tabControl = tabControl;
            _caption    = caption;

            _openReportLink.Click += (o, args) =>
            {
                if (!string.IsNullOrWhiteSpace(_url))
                {
                    OsShellUtil.OpenUrlInDefaultBrowser(_url);
                }
            };
            _openReportLink.Font = new Font(_openReportLink.Font.Name, 16F);
        }
        private void OpenSideWith(string side)
        {
            Cursor.Current = Cursors.WaitCursor;
            var conflictData = GetConflict();
            string fileName = conflictData.Filename;
            fileName = PathUtil.GetFileName(fileName);

            fileName = Path.GetTempPath() + fileName;

            if (!Module.HandleConflictsSaveSide(conflictData.Filename, fileName, side))
                MessageBox.Show(this, _failureWhileOpenFile.Text);

            OsShellUtil.OpenAs(fileName);
            Cursor.Current = Cursors.Default;
        }
Esempio n. 22
0
        private void OpenSideWith(string side)
        {
            Cursor.Current = Cursors.WaitCursor;
            string fileName = GetFileName();

            fileName = GetShortFileName(fileName);

            fileName = Path.GetTempPath() + fileName;

            if (!Module.HandleConflictsSaveSide(GetFileName(), fileName, side))
            {
                MessageBox.Show(this, _failureWhileOpenFile.Text);
            }

            OsShellUtil.OpenAs(fileName);
            Cursor.Current = Cursors.Default;
        }
Esempio n. 23
0
        private void _openGitupPageBtn_Click(object sender, EventArgs e)
        {
            if (CurrentySelectedGitRepo is null)
            {
                return;
            }

            string hp = CurrentySelectedGitRepo.Homepage;

            if (string.IsNullOrEmpty(hp) || (!hp.StartsWith("http://") && !hp.StartsWith("https://")))
            {
                MessageBox.Show(this, _strNoHomepageDefined.Text, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                OsShellUtil.OpenUrlInDefaultBrowser(CurrentySelectedGitRepo.Homepage);
            }
        }
Esempio n. 24
0
        private void OpenSideWith(string side)
        {
            using (WaitCursorScope.Enter())
            {
                var    conflictData = GetConflict();
                string fileName     = conflictData.Filename;
                fileName = PathUtil.GetFileName(fileName);

                fileName = Path.GetTempPath() + fileName;

                if (!Module.HandleConflictsSaveSide(conflictData.Filename, fileName, side))
                {
                    MessageBox.Show(this, _failureWhileOpenFile.Text);
                }

                OsShellUtil.OpenAs(fileName);
            }
        }
Esempio n. 25
0
        private static bool LocateMissingGit()
        {
            TaskDialogPage page = new()
            {
                Heading       = ResourceManager.TranslatedStrings.GitExecutableNotFound,
                Icon          = TaskDialogIcon.Error,
                Buttons       = { TaskDialogButton.Cancel },
                AllowCancel   = true,
                SizeToContent = true
            };
            TaskDialogCommandLinkButton btnFindGitExecutable      = new(ResourceManager.TranslatedStrings.FindGitExecutable);
            TaskDialogCommandLinkButton btnInstallGitInstructions = new(ResourceManager.TranslatedStrings.InstallGitInstructions);

            page.Buttons.Add(btnFindGitExecutable);
            page.Buttons.Add(btnInstallGitInstructions);

            TaskDialogButton result = TaskDialog.ShowDialog(page);

            if (result == btnFindGitExecutable)
            {
                using OpenFileDialog dialog = new() { Filter = @"git.exe|git.exe|git.cmd|git.cmd" };
                if (dialog.ShowDialog(null) == DialogResult.OK)
                {
                    AppSettings.GitCommandValue = dialog.FileName;
                }

                return(CheckSettingsLogic.SolveGitCommand());
            }

            if (result == btnInstallGitInstructions)
            {
                OsShellUtil.OpenUrlInDefaultBrowser(@"https://github.com/gitextensions/gitextensions/wiki/Application-Dependencies#git");
                return(false);
            }

            return(false);
        }
    }
Esempio n. 26
0
        private void SendAndQuitButton_Click(object sender, EventArgs e)
        {
            var hasUserText = CheckContainsInfo(descriptionTextBox.Text);

            if (!hasUserText)
            {
                MessageBox.Show(this, _noReproStepsSuppliedErrorMessage.Text, _title.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                descriptionTextBox.Focus();
                return;
            }

            if (MessageBox.Show(this, _submitGitHubMessage.Text, _title.Text,
                                MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            string url = UrlBuilder.Build("https://github.com/gitextensions/gitextensions/issues/new", _lastException.OriginalException, _environmentInfo, descriptionTextBox.Text);

            OsShellUtil.OpenUrlInDefaultBrowser(url);

            DialogResult = DialogResult.Abort;
            Close();
        }
Esempio n. 27
0
        /// <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
            directoryInfoPath ??= getter();

            // TODO: do we need ParentForm or is "this" ok?
            var userSelectedPath = OsShellUtil.PickFolder(ParentForm, directoryInfoPath);

            if (userSelectedPath is not null)
            {
                setter(userSelectedPath);
            }
        }
Esempio n. 28
0
        private static bool LocateMissingGit()
        {
            int dialogResult = -1;

            using var dialog1 = new TaskDialog
                  {
                      InstructionText = ResourceManager.Strings.GitExecutableNotFound,
                      Icon            = TaskDialogStandardIcon.Error,
                      StandardButtons = TaskDialogStandardButtons.Cancel,
                      Cancelable      = true,
                  };
            var btnFindGitExecutable = new TaskDialogCommandLink("FindGitExecutable", null, ResourceManager.Strings.FindGitExecutable);

            btnFindGitExecutable.Click += (s, e) =>
            {
                dialogResult = 0;
                dialog1.Close();
            };
            var btnInstallGitInstructions = new TaskDialogCommandLink("InstallGitInstructions", null, ResourceManager.Strings.InstallGitInstructions);

            btnInstallGitInstructions.Click += (s, e) =>
            {
                dialogResult = 1;
                dialog1.Close();
            };
            dialog1.Controls.Add(btnFindGitExecutable);
            dialog1.Controls.Add(btnInstallGitInstructions);

            dialog1.Show();
            switch (dialogResult)
            {
            case 0:
            {
                using (var dialog = new OpenFileDialog
                    {
                        Filter = @"git.exe|git.exe|git.cmd|git.cmd",
                    })
                {
                    if (dialog.ShowDialog(null) == DialogResult.OK)
                    {
                        AppSettings.GitCommandValue = dialog.FileName;
                    }

                    if (CheckSettingsLogic.SolveGitCommand())
                    {
                        return(true);
                    }
                }

                return(false);
            }

            case 1:
            {
                OsShellUtil.OpenUrlInDefaultBrowser(@"https://github.com/gitextensions/gitextensions/wiki/Application-Dependencies#git");
                return(false);
            }

            default:
            {
                return(false);
            }
            }
        }
        private void openWithToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string fileName = GetFileName();

            OsShellUtil.OpenAs(Path.Combine(Module.WorkingDir, fileName));
        }
        private void OpenManual()
        {
            string url = GetUrl();

            OsShellUtil.OpenUrlInDefaultBrowser(url);
        }