PerformClick() public méthode

public PerformClick ( ) : void
Résultat void
Exemple #1
0
        private void OnMouseDown(Object s, MouseEventArgs e)
        {
            // What item are we over?
            int item = ItemFromPoint(new Point(e.X, e.Y));

            if (item != -1)
            {
                MenuItem menuItem = ItemSelected(item);
                // If there were no sub items, then we need to "PerformClick".
                if (menuItem.MenuItems.Count == 0)
                {
                    PopDown();
                    menuItem.PerformClick();
                }
                else
                {
                    return;
                }
            }
            // Do we need to pass the mouse down along?
            if (MouseDown != null)
            {
                // Convert the mouse co-ordinates relative to the associated control (form).
                MouseDown(this, CreateParentMouseArgs(e));
            }
        }
Exemple #2
0
 private void _tbMain_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
 {
     if (e.Button == _tbbFileOpen)
     {
         _miFileOpen.PerformClick();
     }
     if (e.Button == _tbbFileSave)
     {
         _miFileSave.PerformClick();
     }
     if (e.Button == _tbbPdfOptionsAdd)
     {
         _miPdfOptionsAdd.PerformClick();
     }
     if (e.Button == _tbbPdfOptionsModify)
     {
         _miPdfOptionsModify.PerformClick();
     }
     if (e.Button == _tbbPdfOptionsDelete)
     {
         _miPdfOptionsDelete.PerformClick();
     }
     if (e.Button == _tbbHelpAbout)
     {
         _miHelpAbout.PerformClick();
     }
     UpdateControls();
 }
Exemple #3
0
        internal void OnMouseDown(MouseEventArgs e)
        {
            // Get the mouse coordinate relative to the control
            int y = e.Y + SystemInformation.MenuHeight;
            // Search the main menu
            int item = ItemFromPoint(new Point(e.X, y));

            if (item != -1)
            {
                MenuItem menuItem = ItemSelected(item);
                if (menuItem.MenuItems.Count == 0)
                {
                    clicked = false;
                    menuItem.PerformClick();
                }
                else
                {
                    clicked = true;
                }
            }
            else
            {
                // We have clicked outside of any menus that are up so pop down all menus.
                if (menuPopup != null)
                {
                    menuPopup.PopDown();
                    clicked = false;
                }
            }
        }
Exemple #4
0
 private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
 {
     if (e.Button == Instruktori)
     {
         menuItemInstr.PerformClick();
     }
     else if (e.Button == Vozila)
     {
         menuItemVozila.PerformClick();
     }
     else if (e.Button == Kandidati)
     {
         menuItemKandidati.PerformClick();
     }
     else if (e.Button == Kategorije)
     {
         menuItemKategorije.PerformClick();
     }
     else if (e.Button == Polaganja)
     {
         menuItemPolaganja.PerformClick();
     }
     else if (e.Button == dnevnikObuke)
     {
         menuItemDnevnik.PerformClick();
     }
     //else if (e.Button == Testovi) { menuItemTestovi.PerformClick(); }
 }
Exemple #5
0
 void MenuCheck(MenuItem item, bool check)
 {
     if (check)
     {
         if (!item.Checked)
         {
             item.PerformClick();
         }
     }
     else
     {
         if (item.Checked)
         {
             item.PerformClick();
         }
     }
 }
Exemple #6
0
        // UIA Framework Note: Used to expand/collapse MenuItems
        public void OnMouseUp(MouseEventArgs args)
        {
            /* mouse down dont comes from menu */
            if (!mouse_down)
            {
                return;
            }

            mouse_down = false;

            /* is not left button */
            if ((args.Button & MouseButtons.Left) == 0)
            {
                return;
            }

            MenuItem item = GetItemAtXY(args.X, args.Y);

            /* the user released the mouse button outside the menu */
            if (item == null)
            {
                Deactivate();
                return;
            }

            if (!item.Enabled)
            {
                return;
            }

            /* Deactivate the menu when is topmenu and popdown and */
            if (((CurrentMenu == TopMenu) && !(CurrentMenu is ContextMenu) && popdown_menu) || !item.IsPopup)
            {
                Deactivate();
                UpdateCursor();
            }

            /* Perform click when is not a popup */
            if (!item.IsPopup)
            {
                DeselectItem(item);

                // Raise the form's MenuComplete event
                if (TopMenu != null && TopMenu.Wnd != null)
                {
                    Form f = TopMenu.Wnd.FindForm();

                    if (f != null)
                    {
                        f.OnMenuComplete(EventArgs.Empty);
                    }
                }

                item.PerformClick();
            }
        }
        private void PerformClick()
        {
            if (itemProvider.ParentMenu != null &&
                itemProvider.ParentMenu.Wnd != null &&
                itemProvider.ParentMenu.Wnd.InvokeRequired)
            {
                itemProvider.ParentMenu.Wnd.BeginInvoke(new SWF.MethodInvoker(PerformClick));
            }

            SWF.MenuItem item = (SWF.MenuItem)Provider.Component;
            item.PerformClick();
        }
Exemple #8
0
        bool ProcessShortcut(Keys keyData)
        {
            MenuItem item = shortcuts [(int)keyData] as MenuItem;

            if (item == null || !item.Enabled)
            {
                return(false);
            }

            if (active)
            {
                Deactivate();
            }
            item.PerformClick();
            return(true);
        }
Exemple #9
0
 /// <summary>
 /// Toolbar button is clicked, call the corresponding menu PreformClick method
 /// </summary>
 private void _tbMain_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
 {
     if (e.Button == _tbbFileOpen)
     {
         _miFileOpen.PerformClick();
     }
     else if (e.Button == _tbbFilePrint)
     {
         _miFilePrint.PerformClick();
     }
     else if (e.Button == _tbbZoomIn)
     {
         _miZoomIn.PerformClick();
     }
     else if (e.Button == _tbbZoomOut)
     {
         _miZoomOut.PerformClick();
     }
     else if (e.Button == _tbbZoomNone)
     {
         _miZoomNormal.PerformClick();
     }
     else if (e.Button == _tbbFilePrintPreview)
     {
         _miFilePrintPreview.PerformClick();
     }
     else if (e.Button == _tbbPageFirst)
     {
         _miPageFirst.PerformClick();
     }
     else if (e.Button == _tbbPagePrevious)
     {
         _miPagePrevious.PerformClick();
     }
     else if (e.Button == _tbbPageNext)
     {
         _miPageNext.PerformClick();
     }
     else if (e.Button == _tbbPageLast)
     {
         _miPageLast.PerformClick();
     }
 }
        public MainForm()
        {
            System.Threading.Thread.CurrentThread.Name = "Main Thread";                         // to ease debugging
            InitializeComponent();
            // Maximize main window if it was maximized last time...
            try
            {
                DSSettings dsSettings = new DSSettings();
                dsSettings.ReadXml("QESettings.xml");
                // Don't worry if no file / record is present for now - ConnectForm will create one for next time.
                if (dsSettings.settings [0].MdiParentMaximized)
                {
                    WindowState = FormWindowState.Maximized;
                }
            }
            catch (Exception) {}

            // Wire the toolbar buttons to the event handlers already defined for the menu options.
            // Assign the event handlers to the tag property, which can query when toolbar's click event is handled.

            tbConnect.Tag    = new EventHandler(miConnect_Click);
            tbDisconnect.Tag = new EventHandler(miDisconnect_Click);

            tbNew.Tag  = new EventHandler(miNew_Click);
            tbOpen.Tag = new EventHandler(miOpen_Click);
            tbSave.Tag = new EventHandler(miSave_Click);

            tbExecute.Tag = new EventHandler(miExecute_Click);
            tbCancel.Tag  = new EventHandler(miCancel_Click);

            tbHideBrowser.Tag = new EventHandler(miHideBrowser_Click);
            tbHideResults.Tag = new EventHandler(miHideResults_Click);

            tbResultsGrid.Tag = new EventHandler(miResultsGrid_Click);
            tbResultsText.Tag = new EventHandler(miResultsText_Click);

            // Start by displaying the Connection dialog
            miConnect.PerformClick();
        }
Exemple #11
0
        //	Used when the user executes the action of an item (press enter, shortcut)
        //	or a sub-popup menu has to be shown
        void ExecFocusedItem(Menu menu, MenuItem item)
        {
            if (item == null)
            {
                return;
            }

            if (!item.Enabled)
            {
                return;
            }

            if (item.IsPopup)
            {
                ShowSubPopup(menu, item);
            }
            else
            {
                Deactivate();
                item.PerformClick();
            }
        }
        /// <summary>
        /// Ask where the files are located kcor - select lifelog directory
        /// </summary>
        private void askFilesPath()
        {
            string              message = "The current path of your lifelogging folder is \"" + fpath + "\", do you want to change it?";
            string              caption = "Files Path";
            MessageBoxButtons   buttons = MessageBoxButtons.YesNo;
            DialogResult        result1;
            FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();

            // Displays the MessageBox.
            result1 = MessageBox.Show(message, caption, buttons);
            String folderName = "";

            if (result1 == System.Windows.Forms.DialogResult.Yes)
            {
                OpenFileDialog openFileDialog1;
                openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
                DialogResult result     = folderBrowserDialog1.ShowDialog();
                bool         fileOpened = false;
                MenuItem     openMenuItem;
                openMenuItem = new System.Windows.Forms.MenuItem();

                if (result == DialogResult.OK)
                {
                    folderName = folderBrowserDialog1.SelectedPath;
                    if (!fileOpened)
                    {
                        // No file is opened, bring up openFileDialog in selected path.
                        openFileDialog1.InitialDirectory = folderName;
                        openFileDialog1.FileName         = null;
                        openMenuItem.PerformClick();
                    }
                }
                MessageBox.Show("The new path is \"" + folderName + "\".");
            }
            //Store the file path in global
            fpath = folderName;
        }
Exemple #13
0
        public Caffeine()
        {
            trayIcon = new NotifyIcon();

            MenuItem[] menu = new[]
            {
                toggleMenuItem =
                    new MenuItem("Enable Caffeine", new EventHandler(ToggleClicked), Shortcut.None),
                new MenuItem("-"),
                new MenuItem("Quit", new EventHandler(Quit), Shortcut.None),
            };
            trayMenu = new ContextMenu(menu);

            toggleMenuItem.DefaultItem = true;

            trayIcon.ContextMenu = trayMenu;
            trayIcon.DoubleClick += (o, args) => toggleMenuItem.PerformClick();
            trayIcon.Text = "Caffeine";

            Enabled = false;

            Application.ApplicationExit += (o, args) =>
            {
                // Hide the tray icon
                trayIcon.Visible = false;

                // This will quit the wake thread upon the next iteration of its loop.
                Running = false;

                // Interrupt the thread if it's sleeping so that it will quit.
                if (wakeThread.ThreadState == ThreadState.WaitSleepJoin)
                    wakeThread.Interrupt();
            };

            Start();
        }
Exemple #14
0
 // Called on worker thread to invoke a menu command.
 static void InvokeMenuItemHelper(MenuItem m, string args)
 {
     // Need to make cross-thread call to invoke. Don't block since the GUI thread won't pump messages.            
     m_mainForm.BeginInvoke(new MethodInvoker(delegate()
     {
         
         {
             m.PerformClick();
             WriteOutput("Done invoking menu command:" + args);
         }
         /*  */
     }));            
 }
        // Builds and returns a ContextMenu for the tray icon, including menu items for each power plan, one to allow the program to run at startup, and one to exit the program.
        ContextMenu IntializeContextMenu()
        {
            ContextMenu ret = new ContextMenu();

            // get power plans
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.FileName = "cmd";
            startInfo.Arguments = "/C powercfg -l";
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.RedirectStandardOutput = true;
            startInfo.UseShellExecute = false;
            process.StartInfo = startInfo;
            process.Start();

            System.IO.StreamReader output = process.StandardOutput;

            process.WaitForExit();

            // read first three lines of powercfg command to get to the list of power plans
            output.ReadLine();
            output.ReadLine();
            output.ReadLine();

            // read all power plans
            while (!output.EndOfStream)
            {
                String line = output.ReadLine();
                PowerMenuItem pmi = new PowerMenuItem();
                pmi.Guid = line.Split(' ')[3];
                pmi.PlanName = line.Substring(line.IndexOf('(') + 1, line.IndexOf(')') - line.IndexOf('(') - 1);
                pmi.Name = pmi.PlanName;
                pmi.Text = pmi.PlanName;
                pmi.Checked = line.EndsWith("*"); // * indicates that this is the active power plan
                pmi.Click += Pmi_Click;
                ret.MenuItems.Add(pmi);
            }

            // Menu item for running at startup.
            MenuItem runAtStartupItem = new MenuItem("Run At Startup");

            RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
            runAtStartupItem.Click += RunAtStartupItem_Click;
            //runAtStartupItem.Checked = IsStartupItem(rkApp); does not properly update the Checked property for some unkown reason
            runAtStartupItem.PerformClick(); // hacky way to accomplish properly updating the Checked property at startup
            runAtStartupItem.PerformClick();
            ret.MenuItems.Add(runAtStartupItem);

            ret.MenuItems.Add(new MenuItem("Exit", Exit)); // add Exit MenuItem

            return ret;
        }
Exemple #16
0
        private static void Start(string[] args)
        {
            Logger.Title = "DNSAgent - Starting ...";

            var version = Assembly.GetExecutingAssembly().GetName().Version;
            var buildTime = Utils.RetrieveLinkerTimestamp(Assembly.GetExecutingAssembly().Location);
            var programName = string.Format("DNSAgent {0}.{1}.{2}", version.Major, version.Minor, version.Build);
            Logger.Info("{0} (build at {1})\n", programName, buildTime.ToString(CultureInfo.CurrentCulture));
            Logger.Info("Starting...");

            _dnsAgent = new DnsAgent(ReadOptions(), ReadRules());
            if (Environment.UserInteractive)
            {
                var startedWaitHandler = new ManualResetEvent(false);
                _dnsAgent.Started += () => { startedWaitHandler.Set(); };
                if (!_dnsAgent.Start())
                {
                    PressAnyKeyToContinue();
                    return;
                }
                startedWaitHandler.WaitOne();
                Logger.Info("Press Ctrl-R to reload configurations, Ctrl-Q to stop and quit.");

                Task.Run(() =>
                {
                    var exit = false;
                    while (!exit)
                    {
                        var keyInfo = Console.ReadKey(true);
                        if (keyInfo.Modifiers != ConsoleModifiers.Control) continue;
                        switch (keyInfo.Key)
                        {
                            case ConsoleKey.R: // Reload options.cfg and rules.cfg
                                Reload();
                                break;

                            case ConsoleKey.Q:
                                exit = true;
                                Stop();
                                break;
                        }
                    }
                });

                var hideOnStart = _dnsAgent.Options.HideOnStart;
                var hideMenuItem = new MenuItem(hideOnStart ? "Show" : "Hide");
                if (hideOnStart)
                    ShowWindow(GetConsoleWindow(), SwHide);
                hideMenuItem.Click += (sender, eventArgs) =>
                {
                    if (hideMenuItem.Text == "Hide")
                    {
                        ShowWindow(GetConsoleWindow(), SwHide);
                        hideMenuItem.Text = "Show";
                    }
                    else
                    {
                        ShowWindow(GetConsoleWindow(), SwShow);
                        hideMenuItem.Text = "Hide";
                    }
                };
                _contextMenu = new ContextMenu(new[]
                {
                    hideMenuItem,
                    new MenuItem("Reload", (sender, eventArgs) => Reload()),
                    new MenuItem("Exit", (sender, eventArgs) => Stop(false))
                });
                _notifyIcon = new NotifyIcon
                {
                    Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location),
                    ContextMenu = _contextMenu,
                    Text = programName,
                    Visible = true
                };
                _notifyIcon.MouseClick += (sender, eventArgs) =>
                {
                    if (eventArgs.Button == MouseButtons.Left)
                        hideMenuItem.PerformClick();
                };
                Application.Run();
            }
            else
                _dnsAgent.Start();
        }
Exemple #17
0
 private void pictImagem_DoubleClick(object sender, System.EventArgs e)
 {
     MenuItemVisual.PerformClick();
 }
Exemple #18
0
        private static void Start(string[] args)
        {
            Logger.Title = "DNSAgent - Starting ...";

            var version = Assembly.GetExecutingAssembly().GetName().Version;
            var buildTime = Utils.RetrieveLinkerTimestamp(Assembly.GetExecutingAssembly().Location);
            var programName = $"DNSAgent {version.Major}.{version.Minor}.{version.Build}";
            Logger.Info("{0} (build at {1})\n", programName, buildTime.ToString(CultureInfo.CurrentCulture));
            Logger.Info("Starting...");

            var options = ReadOptions();
            var rules = ReadRules();
            var listenEndpoints = options.ListenOn.Split(',');
            var startedEvent = new CountdownEvent(listenEndpoints.Length);
            lock (DnsAgents)
            {
                foreach (var listenOn in listenEndpoints)
                {
                    var agent = new DnsAgent(options, rules, listenOn.Trim(), AgentCommonCache);
                    agent.Started += () => startedEvent.Signal();
                    DnsAgents.Add(agent);
                }
            }
            if (Environment.UserInteractive)
            {
                lock (DnsAgents)
                {
                    if (DnsAgents.Any(agent => !agent.Start()))
                    {
                        PressAnyKeyToContinue();
                        return;
                    }
                }
                startedEvent.Wait();
                Logger.Title = "DNSAgent - Listening ...";
                Logger.Info("DNSAgent has been started.");
                Logger.Info("Press Ctrl-R to reload configurations, Ctrl-Q to stop and quit.");

                Task.Run(() =>
                {
                    var exit = false;
                    while (!exit)
                    {
                        var keyInfo = Console.ReadKey(true);
                        if (keyInfo.Modifiers != ConsoleModifiers.Control) continue;
                        switch (keyInfo.Key)
                        {
                            case ConsoleKey.R: // Reload options.cfg and rules.cfg
                                Reload();
                                break;

                            case ConsoleKey.Q:
                                exit = true;
                                Stop();
                                break;
                        }
                    }
                });

                var hideMenuItem = new MenuItem(options.HideOnStart ? "Show" : "Hide");
                if (options.HideOnStart)
                    ShowWindow(GetConsoleWindow(), SwHide);
                hideMenuItem.Click += (sender, eventArgs) =>
                {
                    if (hideMenuItem.Text == "Hide")
                    {
                        ShowWindow(GetConsoleWindow(), SwHide);
                        hideMenuItem.Text = "Show";
                    }
                    else
                    {
                        ShowWindow(GetConsoleWindow(), SwShow);
                        hideMenuItem.Text = "Hide";
                    }
                };
                _contextMenu = new ContextMenu(new[]
                {
                    hideMenuItem,
                    new MenuItem("Reload", (sender, eventArgs) => Reload()),
                    new MenuItem("Exit", (sender, eventArgs) => Stop(false))
                });
                _notifyIcon = new NotifyIcon
                {
                    Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location),
                    ContextMenu = _contextMenu,
                    Text = programName,
                    Visible = true
                };
                _notifyIcon.MouseClick += (sender, eventArgs) =>
                {
                    if (eventArgs.Button == MouseButtons.Left)
                        hideMenuItem.PerformClick();
                };
                Application.Run();
            }
            else
            {
                lock (DnsAgents)
                {
                    foreach (var agent in DnsAgents)
                    {
                        agent.Start();
                    }
                }
                Logger.Info("DNSAgent has been started.");
            }
        }
Exemple #19
0
		public void InvokedEventTest ()
		{
			MenuItem menuItem = new MenuItem ();
			IRawElementProviderSimple provider = ProviderFactory.GetProvider (menuItem);
			
			bridge.ResetEventLists ();
			
			menuItem.PerformClick ();
			
			Assert.AreEqual (1,
			                 bridge.AutomationEvents.Count,
			                 "event count");
			
			AutomationEventTuple eventInfo =
				bridge.AutomationEvents [0];
			Assert.AreEqual (InvokePatternIdentifiers.InvokedEvent,
			                 eventInfo.eventId,
			                 "event type");
			Assert.AreEqual (provider,
			                 eventInfo.provider,
			                 "event element");
			Assert.AreEqual (InvokePatternIdentifiers.InvokedEvent,
			                 eventInfo.e.EventId,
			                 "event args event type");
		}
Exemple #20
0
		//	Used when the user executes the action of an item (press enter, shortcut)
		//	or a sub-popup menu has to be shown
		void ExecFocusedItem (Menu menu, MenuItem item)
		{
			if (item == null)
				return;

			if (!item.Enabled)
			 	return;
			 	
			if (item.IsPopup) {
				ShowSubPopup (menu, item);
			} else {
				Deactivate ();
				item.PerformClick ();
			}
		}
Exemple #21
0
        private void InitalNotifyIcon()
        {
            SystemParameters.StaticPropertyChanged += SystemParameters_StaticPropertyChanged;

            var notifyIcon = new System.Windows.Forms.NotifyIcon();
            notifyIcon.Text = @"天气日历";
            notifyIcon.Visible = true;
            notifyIcon.Icon = new System.Drawing.Icon(AppDomain.CurrentDomain.BaseDirectory + "NotifyIcon.ico");

            var notifyIconUpdateMenu = new System.Windows.Forms.MenuItem("更新天气");
            notifyIconUpdateMenu.Click += (sender, args) =>
            {
                LoadConfig();
                Task.Factory.StartNew(UpdateWeather);
            };
            var notifyIconTodayMenu = new System.Windows.Forms.MenuItem("今天");
            notifyIconTodayMenu.Click += (sender, args) =>
            {
                ShowDate = DateTime.Now;
                calendar.CurrentDate = ShowDate;
            };
            var notifyIconLastMouthMenu = new System.Windows.Forms.MenuItem("上个月");
            notifyIconLastMouthMenu.Click += (sender, args) =>
            {
                ShowDate = ShowDate.AddMonths(-1);
                calendar.CurrentDate = ShowDate;
            };
            var notifyIconNextMouthMenu = new System.Windows.Forms.MenuItem("下个月");
            notifyIconNextMouthMenu.Click += (sender, args) =>
            {
                ShowDate = ShowDate.AddMonths(1);
                calendar.CurrentDate = ShowDate;
            };
            var notifyIconChangeCityMenu = new System.Windows.Forms.MenuItem("更换城市");
            notifyIconChangeCityMenu.Click += (sender, args) =>
            {
                ChangeCity();
            };

            var notifyIconRestHolidayMenu = new System.Windows.Forms.MenuItem("日历详情");
            notifyIconRestHolidayMenu.Click += (sender, args) =>
            {
                if (rh == null)
                {
                    rh = new RestHolidaySetting();

                    rh.UpdateWeather += () =>
                    {
                        LoadConfig();
                        Task.Factory.StartNew(UpdateWeather);
                    };

                    rh.ChangeCity += ChangeCity;

                    rh.StopWatchOpened += ShowStopWatchWindow;
                }

                rh.Show();
                rh.Activate();
            };

            notifyIconRestHolidayMenu.DefaultItem = true;

            var notifyIconStopWatchMenu = new System.Windows.Forms.MenuItem("秒表");

            notifyIconStopWatchMenu.Click += (sender, args) =>
            {
                ShowStopWatchWindow();
            };

            var notifyIconAboutMenu = new System.Windows.Forms.MenuItem("关于");
            notifyIconAboutMenu.Click += (sender, args) =>
            {
                if (aw == null)
                    aw = new AboutWindow();

                aw.Show();
                aw.Activate();
            };

            var notifyIconCloseMenu = new System.Windows.Forms.MenuItem("退出");
            notifyIconCloseMenu.Click += (sender, args) =>
            {
                notifyIcon.Visible = false;
                Environment.Exit(0);
            };

            var notifyIconMemoryClearMenu = new System.Windows.Forms.MenuItem("内存整理");
            notifyIconMemoryClearMenu.Click += async (sender, args) =>
            {
                notifyIconMemoryClearMenu.Enabled = false;
                await MemoryClear.ClearAsync();
                notifyIconMemoryClearMenu.Enabled = true;
            };

            var notifyIconWorkClearMenu = new System.Windows.Forms.MenuItem("上下班设置");
            notifyIconWorkClearMenu.Click += (sender, args) =>
            {
                var sww = new SetWorkTimeWindow();
                sww.ConfigChanged += () =>
                {
                    Config = ConfigHelper.Instance.Config;
                    UpdateWorkTimeSpan();
                };
                sww.ShowDialog();
            };

            var notifyIconMenu = new[]
            {
                notifyIconRestHolidayMenu,
                notifyIconStopWatchMenu,
                new System.Windows.Forms.MenuItem("-"),
                notifyIconMemoryClearMenu,
                new System.Windows.Forms.MenuItem("-"),
                notifyIconUpdateMenu,
                notifyIconChangeCityMenu,
                notifyIconWorkClearMenu,
                new System.Windows.Forms.MenuItem("-"),
                notifyIconTodayMenu,
                notifyIconLastMouthMenu,
                notifyIconNextMouthMenu,
                new System.Windows.Forms.MenuItem("-"),
                notifyIconAboutMenu,
                new System.Windows.Forms.MenuItem("-"),
                notifyIconCloseMenu
            };

            notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(notifyIconMenu);
            notifyIcon.MouseClick += (sender, args) =>
            {
                if (args.Button == MouseButtons.Right)
                    return;

                notifyIconRestHolidayMenu.PerformClick();
            };

            notifyIcon.DoubleClick += (sender, args) =>
            {
                LoadConfig();

                Task.Factory.StartNew(UpdateWeather);
                notifyIconRestHolidayMenu.PerformClick();
            };
        }
Exemple #22
0
 protected override void OnLoad(System.EventArgs e)
 {
     mnuViewBackground.PerformClick();
 }
Exemple #23
0
 protected override void OnLoad(EventArgs e)
 {
     _160x120MenuItem.PerformClick();
     base.OnLoad(e);
 }