diff --git a/shadowsocks-csharp/Model/Configuration.cs b/shadowsocks-csharp/Model/Configuration.cs index e8aad2d5..b0bec8ad 100644 --- a/shadowsocks-csharp/Model/Configuration.cs +++ b/shadowsocks-csharp/Model/Configuration.cs @@ -37,6 +37,10 @@ namespace Shadowsocks.Model public HotkeyConfig hotkey; private static readonly string CONFIG_FILE = "gui-config.json"; + + [JsonIgnore] + public bool updated = false; + [JsonIgnore] public string localHost => GetLocalHost(); private string GetLocalHost() { @@ -78,6 +82,10 @@ namespace Shadowsocks.Model string configContent = File.ReadAllText(CONFIG_FILE); Configuration config = JsonConvert.DeserializeObject(configContent); config.isDefault = false; + if (UpdateChecker.Asset.CompareVersion(UpdateChecker.Version, config.version) > 0) + { + config.updated = true; + } if (config.configs == null) config.configs = new List(); diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs index 18d0e1b0..3e7c11a5 100644 --- a/shadowsocks-csharp/View/MenuViewController.cs +++ b/shadowsocks-csharp/View/MenuViewController.cs @@ -30,6 +30,7 @@ namespace Shadowsocks.View private bool _isFirstRun; private bool _isStartupChecking; private string _urlToOpen; + private bool _updated; private ContextMenu contextMenu1; private MenuItem disableItem; @@ -113,6 +114,18 @@ namespace Shadowsocks.View _isStartupChecking = true; updateChecker.CheckUpdate(config, 3000); } + + if (config.updated) + { + ShowBalloonTip( + I18N.GetString("Updated"), + I18N.GetString("updated"), + ToolTipIcon.Info, + 0 + ); + config.updated = false; + Configuration.Save(config); + } } private void controller_TrafficChanged(object sender, EventArgs e) @@ -565,9 +578,24 @@ namespace Shadowsocks.View if (_isFirstRun) { CheckUpdateForFirstRun(); - ShowFirstTimeBalloon(); + ShowBalloonTip( + I18N.GetString("Shadowsocks is here"), + I18N.GetString("You can turn on/off Shadowsocks in the context menu"), + ToolTipIcon.Info, + 0 + ); _isFirstRun = false; } + if (_updated) + { + ShowBalloonTip( + I18N.GetString("Updated"), + I18N.GetString("updated"), + ToolTipIcon.Info, + 0 + ); + _updated = false; + } } void proxyForm_FormClosed(object sender, FormClosedEventArgs e)