Ejemplo n.º 1
0
        public AppNotifyIcon()
        {
            indexLoad          = bitmapsLoading.Count;
            notifyIcon.Icon    = bitmapsLoading.First();
            load.Tick         += Load_Tick;
            load.Interval      = Interval60FPS;
            notifyIcon.Text    = Translator.GetText("SystemTrayMenu");
            notifyIcon.Visible = true;

            if (Properties.Settings.Default.UseIconFromRootFolder)
            {
                SystemTrayMenu = IconReader.GetFolderIconSTA(
                    Config.Path,
                    IconReader.FolderType.Closed,
                    false);
            }

            notifyIcon.Icon = SystemTrayMenu;
            AppContextMenu contextMenus = new AppContextMenu();

            contextMenus.ClickedOpenLog += ClickedOpenLog;
            void ClickedOpenLog()
            {
                OpenLog?.Invoke();
            }

            contextMenus.ClickedRestart += ClickedRestart;
            void ClickedRestart()
            {
                Restart?.Invoke();
            }

            contextMenus.ClickedExit += ClickedExit;
            void ClickedExit()
            {
                Exit?.Invoke();
            }

            notifyIcon.ContextMenuStrip = contextMenus.Create();
            notifyIcon.MouseClick      += NotifyIcon_MouseClick;
            void NotifyIcon_MouseClick(object sender, MouseEventArgs e)
            {
                VerifyClick(e);
            }

            notifyIcon.MouseDoubleClick += NotifyIcon_MouseDoubleClick;
            void NotifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
            {
                VerifyClick(e);
            }
        }
Ejemplo n.º 2
0
        public AppNotifyIcon()
        {
            indexLoad          = bitmapsLoading.Count;
            notifyIcon.Icon    = bitmapsLoading.First();
            load.Tick         += Load_Tick;
            load.Interval      = Interval60FPS;
            notifyIcon.Text    = Translator.GetText("SystemTrayMenu");
            notifyIcon.Visible = true;
            notifyIcon.Icon    = R.SystemTrayMenu;
            AppContextMenu contextMenus = new AppContextMenu();

            contextMenus.ClickedOpenLog += ClickedOpenLog;
            void ClickedOpenLog()
            {
                OpenLog?.Invoke();
            }

            contextMenus.ClickedRestart += ClickedRestart;
            void ClickedRestart()
            {
                Restart?.Invoke();
            }

            contextMenus.ClickedExit += ClickedExit;
            void ClickedExit()
            {
                Exit?.Invoke();
            }

            notifyIcon.ContextMenuStrip = contextMenus.Create();
            notifyIcon.MouseClick      += NotifyIcon_MouseClick;
            void NotifyIcon_MouseClick(object sender, MouseEventArgs e)
            {
                VerifyClick(e);
            }

            notifyIcon.MouseDoubleClick += NotifyIcon_MouseDoubleClick;
            void NotifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
            {
                VerifyClick(e);
            }
        }