From b813d9eebc0f322ccc6354c4dd30e66be655b973 Mon Sep 17 00:00:00 2001 From: kimw Date: Mon, 4 Jan 2016 23:58:24 +0800 Subject: [PATCH] featured middle click on tray pops up log viewer --- shadowsocks-csharp/View/MenuViewController.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs index b47fe038..25a3b3e8 100755 --- a/shadowsocks-csharp/View/MenuViewController.cs +++ b/shadowsocks-csharp/View/MenuViewController.cs @@ -1,16 +1,17 @@ -using Shadowsocks.Controller; -using Shadowsocks.Model; -using Shadowsocks.Properties; -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; -using System.Text; using System.Windows.Forms; + using ZXing; using ZXing.Common; using ZXing.QrCode; +using Shadowsocks.Controller; +using Shadowsocks.Model; +using Shadowsocks.Properties; + namespace Shadowsocks.View { public class MenuViewController @@ -69,6 +70,7 @@ namespace Shadowsocks.View _notifyIcon.Visible = true; _notifyIcon.ContextMenu = contextMenu1; _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked; + _notifyIcon.MouseClick += notifyIcon1_Click; _notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick; _notifyIcon.BalloonTipClosed += _notifyIcon_BalloonTipClosed; @@ -204,7 +206,6 @@ namespace Shadowsocks.View }); } - private void controller_ConfigChanged(object sender, EventArgs e) { LoadCurrentConfiguration(); @@ -420,6 +421,18 @@ namespace Shadowsocks.View Process.Start("https://github.com/shadowsocks/shadowsocks-windows"); } + private void notifyIcon1_Click(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + // TODO: show something interesting + } + else if (e.Button == MouseButtons.Middle) + { + ShowLogForms(); + } + } + private void notifyIcon1_DoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left)