From 2a0dd885251105177d4f0a06949b5417fb06c28c Mon Sep 17 00:00:00 2001 From: noisyfox Date: Tue, 13 Dec 2016 02:52:58 +1100 Subject: [PATCH] Add import URL from clipboard --- shadowsocks-csharp/Data/cn.txt | 1 + shadowsocks-csharp/Data/zh_tw.txt | 1 + shadowsocks-csharp/View/MenuViewController.cs | 13 ++++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/shadowsocks-csharp/Data/cn.txt b/shadowsocks-csharp/Data/cn.txt index 35e42906..23130216 100644 --- a/shadowsocks-csharp/Data/cn.txt +++ b/shadowsocks-csharp/Data/cn.txt @@ -23,6 +23,7 @@ Secure Local PAC=保护本地 PAC Copy Local PAC URL=复制本地 PAC 网址 Share Server Config...=分享服务器配置... Scan QRCode from Screen...=扫描屏幕上的二维码... +Import URL from Clipboard...=从剪贴板导入URL... Availability Statistics=统计可用性 Show Logs...=显示日志... Verbose Logging=详细记录日志 diff --git a/shadowsocks-csharp/Data/zh_tw.txt b/shadowsocks-csharp/Data/zh_tw.txt index b8d4277e..0a34e9c0 100644 --- a/shadowsocks-csharp/Data/zh_tw.txt +++ b/shadowsocks-csharp/Data/zh_tw.txt @@ -23,6 +23,7 @@ Secure Local PAC=保護本地 PAC Copy Local PAC URL=複製本地 PAC 網址 Share Server Config...=分享伺服器配置... Scan QRCode from Screen...=掃描螢幕上的 QR 碼... +Import URL from Clipboard...=從剪貼板導入URL... Availability Statistics=統計可用性 Show Logs...=顯示日誌... Verbose Logging=詳細記錄日誌 diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs index 16ce9082..d715ab2b 100644 --- a/shadowsocks-csharp/View/MenuViewController.cs +++ b/shadowsocks-csharp/View/MenuViewController.cs @@ -261,8 +261,10 @@ namespace Shadowsocks.View this.SeperatorItem = new MenuItem("-"), this.ConfigItem = CreateMenuItem("Edit Servers...", new EventHandler(this.Config_Click)), CreateMenuItem("Statistics Config...", StatisticsConfigItem_Click), + new MenuItem("-"), CreateMenuItem("Share Server Config...", new EventHandler(this.QRCodeItem_Click)), - CreateMenuItem("Scan QRCode from Screen...", new EventHandler(this.ScanQRCodeItem_Click)) + CreateMenuItem("Scan QRCode from Screen...", new EventHandler(this.ScanQRCodeItem_Click)), + CreateMenuItem("Import URL from Clipboard...", new EventHandler(this.ImportURLItem_Click)) }), CreateMenuGroup("PAC ", new MenuItem[] { this.localPACItem = CreateMenuItem("Local PAC", new EventHandler(this.LocalPACItem_Click)), @@ -739,6 +741,15 @@ namespace Shadowsocks.View MessageBox.Show(I18N.GetString("No QRCode found. Try to zoom in or move it to the center of the screen.")); } + private void ImportURLItem_Click(object sender, EventArgs e) + { + var success = controller.AddServerBySSURL(Clipboard.GetText(TextDataFormat.Text)); + if (success) + { + ShowConfigForm(); + } + } + void splash_FormClosed(object sender, FormClosedEventArgs e) { ShowConfigForm();