コード例 #1
0
        /// <summary>
        /// Snooze systray.
        /// </summary>
        /// <param name="menuItem"></param>
        /// <param name="timespan"></param>
        /// <returns>True if snoozed else False</returns>
        public bool SnoozeFor(IToolStripMenuItem menuItem)
        {
            if (ToolStripMenuItems == null)
            {
                throw new InvalidOperationException("ToolStripMenuItems should be initialized before calling this method");
            }

            IToolStripMenuItem exists = ToolStripMenuItems.FirstOrDefault(m => m == menuItem);

            if (exists == null)
            {
                throw new InvalidOperationException("Argument not found in ToolStripMenuItems");
            }

            if (menuItem.IsSnoozed)
            {
                AbortSnooze();
                menuItem.IsSnoozed = false;
                return(false);
            }
            else
            {
                IToolStripMenuItem oldSnoozed = ToolStripMenuItems.FirstOrDefault(m => m.IsSnoozed == true);

                if (oldSnoozed != null)
                {
                    AbortSnooze();
                    oldSnoozed.IsSnoozed = false;
                }

                menuItem.IsSnoozed = true;
                Snooze(menuItem.Duration);
                return(true);
            }
        }
コード例 #2
0
        void IPlugin.Accept(IPluginHostServices services)
        {
            hostServices = services;

            menuItem        = hostServices.MenuBar.AddMenuItem("&Tools|&Options");
            menuItem.Click += menuItem_Click;

            ImageResources imageResources = new ImageResources();

            hostServices.ToolStrip.AddButton("Options", imageResources.GetImage("PropertiesHS.png"),
                                             onOptionsButtonClick, "Options");
        }
コード例 #3
0
        void IOnOpenListener.OnOpen(IPluginHostServices services)
        {
            hostServices = services;

            IPersistenceService persistenceService = hostServices.GetService <IPersistenceService>();

            config = persistenceService.RegisterScope("IncidentsViewPlugIn", UpdateConfig,
                                                      new IncidentsViewPlugInConfig());

            IToolStripMenuItem menuItem = hostServices.MenuBar.AddMenuItem("&Incidents|Add &View");

            menuItem.Click += addIncidentsViewMenuItem_Click;

            NewIncidentsView();
        }