示例#1
0
        public SystemTray()
        {
            _engine = new Engine(_container);

            #region Initialization

            var resource = new ResourceCulture();
            var font     = new Font("Segoe UI", 10.5F);
            _about = new ToolStripMenuItem
            {
                Text = resource.GetString(LangName.About),
                Font = font
            };
            _animation = new ToolStripMenuItem
            {
                Text = resource.GetString(LangName.Animation),
                Font = font
            };
            _reduceTaskbarDisplay = new ToolStripMenuItem
            {
                Text = resource.GetString(LangName.ReduceTaskbarDisplay),
                Font = font
            };
            _autoMode = new ToolStripMenuItem
            {
                Text = resource.GetString(LangName.Auto),
                Font = font
            };
            _showTaskbarWhenExit = new ToolStripMenuItem
            {
                Text = resource.GetString(LangName.ShowBarOnExit),
                Font = font
            };
            _exit = new ToolStripMenuItem
            {
                Text = resource.GetString(LangName.Exit),
                Font = font
            };
            _contextMenuStrip = new ContextMenuStrip
            {
                Renderer = new Win10Renderer()
            };

            _contextMenuStrip.Items.AddRange(new ToolStripItem[]
            {
                _about,
                _animation,
                new ToolStripSeparator(),
                _reduceTaskbarDisplay,
                _autoMode,
                new ToolStripSeparator(),
                _showTaskbarWhenExit,
                _exit
            });

            _notifyIcon = new NotifyIcon(_container)
            {
                Text    = @"SmartTaskbar v1.4.5",
                Icon    = Fun.IsLightTheme() ? Resources.Logo_Black : Resources.Logo_White,
                Visible = true
            };

            #endregion

            #region Load Event

            _about.Click += AboutOnClick;

            _animation.Click += AnimationOnClick;

            _reduceTaskbarDisplay.Click += ReduceTaskbarDisplayOnClick;

            _autoMode.Click += AutoModeOnClick;

            _showTaskbarWhenExit.Click += ShowTaskbarWhenExitOnClick;

            _exit.Click += ExitOnClick;

            _notifyIcon.MouseClick += NotifyIconOnMouseClick;

            _notifyIcon.MouseDoubleClick += NotifyIconOnMouseDoubleClick;

            Fun.UiSettings.ColorValuesChanged += UISettingsOnColorValuesChanged;

            #endregion
        }
示例#2
0
 private void UISettingsOnColorValuesChanged(UISettings sender, object args)
 => _notifyIcon.Icon = Fun.IsLightTheme() ? Resources.Logo_Black : Resources.Logo_White;