private void openFileWithToolStripMenuItem_Click(object sender, EventArgs e) { var fileName = SaveSelectedItemToTempFile(); if (fileName != null) { OsShellUtil.OpenAs(fileName); } }
private void Browse_Click(object sender, EventArgs e) { var userSelectedPath = OsShellUtil.PickFolder(this); if (userSelectedPath != null) { OutputPath.Text = userSelectedPath; } }
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); }
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 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); } }
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 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 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()); } } }
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 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); } }
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); } }
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; } }
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; }
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; }
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); } }
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); } }
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); } }
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(); }
/// <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); } }
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); }