private void UpdateTrayIcon()
        {
            int      dpi;
            Graphics graphics = Graphics.FromHwnd(IntPtr.Zero);

            dpi = (int)graphics.DpiX;
            graphics.Dispose();
            icon_baseBitmap = null;
            if (dpi < 97)
            {
                // dpi = 96;    任务栏小图标
                icon_baseBitmap = Resources.Photon2;
            }
            else if (dpi < 121)
            {
                // dpi = 120;
                //icon_baseBitmap = Resources.ss20;
            }
            else
            {
                //icon_baseBitmap = Resources.ss24;
            }
            Configuration config  = controller.GetConfigurationCopy();
            bool          enabled = config.enabled;
            bool          global  = config.global;

            icon_baseBitmap = getTrayIconByState(icon_baseBitmap, enabled, global);

            icon_base  = Icon.FromHandle(icon_baseBitmap.GetHicon());
            targetIcon = icon_base;
            icon_in    = Icon.FromHandle(AddBitmapOverlay(icon_baseBitmap, Resources.Photon1).GetHicon());
            //icon_out = Icon.FromHandle(AddBitmapOverlay(icon_baseBitmap, Resources.ssOut24).GetHicon());下载小图标(将图片放在Resoutces文件夹即可引用,修改ssOut24即可)
            //icon_both = Icon.FromHandle(AddBitmapOverlay(icon_baseBitmap, Resources.Photon1, Resources.ssOut24).GetHicon());配合上面使用
            icon_both        = Icon.FromHandle(AddBitmapOverlay(icon_baseBitmap, Resources.Photon1).GetHicon());
            _notifyIcon.Icon = targetIcon;

            string serverInfo = null;

            if (controller.GetCurrentStrategy() != null)
            {
                serverInfo = controller.GetCurrentStrategy().Name;
            }
            else
            {
                serverInfo = config.GetCurrentServer().FriendlyName();
            }
            // show more info by hacking the P/Invoke declaration for NOTIFYICONDATA inside Windows Forms
            string text = I18N.GetString("Photon") + " " + UpdateChecker.Version + "\n" +
                          (enabled ?
                           I18N.GetString("System Proxy On: ") + (global ? I18N.GetString("Global") : I18N.GetString("PAC")) :
                           String.Format(I18N.GetString("Running: Port {0}"), config.localPort))     // this feedback is very important because they need to know Shadowsocks is running
                          + "\n" + serverInfo;

            ViewUtils.SetNotifyIconText(_notifyIcon, text);
        }
 private void LogWhenEnabled(string log)
 {
     if (_controller.GetCurrentStrategy()?.ID == ID) //output when enabled
     {
         Console.WriteLine(log);
     }
 }