diff --git a/shadowsocks-csharp/ServerSharingWindow.xaml b/shadowsocks-csharp/ServerSharingWindow.xaml
new file mode 100644
index 00000000..6cc585c3
--- /dev/null
+++ b/shadowsocks-csharp/ServerSharingWindow.xaml
@@ -0,0 +1,11 @@
+
+
+
diff --git a/shadowsocks-csharp/ServerSharingWindow.xaml.cs b/shadowsocks-csharp/ServerSharingWindow.xaml.cs
new file mode 100644
index 00000000..f48e5eaa
--- /dev/null
+++ b/shadowsocks-csharp/ServerSharingWindow.xaml.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Shadowsocks
+{
+ ///
+ /// Interaction logic for ServerSharingWindow.xaml
+ ///
+ public partial class ServerSharingWindow : Window
+ {
+ public ServerSharingWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs
index f73e2102..a2f971a3 100644
--- a/shadowsocks-csharp/View/MenuViewController.cs
+++ b/shadowsocks-csharp/View/MenuViewController.cs
@@ -65,6 +65,8 @@ namespace Shadowsocks.View
private HotkeySettingsForm hotkeySettingsForm;
private OnlineConfigForm onlineConfigForm;
+ private ServerSharingWindow serverSharingWindow;
+
// color definition for icon color transformation
private readonly Color colorMaskBlue = Color.FromArgb(255, 25, 125, 191);
private readonly Color colorMaskDarkSilver = Color.FromArgb(128, 192, 192, 192);
@@ -741,10 +743,18 @@ namespace Shadowsocks.View
private void QRCodeItem_Click(object sender, EventArgs e)
{
- QRCodeForm qrCodeForm = new QRCodeForm(controller.GetServerURLForCurrentServer());
- //qrCodeForm.Icon = this.Icon;
- // TODO
- qrCodeForm.Show();
+ if (serverSharingWindow == null)
+ {
+ serverSharingWindow = new ServerSharingWindow();
+ serverSharingWindow.Closed += ServerSharingWindow_Closed;
+ serverSharingWindow.Show();
+ }
+ serverSharingWindow.Activate();
+ }
+
+ private void ServerSharingWindow_Closed(object sender, EventArgs e)
+ {
+ serverSharingWindow = null;
}
private void ScanQRCodeItem_Click(object sender, EventArgs e)
diff --git a/shadowsocks-csharp/View/QRCodeForm.Designer.cs b/shadowsocks-csharp/View/QRCodeForm.Designer.cs
deleted file mode 100755
index 7e83616a..00000000
--- a/shadowsocks-csharp/View/QRCodeForm.Designer.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-namespace Shadowsocks.View
-{
- partial class QRCodeForm
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.elementHost1 = new System.Windows.Forms.Integration.ElementHost();
- this.serverSharingView1 = new Shadowsocks.Views.ServerSharingView();
- this.SuspendLayout();
- //
- // elementHost1
- //
- this.elementHost1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.elementHost1.Location = new System.Drawing.Point(0, 0);
- this.elementHost1.Margin = new System.Windows.Forms.Padding(0);
- this.elementHost1.Name = "elementHost1";
- this.elementHost1.Size = new System.Drawing.Size(600, 340);
- this.elementHost1.TabIndex = 0;
- this.elementHost1.Text = "elementHost1";
- this.elementHost1.Child = this.serverSharingView1;
- //
- // QRCodeForm
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
- this.BackColor = System.Drawing.Color.White;
- this.ClientSize = new System.Drawing.Size(600, 340);
- this.Controls.Add(this.elementHost1);
- this.Margin = new System.Windows.Forms.Padding(8);
- this.Name = "QRCodeForm";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "QRCode and URL";
- this.Load += new System.EventHandler(this.QRCodeForm_Load);
- this.ResumeLayout(false);
- }
-
- #endregion
-
- private System.Windows.Forms.Integration.ElementHost elementHost1;
- private Views.ServerSharingView serverSharingView1;
- }
-}
\ No newline at end of file
diff --git a/shadowsocks-csharp/View/QRCodeForm.cs b/shadowsocks-csharp/View/QRCodeForm.cs
deleted file mode 100755
index 4ff0838a..00000000
--- a/shadowsocks-csharp/View/QRCodeForm.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using ZXing.QrCode.Internal;
-using Shadowsocks.Controller;
-using Shadowsocks.Properties;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.IO;
-using System.IO.Compression;
-using System.Linq;
-using System.Text;
-using System.Windows.Forms;
-using Shadowsocks.Model;
-
-namespace Shadowsocks.View
-{
- public partial class QRCodeForm : Form
- {
- private string code;
-
- public QRCodeForm(string code)
- {
- this.code = code;
- InitializeComponent();
- this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon());
- this.Text = I18N.GetString("QRCode and URL");
- }
-
- private void QRCodeForm_Load(object sender, EventArgs e)
- {
-
- }
- }
-}
diff --git a/shadowsocks-csharp/View/QRCodeForm.resx b/shadowsocks-csharp/View/QRCodeForm.resx
deleted file mode 100755
index 29dcb1b3..00000000
--- a/shadowsocks-csharp/View/QRCodeForm.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/shadowsocks-csharp/Views/ServerSharingView.xaml b/shadowsocks-csharp/Views/ServerSharingView.xaml
index dbce7e27..763d9ed2 100644
--- a/shadowsocks-csharp/Views/ServerSharingView.xaml
+++ b/shadowsocks-csharp/Views/ServerSharingView.xaml
@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Shadowsocks.Views"
mc:Ignorable="d"
- d:DesignHeight="320" d:DesignWidth="600">
+ d:DesignHeight="400" d:DesignWidth="660">
diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj
index c9414a2b..dc63c364 100644
--- a/shadowsocks-csharp/shadowsocks-csharp.csproj
+++ b/shadowsocks-csharp/shadowsocks-csharp.csproj
@@ -41,6 +41,7 @@
1.0.0.%2a
false
true
+ {60DC8134-EBA5-43B8-BCC9-BB4BC16C2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
true
@@ -256,6 +257,9 @@
+
+ ServerSharingWindow.xaml
+
@@ -312,12 +316,6 @@
ProxyForm.cs
-
- Form
-
-
- QRCodeForm.cs
-
Form
@@ -354,9 +352,6 @@
ProxyForm.cs
-
- QRCodeForm.cs
-
StatisticsStrategyConfigurationForm.cs
@@ -421,6 +416,10 @@
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile