From 86538ac3ca6b4b96540ca8d21b47a341bb7c34da Mon Sep 17 00:00:00 2001 From: erikzhang Date: Tue, 3 Dec 2019 22:32:18 +0800 Subject: [PATCH] Update MainForm.cs --- neo-gui/GUI/MainForm.cs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/neo-gui/GUI/MainForm.cs b/neo-gui/GUI/MainForm.cs index 20aa9018c..1e612bb90 100644 --- a/neo-gui/GUI/MainForm.cs +++ b/neo-gui/GUI/MainForm.cs @@ -101,6 +101,22 @@ private void Blockchain_PersistCompleted(Blockchain.PersistCompleted e) BeginInvoke(new Action(RefreshConfirmations)); } + private static void OpenBrowser(string url) + { + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + Process.Start(new ProcessStartInfo("cmd", $"/c start {url}")); + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + Process.Start("xdg-open", url); + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + Process.Start("open", url); + } + } + private void Service_WalletChanged(object sender, EventArgs e) { listView3.Items.Clear(); @@ -365,22 +381,6 @@ private void 官网WToolStripMenuItem_Click(object sender, EventArgs e) OpenBrowser("https://neo.org/"); } - public static void OpenBrowser(string url) - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - Process.Start(new ProcessStartInfo("cmd", $"/c start {url}")); - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - Process.Start("xdg-open", url); - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - Process.Start("open", url); - } - } - private void 开发人员工具TToolStripMenuItem_Click(object sender, EventArgs e) { Helper.Show(); @@ -570,19 +570,19 @@ private void toolStripMenuItem1_Click(object sender, EventArgs e) private void listView1_DoubleClick(object sender, EventArgs e) { if (listView1.SelectedIndices.Count == 0) return; - Process.Start($"https://neoscan.io/address/{listView1.SelectedItems[0].Text}"); + OpenBrowser($"https://neoscan.io/address/{listView1.SelectedItems[0].Text}"); } private void listView2_DoubleClick(object sender, EventArgs e) { if (listView2.SelectedIndices.Count == 0) return; - Process.Start($"https://neoscan.io/asset/{listView2.SelectedItems[0].Name[2..]}"); + OpenBrowser($"https://neoscan.io/asset/{listView2.SelectedItems[0].Name[2..]}"); } private void listView3_DoubleClick(object sender, EventArgs e) { if (listView3.SelectedIndices.Count == 0) return; - Process.Start($"https://neoscan.io/transaction/{listView3.SelectedItems[0].Name[2..]}"); + OpenBrowser($"https://neoscan.io/transaction/{listView3.SelectedItems[0].Name[2..]}"); } private void toolStripStatusLabel3_Click(object sender, EventArgs e)