Inheritance: ToolStripDropDownItem
Exemple #1
1
        public override bool Loaded()
        {
            Grid.Host2 = Host;

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GridUI));
            var temp = (string)(resources.GetObject("$this.Text"));

            but = new ToolStripMenuItem(temp);
            but.Click += but_Click;

            bool hit = false;
            ToolStripItemCollection col = Host.FPMenuMap.Items;
            int index = col.Count;
            foreach (ToolStripItem item in col)
            {
                if (item.Text.Equals(Strings.AutoWP))
                {
                    index = col.IndexOf(item);
                    ((ToolStripMenuItem)item).DropDownItems.Add(but);
                    hit = true;
                    break;
                }
            }

            if (hit == false)
                col.Add(but);

            return true;
        }
 /// <summary>
 /// Initializes a new instance of the MRU manager with the specified item to be used as a placeholder for where the MRU items will be placed.
 /// </summary>
 /// <param name="placeHolderItem">This should be a <see cref="ToolStripMenuItem"/> on the menu where you want the MRU items to be placed.</param>
 public MruMenuStripManager(ToolStripMenuItem placeHolderItem)
 {
     if (placeHolderItem == null)
         throw new ArgumentNullException(nameof(placeHolderItem));
     _placeHolderItem = placeHolderItem;
     LoadPreferences();
 }
Exemple #3
0
        private void ProcessWatchTimer_Tick(object sender, EventArgs e) {

            while (qadd.Count > 0) {
                PolProcess pol = new PolProcess(qadd.Dequeue());
                ToolStripMenuItem menuItem = new ToolStripMenuItem(pol.Title);
                menuItem.Tag = pol;
                WindowerMenuItemProcess.DropDownItems.Add(menuItem);
            }

            while (qdel.Count > 0) {
                Process p = qdel.Dequeue();
                foreach (ToolStripMenuItem menuItem in WindowerMenuItemProcess.DropDownItems) {
                    PolProcess pol = (PolProcess) menuItem.Tag;
                    if (pol != null && pol.Pid == p.Id) {
                        WindowerMenuItemProcess.DropDownItems.Remove(menuItem);
                        break;
                    }
                }
            }

            if (WindowerMenuItemProcess.DropDownItems.Count == 1) {
                ToolStripMenuItem menuItem = (ToolStripMenuItem) WindowerMenuItemProcess.DropDownItems[0];
                if (_windower == null || !menuItem.Checked)
                    WindowerMenuItemProcess_DropDownItemClicked(this, new ToolStripItemClickedEventArgs(menuItem));
            }

            if (_windower != null && WindowerMenuItemProcess.DropDownItems.Count == 0) {
                _windower = null;
                WindowerInstanceChanged.Invoke(this, new EventArgs());
            }

            ProcessWatchTimerTick.Invoke(this, new EventArgs());
        }
 private void AddMenuItems() {
     var toolsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;
     m_toolsSeparator = new ToolStripSeparator();
     toolsMenu.Add(m_toolsSeparator);
     m_mainPopup = new ToolStripMenuItem();
     m_mainPopup.Text = "KeePassQiniu";
     toolsMenu.Add(m_mainPopup);
     m_uploadToolItem = new ToolStripMenuItem();
     m_uploadToolItem.Text = "立即上传";
     m_uploadToolItem.Click += OnMenuBackupNow;
     m_uploadToolItem.Enabled = false;
     m_mainPopup.DropDownItems.Add(m_uploadToolItem);
     m_downToolItem = new ToolStripMenuItem();
     m_downToolItem.Text = "立即下载";
     m_downToolItem.Click += OnMenuDown;
     m_downToolItem.Enabled = true;
     m_mainPopup.DropDownItems.Add(m_downToolItem);
     m_toolsSeparator = new ToolStripSeparator();
     m_mainPopup.DropDownItems.Add(m_toolsSeparator);
     var autoBackup = new ToolStripMenuItem();
     autoBackup.Text = "自动同步";
     autoBackup.Checked = KeePassQiniuConfig.Default.AutoSync;
     autoBackup.Click += OnMenuAutomaticBackup;
     autoBackup.Enabled = true;
     m_mainPopup.DropDownItems.Add(autoBackup);
     var configure = new ToolStripMenuItem();
     configure.Text = "配置...";
     configure.Click += OnMenuConfig;
     configure.Enabled = true;
     m_mainPopup.DropDownItems.Add(configure);
 }
        public PlanningGridExtDisplayObject(string name, Color maxColor, Color minColor)
            : base(name, maxColor, minColor)
        {
            string[] gridTypes = Enum.GetNames(typeof(PlanningGrids));
            PlanningGrids[] values = (PlanningGrids[])Enum.GetValues(typeof(PlanningGrids));

            ToolStripMenuItem menuGetGrid = new ToolStripMenuItem("Get Grid");

            for (int i = 0; i < gridTypes.Length; i++) {
                ToolStripMenuItem gridItem = new ToolStripMenuItem();
                gridItem.Text = gridTypes[i];
                gridItem.Tag = values[i];
                gridItem.Click += new EventHandler(gridItem_Click);

                menuGetGrid.DropDownItems.Add(gridItem);
            }

            ToolStripMenuItem menuSetMaxColor = new ToolStripMenuItem("Set Max Color", null, menuSetMaxColor_Click);
            ToolStripMenuItem menuSetMinColor = new ToolStripMenuItem("Set Min Color", null, menuSetMinColor_Click);

            menuItems = new ToolStripMenuItem[] { menuGetGrid, menuSetMaxColor, menuSetMinColor };

            colorDialog = new ColorDialog();
            colorDialog.AnyColor = true;
            colorDialog.AllowFullOpen = true;
            colorDialog.FullOpen = true;
        }
        internal ObedienceContext()
        {
            //Instantiate the component Module to hold everything
            _components = new System.ComponentModel.Container();
            Trace.Listeners.Add(new TextWriterTraceListener("C:\\temp\\Obedience.log"));
            
            //Instantiate the NotifyIcon attaching it to the components container and 
            //provide it an icon, note, you can imbed this resource 
            _notifyIcon = new NotifyIcon(_components);
            _notifyIcon.Icon = Resources.AppIcon;
            _notifyIcon.Text = "Obedience";
            _notifyIcon.Visible = true;

            //Instantiate the context menu and items
            var contextMenu = new ContextMenuStrip();
            var displayForm = new ToolStripMenuItem();
            var exitApplication = new ToolStripMenuItem();

            //Attach the menu to the notify icon
            _notifyIcon.ContextMenuStrip = contextMenu;

            //Setup the items and add them to the menu strip, adding handlers to be created later
            displayForm.Text = "Do something";
            displayForm.Click += mDisplayForm_Click;
            contextMenu.Items.Add(displayForm);

            exitApplication.Text = "Exit";
            exitApplication.Click += mExitApplication_Click;
            contextMenu.Items.Add(exitApplication);
            Trace.WriteLine("Obedience started");
            scanner = new AcdController(new IPEndPoint(new IPAddress(new byte[] {10, 0, 3, 220}), 5003));
            //scanner.Reboot();
            Trace.AutoFlush = true;
            scanner.ConnectedChanged += new ConnectedChangedEventHandler(scanner_ConnectedChanged);
        }
Exemple #7
0
 private void maakHelpMenu()
 {
     ToolStripDropDownItem menu;
     menu = new ToolStripMenuItem("Help");
     menu.DropDownItems.Add("Over \"Schets\"", null, this.about);
     menuStrip.Items.Add(menu);
 }
        private void InitMenuStrip()
        {
            // New strip menu item
            opt_menuitem_dic_ = new Dictionary<uint, ToolStripMenuItem>();
            foreach (var opt in Public.opt_name_dic_.Keys)
            {
                opt_menuitem_dic_[opt] = new ToolStripMenuItem();
            }
            exit_item_ = new ToolStripMenuItem();

            // Set property
            menuitem_opt_dic_ = new Dictionary<ToolStripMenuItem, uint>();
            foreach (KeyValuePair<uint, ToolStripMenuItem> item in opt_menuitem_dic_)
            {
                uint opt = item.Key;
                ToolStripMenuItem menu_item = item.Value;
                menuitem_opt_dic_[menu_item] = opt;
                menu_item.Text = Public.opt_name_dic_[opt];
                menu_item.Click += new EventHandler(this.opt_menuitemClick);
            }
            exit_item_.Text = "退出";
            exit_item_.Click += new EventHandler(this.exit_toolstripItemClick);

            // Notify Menu
            notify_menu_ = new ContextMenuStrip();

            notify_menu_.Items.Add(opt_menuitem_dic_[TExcState.AWAY_MODE]);
            notify_menu_.Items.Add(opt_menuitem_dic_[TExcState.DISPLAY_REQ]);
            notify_menu_.Items.Add(opt_menuitem_dic_[TExcState.SYS_REQ]);
            notify_menu_.Items.Add(new ToolStripSeparator());
            notify_menu_.Items.Add(opt_menuitem_dic_[TExcState.AWAKE_IN_LID_CLODE]);
            notify_menu_.Items.Add(new ToolStripSeparator());
            notify_menu_.Items.Add(exit_item_);
        }
        private ToolStripMenuItem FileMenu()
        {
            var itemFile = new ToolStripMenuItem(Language.T("File"));

            ItemSaveAs = new ToolStripMenuItem(Language.T("Save As") + "...");
            ItemSaveAs.Click += SaveAsOnClick;
            itemFile.DropDownItems.Add(ItemSaveAs);

            var item = new ToolStripMenuItem(Language.T("Page Setup") + "...");
            item.Click += PageSetupOnClick;
            itemFile.DropDownItems.Add(item);

            ItemPrint = new ToolStripMenuItem(Language.T("Print") + "...") {ShortcutKeys = Keys.Control | Keys.P};
            ItemPrint.Click += PrintDialogOnClick;
            itemFile.DropDownItems.Add(ItemPrint);

            ItemPreview = new ToolStripMenuItem(Language.T("Print Preview") + "...");
            ItemPreview.Click += PreviewOnClick;
            itemFile.DropDownItems.Add(ItemPreview);

            itemFile.DropDownItems.Add(new ToolStripSeparator());

            ItemProps = new ToolStripMenuItem(Language.T("Properties") + "...");
            ItemProps.Click += PropertiesOnClick;
            itemFile.DropDownItems.Add(ItemProps);

            itemFile.DropDownItems.Add(new ToolStripSeparator());

            item = new ToolStripMenuItem(Language.T("Exit"));
            item.Click += ExitOnClick;
            itemFile.DropDownItems.Add(item);

            return itemFile;
        }
        /// <summary>
        /// Is the About box displayed?
        /// </summary>
        //bool isAboutLoaded = false;
        /// <summary>
        /// Creates this instance.
        /// </summary>
        /// <returns>ContextMenuStrip</returns>
        public ContextMenuStrip Create()
        {
            // Add the default menu options.
            ContextMenuStrip menu = new ContextMenuStrip();
            ToolStripMenuItem item;
            //ToolStripSeparator sep;

            // Windows Explorer.
            item = new ToolStripMenuItem();
            item.Text = "Submit Ticket";
            item.Click += new EventHandler(Explorer_Click);
            item.Image = Resources.Explorer;
            menu.Items.Add(item);

            //Printer
            item = new ToolStripMenuItem();
            item.Text = "Manage Printers";
            item.Click += new EventHandler(Print_Click);
            item.Image = Resources.Exit;
            menu.Items.Add(item);

            // About.
            item = new ToolStripMenuItem();
            item.Text = "About";
            item.Click += new EventHandler(About_Click);
            item.Image = Resources.About;
            menu.Items.Add(item);

            // Separator.
            //sep = new ToolStripSeparator();
            //menu.Items.Add(sep);

            return menu;
        }
        /// <summary>
        /// Creates this instance.
        /// </summary>
        /// <returns>ContextMenuStrip</returns>
        public ContextMenuStrip Create()
        {
            // Add the default menu options.
            ContextMenuStrip menu = new ContextMenuStrip();
            ToolStripMenuItem item;
            ToolStripSeparator sep;

            this._textmodeItem = new ToolStripMenuItem();

            this._textmodeItem.Text = "Text mode";
            this._textmodeItem.Enabled = false;
            menu.Items.Add(this._textmodeItem);

            this.SetTextModeText(BopomofoRegistry.IsSimplifiedEnable(), false);

            // About.
            item = new ToolStripMenuItem();
            item.Text = "About";
            item.Click += new EventHandler(this.About_Click);
            menu.Items.Add(item);

            // Separator.
            sep = new ToolStripSeparator();
            menu.Items.Add(sep);

            // Exit.
            item = new ToolStripMenuItem();
            item.Text = "Exit";
            item.Click += new System.EventHandler(this.Exit_Click);
            menu.Items.Add(item);

            return menu;
        }
Exemple #12
0
        public MainForm()
        {
            InitializeComponent();
            _defaultContextMenuStripBackColor = contextMenuStrip1.Items[0].BackColor;
            var defaultTasks = Settings.Default.DefaultTasks.Split(';');
            foreach (var defaultTask in defaultTasks)
                comboBox1.Items.Add(defaultTask);
            foreach (var item in comboBox1.Items)
            {
                _taskList.AddTask(item.ToString());
                var toolStripItem = new ToolStripMenuItem {Text = item.ToString()};
                toolStripItem.MouseUp += ToolStripItemMouseUp;
                contextMenuStrip1.Items.Add(toolStripItem);
            }
            for (var i = 0; i < contextMenuStrip1.Items.Count; i++)
                if (contextMenuStrip1.Items[i].Text.Equals("Beenden"))
                {
                    _contextMenuTaskStartIndex = i + 2;
                    break;
                }

            SetTrayTaskListColors(defaultTasks[0]);
            TopMostToolStripMenuItem.Checked = Settings.Default.AlwaysOnTop;
            TopMost = TopMostToolStripMenuItem.Checked;
            autoHideToolStripMenuItem.Checked = Settings.Default.AutoHide;

            //set version information
            versionToolStripMenuItem.Text = string.Format("Über {0} v{1}", Application.ProductName,
                                                          Application.ProductVersion);
        }
        private void BuildConfigItems()
        {
            ClearConfigItems();

            var config = Configuration.Load();

            if (config.ProfileConfigurations.Any())
            {
                var menuItem = new ToolStripSeparator();
                _configItems.Add(menuItem);
                _trayMenu.Items.Add(menuItem);
            }

            foreach (var profileConfig in config.ProfileConfigurations)
            {
                var isSelected = profileConfig.Name.ToLowerInvariant() == config.CurrentConfiguration.ToLowerInvariant();
                var menuItem = new ToolStripMenuItem(profileConfig.Name);
                menuItem.CheckOnClick = true;
                menuItem.Checked = isSelected;
                menuItem.Tag = profileConfig.Name;
                menuItem.Click += (sender, e) => { SelectConfiguration(((ToolStripMenuItem)sender).Tag.ToString()); };
                _configItems.Add(menuItem);
                _trayMenu.Items.Add(menuItem);
            }
        }
Exemple #14
0
 public void Load(Form parentForm, ToolStripMenuItem editorMenu)
 {
     m_Parent = parentForm;
     m_MenuItem = editorMenu.DropDownItems.Add("Edit map...");
     m_MenuItem.Click += new EventHandler(m_MenuItem_Click);
     m_MenuItem.Tag = this; // Required !
 }
Exemple #15
0
        public TrayIcon()
        {
            _updateMenuItem = new ToolStripMenuItem(TrayIconStrings.NoUpdate, Resources.Update, OnUpdateClick) {Enabled = false};
            _trayIcon.ContextMenuStrip = _settingsMenu;

            _availablePlaybackDevices = AppModel.Instance.AvailablePlaybackDevices;
            _availableRecordingDevices = AppModel.Instance.AvailableRecordingDevices;

            PopulateSettingsMenu();

            _selectionMenu.Items.Add(TrayIconStrings.NoDevSel, Resources.Settings, (sender, e) => ShowSettings());

            _trayIcon.MouseClick += (sender, e) =>
            {
                if (e.Button == MouseButtons.Left)
                {
                    UpdateDeviceSelectionList();
                    _trayIcon.ContextMenuStrip = _selectionMenu;
                    var mi = typeof (NotifyIcon).GetMethod("ShowContextMenu",
                        BindingFlags.Instance | BindingFlags.NonPublic);
                    mi.Invoke(_trayIcon, null);

                    _trayIcon.ContextMenuStrip = _settingsMenu;
                }
            };
            UpdateDeviceSelectionList();
            SetEventHandlers();
        }
Exemple #16
0
		/// <summary>
		/// ! - Makes the menu invisible
		/// * - Makes the menu not enabled
		/// ^ - Makes the menu checked (text after this gets parsed as a boolean)
		/// : - text after this gets parsed as a Keys enum string
		/// # - text after this sets the menu's tooltip text
		/// </summary>
		/// <param name="name"></param>
		/// <param name="OnClick"></param>
		/// <returns></returns>
		public static ToolStripMenuItem CreateMenuItem(string name, System.EventHandler OnClick)
		{
			ToolStripMenuItem value = new ToolStripMenuItem();
			value.Click += OnClick;
			MenuItemParseName(value, ref name);
			return value;
		}
        /// <summary>
        /// Initializes the plugin using the specified KeePass host.
        /// </summary>
        /// <param name="host">The plugin host.</param>
        /// <returns></returns>
        public override bool Initialize(IPluginHost host)
        {
            Debug.Assert(host != null);
            if(host == null) return false;
            m_host = host;

            // Add a seperator and menu item to the 'Tools' menu
            ToolStripItemCollection tsMenu = m_host.MainWindow.ToolsMenu.DropDownItems;
            m_tsSeparator1 = new ToolStripSeparator();
            tsMenu.Add(m_tsSeparator1);
            menuDownloadFavicons = new ToolStripMenuItem();
            menuDownloadFavicons.Text = "Download Favicons for all entries";
            menuDownloadFavicons.Click += OnMenuDownloadFavicons;
            tsMenu.Add(menuDownloadFavicons);

            // Add a seperator and menu item to the group context menu
            ContextMenuStrip gcm = m_host.MainWindow.GroupContextMenu;
            m_tsSeparator2 = new ToolStripSeparator();
            gcm.Items.Add(m_tsSeparator2);
            menuDownloadGroupFavicons = new ToolStripMenuItem();
            menuDownloadGroupFavicons.Text = "Download Favicons";
            menuDownloadGroupFavicons.Click += OnMenuDownloadGroupFavicons;
            gcm.Items.Add(menuDownloadGroupFavicons);

            // Add a seperator and menu item to the entry context menu
            ContextMenuStrip ecm = m_host.MainWindow.EntryContextMenu;
            m_tsSeparator3 = new ToolStripSeparator();
            ecm.Items.Add(m_tsSeparator3);
            menuDownloadEntryFavicons = new ToolStripMenuItem();
            menuDownloadEntryFavicons.Text = "Download Favicons";
            menuDownloadEntryFavicons.Click += OnMenuDownloadEntryFavicons;
            ecm.Items.Add(menuDownloadEntryFavicons);

            return true; // Initialization successful
        }
        public ToolStripMenuItem ToolStripMenuItemWithHandler(string displayText, EventHandler eventHandler)
        {
            var item = new ToolStripMenuItem(displayText);
            if (eventHandler != null) { item.Click += eventHandler; }

            return item;
        }
        public ImportDataForm( )
        {
            ImportData_Initialize();

            Port = 0;
            IsMale = true;
            Server = string.Empty;
            Base = string.Empty;
            Username = string.Empty;
            Password = string.Empty;
            Connection = null;

            if( Settings.Default.RecentMySqlConnection != null )
            {
                var sqlToolStrip = new ToolStripMenuItem( Settings.Default.RecentMySqlConnection.Database );
                sqlToolStrip.Click += ImportData_Menu_UseRecent_onClick;
                connectToolStripMenuItem.DropDownItems.Add(sqlToolStrip);
                connectToolStripMenuItem.Enabled = true;
            }

            if( Settings.Default.RecentXmlPath == string.Empty ) return;

            var xmlToolStrip = new ToolStripMenuItem(Path.GetFileName(Settings.Default.RecentXmlPath));
            xmlToolStrip.Click += ImportData_Menu_UseRecent_onClick;
            connectToolStripMenuItem.DropDownItems.Add(xmlToolStrip);
            connectToolStripMenuItem.Enabled = true;
        }
Exemple #20
0
 private ToolStripMenuItem AboutItem()
 {
     ToolStripMenuItem aboutItem = new ToolStripMenuItem("About...");
     aboutItem.Image = Properties.Resources.data_out;
     aboutItem.Click += new EventHandler(AboutItem_Click);
     return aboutItem;
 }
        private void Init()
        {
            //
            // RestoreMenuItem
            //
            this.RestoreMenuItem = new ToolStripMenuItem();
            this.RestoreMenuItem.Name = "RestoreMenuItem";
            //this.RestoreMenuItem.Size = new System.Drawing.Size(125, 22);
            this.RestoreMenuItem.Text = "Restore site";
            this.RestoreMenuItem.Click += new EventHandler(RestoreMenuItem_Click);
            //
            // Tasks MenuStrip
            //
            TasksMenuItem = SPMMenu.Items.CreateTasks();
            TasksMenuItem.DropDownItems.AddRange(
                new ToolStripItem[] {
                    this.RestoreMenuItem,
                });

            //
            // SiteCollectionMenuStrip
            //
            //this.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            //this.TasksMenuItem,
            //SPMMenu.Items.CreateSeparator(),
            //SPMMenu.Items.CreateRefresh()

            this.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            SPMMenu.Items.CreateRefresh()
            });
            this.Name = "SiteCollectionMenuStrip";
            this.Size = new System.Drawing.Size(126, 52);
        }
Exemple #22
0
 private ToolStripMenuItem ScriptItem()
 {
     ToolStripMenuItem scriptItem = new ToolStripMenuItem("New Query Editor Window");
     scriptItem.Tag = Output.Editor;
     scriptItem.Click += new EventHandler(item_Click);
     return scriptItem;
 }
 public QuickRemove(ToolStripMenuItem menu, IGraph g, INode objNode, String file)
 {
     this._menu = menu;
     this._g = g;
     this._objNode = objNode;
     this._file = file;
 }
Exemple #24
0
 private ToolStripMenuItem FileItem()
 {
     ToolStripMenuItem fileItem = new ToolStripMenuItem("File...");
     fileItem.Tag = Output.File;
     fileItem.Click += new EventHandler(item_Click);
     return fileItem;
 }
 public MdiControlStrip(IWin32Window target)
 {
     IntPtr systemMenu = System.Windows.Forms.UnsafeNativeMethods.GetSystemMenu(new HandleRef(this, Control.GetSafeHandle(target)), false);
     this.target = target;
     this.minimize = new ControlBoxMenuItem(systemMenu, 0xf020, target);
     this.close = new ControlBoxMenuItem(systemMenu, 0xf060, target);
     this.restore = new ControlBoxMenuItem(systemMenu, 0xf120, target);
     this.system = new SystemMenuItem();
     Control control = target as Control;
     if (control != null)
     {
         control.HandleCreated += new EventHandler(this.OnTargetWindowHandleRecreated);
         control.Disposed += new EventHandler(this.OnTargetWindowDisposed);
     }
     this.Items.AddRange(new ToolStripItem[] { this.minimize, this.restore, this.close, this.system });
     base.SuspendLayout();
     foreach (ToolStripItem item in this.Items)
     {
         item.DisplayStyle = ToolStripItemDisplayStyle.Image;
         item.MergeIndex = 0;
         item.MergeAction = MergeAction.Insert;
         item.Overflow = ToolStripItemOverflow.Never;
         item.Alignment = ToolStripItemAlignment.Right;
         item.Padding = Padding.Empty;
     }
     this.system.Image = this.GetTargetWindowIcon();
     this.system.Alignment = ToolStripItemAlignment.Left;
     this.system.DropDownOpening += new EventHandler(this.OnSystemMenuDropDownOpening);
     this.system.ImageScaling = ToolStripItemImageScaling.None;
     this.system.DoubleClickEnabled = true;
     this.system.DoubleClick += new EventHandler(this.OnSystemMenuDoubleClick);
     this.system.Padding = Padding.Empty;
     this.system.ShortcutKeys = Keys.Alt | Keys.OemMinus;
     base.ResumeLayout(false);
 }
Exemple #26
0
 private ToolStripMenuItem ClipboardItem()
 {
     ToolStripMenuItem clipboardItem = new ToolStripMenuItem("Clipboard");
     clipboardItem.Tag = Output.Clipboard;
     clipboardItem.Click += new EventHandler(item_Click);
     return clipboardItem;
 }
		void InterlinDocForAnalysis_RightMouseClickedEvent(SimpleRootSite sender, FwRightMouseClickEventArgs e)
		{
			e.EventHandled = true;
			// for the moment we always claim to have handled it.
			ContextMenuStrip menu = new ContextMenuStrip();

			// Add spelling items if any (i.e., if we clicked a squiggle word).
			int hvoObj, tagAnchor;
			if (GetTagAndObjForOnePropSelection(e.Selection, out hvoObj, out tagAnchor) &&
				(tagAnchor == SegmentTags.kflidFreeTranslation || tagAnchor == SegmentTags.kflidLiteralTranslation ||
				tagAnchor == NoteTags.kflidContent))
			{
				var helper = new SpellCheckHelper(Cache);
				helper.MakeSpellCheckMenuOptions(e.MouseLocation, this, menu);
			}

			int hvoNote;
			if (CanDeleteNote(e.Selection, out hvoNote))
			{
				if (menu.Items.Count > 0)
				{
					menu.Items.Add(new ToolStripSeparator());
				}
				// Add the delete item.
				string sMenuText = ITextStrings.ksDeleteNote;
				ToolStripMenuItem item = new ToolStripMenuItem(sMenuText);
				item.Click += OnDeleteNote;
				menu.Items.Add(item);
			}
			if (menu.Items.Count > 0)
			{
				e.Selection.Install();
				menu.Show(this, e.MouseLocation);
			}
		}
        public ContextMenuStrip GetDefaultMenu()
        {
            ContextMenuStrip menu = new ContextMenuStrip();

            ToolStripMenuItem openSettingsItem = new ToolStripMenuItem();
            openSettingsItem.Text = "Settings...";
            openSettingsItem.Click += SettingsClick;
            menu.Items.Add(openSettingsItem);

            ToolStripMenuItem pauseItem = new ToolStripMenuItem();
            pauseItem.Text = "Pause";
            pauseItem.Click += PauseProgram;
            menu.Items.Add(pauseItem);

            ToolStripMenuItem resumeItem = new ToolStripMenuItem();
            resumeItem.Text = "Resume";
            resumeItem.Click += ResumeProgram;
            menu.Items.Add(resumeItem);

            menu.Items.Add("-");

            ToolStripMenuItem exitItem = new ToolStripMenuItem();
            exitItem.Text = "Exit";
            exitItem.Click += new EventHandler(ExitClick);
            menu.Items.Add(exitItem);

            return menu;
        }
Exemple #29
0
        public TaskBarIconMenu()
        {
            TrayIcon_Menu = new ContextMenuStrip();
            TrayIcon_Artist = new ToolStripLabel();
            TrayIcon_Title = new ToolStripLabel();
            TrayIcon_Diff = new ToolStripLabel();
            TrayIcon_Play = new ToolStripMenuItem();
            TrayIcon_PlayNext = new ToolStripMenuItem();
            TrayIcon_PlayPrev = new ToolStripMenuItem();
            TrayIcon_Exit = new ToolStripMenuItem();
            TrayIcon_Menu.SuspendLayout();

            TrayIcon_Menu.Items.AddRange(new ToolStripItem[] {
                TrayIcon_Artist,
                TrayIcon_Title,
                TrayIcon_Diff,
                TrayIcon_Play,
                TrayIcon_PlayNext,
                TrayIcon_PlayPrev,
                TrayIcon_Exit});
            TrayIcon_Menu.Name = "TrayIcon_Menu";
            TrayIcon_Menu.Size = new Size(176, 176);
            // TrayIcon_Artist
            TrayIcon_Artist.Name = "TrayIcon_Artist";
            TrayIcon_Artist.Text = LanguageManager.Get("TrayIcon_Aritst_Text");
            TrayIcon_Artist.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 134);
            // TrayIcon_Title
            TrayIcon_Title.Name = "TrayIcon_Title";
            TrayIcon_Title.Text = LanguageManager.Get("TrayIcon_Title_Text");
            TrayIcon_Title.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 134);
            // TrayIcon_Diff
            TrayIcon_Diff.Name = "TrayIcon_Diff";
            TrayIcon_Diff.Text = LanguageManager.Get("TrayIcon_Diff_Text");
            TrayIcon_Diff.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Bold, GraphicsUnit.Point, 134);
            // TrayIcon_Play
            TrayIcon_Play.Name = "TrayIcon_Play";
            TrayIcon_Play.Text = LanguageManager.Get("TrayIcon_Play_Pause_Text");
            TrayIcon_Play.Click += delegate { SendKeys.Send("%{F5}"); };
            // TrayIcon_PlayNext
            TrayIcon_PlayNext.Name = "TrayIcon_PlayNext";
            TrayIcon_PlayNext.Text = LanguageManager.Get("TrayIcon_PlayNext_Text");
            TrayIcon_PlayNext.Click += delegate { SendKeys.Send("%{RIGHT}"); };
            // TrayIcon_PlayNext
            TrayIcon_PlayPrev.Name = "TrayIcon_PlayPrev";
            TrayIcon_PlayPrev.Text = LanguageManager.Get("TrayIcon_PlayPrev_Text");
            TrayIcon_PlayPrev.Click += delegate { SendKeys.Send("%{LEFT}"); };
            // TrayIcon_Exit
            TrayIcon_Exit.Name = "TrayIcon_Exit";
            TrayIcon_Exit.Text = LanguageManager.Get("TrayIcon_Exit_Text");
            TrayIcon_Exit.Click += delegate
            {
                if (
                    MessageBox.Show(LanguageManager.Get("Comfirm_Exit_Text"), LanguageManager.Get("Tip_Text"),
                        MessageBoxButtons.YesNo) != DialogResult.Yes) return;
                Core.MainIsVisible = false;
                Core.Exit();
                Environment.Exit(0);
            };
            TrayIcon_Menu.ResumeLayout(false);
        }
Exemple #30
0
 public HotkeySetting(Keys hotkey, string tag, Action action, ToolStripMenuItem menuItem = null)
     : this(hotkey)
 {
     Tag = tag;
     Action = action;
     MenuItem = menuItem;
 }