示例#1
0
        private void InitTaskbarIcon()
        {
            Logger.AddLog("InitTaskbarIcon starting");

            // Create and bind the load at startip/remove from startup command.
            LoadAtStartupCommand = new RoutedUICommand();
            AddMenuCommand(LoadAtStartupCommand, OnCommandLoadAtStartup);

            // Create and bind the exit command.
            ExitCommand = new RoutedUICommand();
            AddMenuCommand(ExitCommand, OnCommandExit);

            // Do the same with all plugin commands.
            foreach (KeyValuePair <List <ICommand>, string> Entry in PluginManager.FullCommandList)
            {
                List <ICommand> FullPluginCommandList = Entry.Key;
                foreach (ICommand Command in FullPluginCommandList)
                {
                    AddMenuCommand(Command, OnPluginCommand);
                }
            }

            // Get the preferred icon and tooltip, and build the taskbar context menu.
            Icon        Icon        = PluginManager.Icon;
            string      ToolTip     = PluginManager.ToolTip;
            ContextMenu ContextMenu = LoadContextMenu();

            // Install the taskbar icon.
            TaskbarIcon              = TaskbarIcon.Create(Icon, ToolTip, ContextMenu, ContextMenu);
            TaskbarIcon.MenuOpening += OnMenuOpening;
            TaskbarIcon.IconClicked += OnIconClicked;

            Logger.AddLog("InitTaskbarIcon done");
        }
示例#2
0
        private void InitTaskbarIcon()
        {
            App.AddLog("InitTaskbarIcon starting");

            MenuHeaderTable      = new Dictionary <ICommand, string>();
            LoadAtStartupCommand = InitMenuCommand("LoadAtStartupCommand", LoadAtStartupHeader, OnCommandLoadAtStartup);
            LockCommand          = InitMenuCommand("LockCommand", "Locked", OnCommandLock);
            ExitCommand          = InitMenuCommand("ExitCommand", "Exit", OnCommandExit);

            ContextMenu ContextMenu = LoadContextMenu(out Icon Icon);

            TaskbarIcon              = TaskbarIcon.Create(Icon, ToolTipText, ContextMenu, ContextMenu);
            TaskbarIcon.MenuOpening += OnMenuOpening;

            App.AddLog("InitTaskbarIcon done");
        }