mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
fix: crash when open external tool drop down menu
This commit is contained in:
parent
111bf2966a
commit
d873f21b6a
5 changed files with 12 additions and 13 deletions
|
@ -1,12 +1,11 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace SourceGit.Models
|
||||
{
|
||||
public class ExternalEditor
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public Uri Icon { get; set; } = null;
|
||||
public string Icon { get; set; } = string.Empty;
|
||||
public string Executable { get; set; } = string.Empty;
|
||||
public string OpenCmdArgs { get; set; } = string.Empty;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace SourceGit.Native
|
|||
editors.Add(new Models.ExternalEditor
|
||||
{
|
||||
Name = "Visual Studio Code",
|
||||
Icon = new Uri("avares://SourceGit/Resources/ExternalToolIcons/vscode.png", UriKind.Absolute),
|
||||
Icon = "vscode.png",
|
||||
Executable = vscode,
|
||||
OpenCmdArgs = "\"{0}\"",
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ namespace SourceGit.Native
|
|||
editors.Add(new Models.ExternalEditor
|
||||
{
|
||||
Name = "Visual Studio Code - Insiders",
|
||||
Icon = new Uri("avares://SourceGit/Resources/ExternalToolIcons/vscode_insiders.png", UriKind.Absolute),
|
||||
Icon = "vscode_insiders.png",
|
||||
Executable = vscodeInsiders,
|
||||
OpenCmdArgs = "\"{0}\"",
|
||||
});
|
||||
|
@ -65,7 +65,7 @@ namespace SourceGit.Native
|
|||
editors.Add(new Models.ExternalEditor
|
||||
{
|
||||
Name = "JetBrains Fleet",
|
||||
Icon = new Uri("avares://SourceGit/Resources/ExternalToolIcons/fleet.png", UriKind.Absolute),
|
||||
Icon = "fleet.png",
|
||||
Executable = fleet,
|
||||
OpenCmdArgs = "\"{0}\"",
|
||||
});
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace SourceGit.Native
|
|||
editors.Add(new Models.ExternalEditor
|
||||
{
|
||||
Name = "Visual Studio Code",
|
||||
Icon = new Uri("avares://SourceGit/Resources/ExternalToolIcons/vscode.png", UriKind.Absolute),
|
||||
Icon = "vscode.png",
|
||||
Executable = vscode,
|
||||
OpenCmdArgs = "\"{0}\"",
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ namespace SourceGit.Native
|
|||
editors.Add(new Models.ExternalEditor
|
||||
{
|
||||
Name = "Visual Studio Code - Insiders",
|
||||
Icon = new Uri("avares://SourceGit/Resources/ExternalToolIcons/vscode_insiders.png", UriKind.Absolute),
|
||||
Icon = "vscode_insiders.png",
|
||||
Executable = vscodeInsiders,
|
||||
OpenCmdArgs = "\"{0}\"",
|
||||
});
|
||||
|
@ -62,7 +62,7 @@ namespace SourceGit.Native
|
|||
editors.Add(new Models.ExternalEditor
|
||||
{
|
||||
Name = "JetBrains Fleet",
|
||||
Icon = new Uri("avares://SourceGit/Resources/ExternalToolIcons/fleet.png", UriKind.Absolute),
|
||||
Icon = "fleet.png",
|
||||
Executable = fleet,
|
||||
OpenCmdArgs = "\"{0}\"",
|
||||
});
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace SourceGit.Native
|
|||
editors.Add(new Models.ExternalEditor
|
||||
{
|
||||
Name = "Visual Studio Code",
|
||||
Icon = new Uri("avares://SourceGit/Resources/ExternalToolIcons/vscode.png", UriKind.Absolute),
|
||||
Icon = "vscode.png",
|
||||
Executable = vscode,
|
||||
OpenCmdArgs = "\"{0}\"",
|
||||
});
|
||||
|
@ -136,7 +136,7 @@ namespace SourceGit.Native
|
|||
editors.Add(new Models.ExternalEditor
|
||||
{
|
||||
Name = "Visual Studio Code - Insiders",
|
||||
Icon = new Uri("avares://SourceGit/Resources/ExternalToolIcons/vscode_insiders.png", UriKind.Absolute),
|
||||
Icon = "vscode_insiders.png",
|
||||
Executable = vscodeInsiders,
|
||||
OpenCmdArgs = "\"{0}\"",
|
||||
});
|
||||
|
@ -148,7 +148,7 @@ namespace SourceGit.Native
|
|||
editors.Add(new Models.ExternalEditor
|
||||
{
|
||||
Name = "JetBrains Fleet",
|
||||
Icon = new Uri("avares://SourceGit/Resources/ExternalToolIcons/fleet.png", UriKind.Absolute),
|
||||
Icon = "fleet.png",
|
||||
Executable = fleet,
|
||||
OpenCmdArgs = "\"{0}\"",
|
||||
});
|
||||
|
|
|
@ -303,7 +303,7 @@ namespace SourceGit.ViewModels
|
|||
foreach (var editor in editors)
|
||||
{
|
||||
var dupEditor = editor;
|
||||
var icon = AssetLoader.Open(dupEditor.Icon);
|
||||
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/ExternalToolIcons/{dupEditor.Icon}", UriKind.RelativeOrAbsolute));
|
||||
var item = new MenuItem();
|
||||
item.Header = App.Text("Repository.OpenIn", dupEditor.Name);
|
||||
item.Icon = new Image { Width = 16, Height = 16, Source = new Bitmap(icon) };
|
||||
|
|
Loading…
Reference in a new issue