From d958c5c39333714692abf19e0a2fe15566bbef35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=B4=E5=A8=83=E9=85=B1?= Date: Tue, 6 Sep 2016 18:46:35 +0800 Subject: [PATCH] fix bandwidthScale of the LogForm (#701) - Revert bandwidthScale when throughput gets smaller - Don't save coordinates when LogForm is minimized. Otherwise, we get negative values - activate ConfigForm & ProxyForm & LogForm --- shadowsocks-csharp/View/LogForm.cs | 4 ++-- shadowsocks-csharp/View/MenuViewController.cs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shadowsocks-csharp/View/LogForm.cs b/shadowsocks-csharp/View/LogForm.cs index c84d6dcc..d45b47b2 100644 --- a/shadowsocks-csharp/View/LogForm.cs +++ b/shadowsocks-csharp/View/LogForm.cs @@ -24,7 +24,6 @@ namespace Shadowsocks.View #region chart List inboundPoints = new List(); List outboundPoints = new List(); - long maxSpeed = 0; Tuple bandwidthScale = new Tuple(0, "B", 1); TextAnnotation inboundAnnotation = new TextAnnotation(); TextAnnotation outboundAnnotation = new TextAnnotation(); @@ -59,6 +58,7 @@ namespace Shadowsocks.View private void controller_TrafficChanged(object sender, EventArgs e) { + long maxSpeed = 0; inboundPoints.Clear(); outboundPoints.Clear(); foreach (var trafficPerSecond in controller.traffic) @@ -218,7 +218,7 @@ namespace Shadowsocks.View config.SetFont(LogMessageTextBox.Font); config.SetBackgroundColor(LogMessageTextBox.BackColor); config.SetTextColor(LogMessageTextBox.ForeColor); - if(!(config.maximized = WindowState == FormWindowState.Maximized)) { + if (WindowState != FormWindowState.Minimized && !(config.maximized = WindowState == FormWindowState.Maximized)) { config.top = Top; config.left = Left; config.height = Height; diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs index af18a3e6..db0aef08 100644 --- a/shadowsocks-csharp/View/MenuViewController.cs +++ b/shadowsocks-csharp/View/MenuViewController.cs @@ -439,6 +439,7 @@ namespace Shadowsocks.View { configForm = new ConfigForm(controller); configForm.Show(); + configForm.Activate(); configForm.FormClosed += configForm_FormClosed; } } @@ -453,6 +454,7 @@ namespace Shadowsocks.View { proxyForm = new ProxyForm(controller); proxyForm.Show(); + proxyForm.Activate(); proxyForm.FormClosed += proxyForm_FormClosed; } } @@ -463,6 +465,7 @@ namespace Shadowsocks.View { LogForm f = new LogForm(controller, Logging.LogFilePath); f.Show(); + f.Activate(); f.FormClosed += logForm_FormClosed; logForms.Add(f);