/// <summary> /// Add the array of menu items to the system tray /// </summary> /// <param name="cms">The menu</param> /// <param name="parent">The root of the systray menu</param> public override void getSessionMenuItems(ContextMenuStrip cms, ToolStripItemCollection parent) { // Suspend the layout before modification cms.SuspendLayout(); parent.Clear(); // Setup the System tray array of menu items ToolStripMenuItem[] tsmiArray = new ToolStripMenuItem[getSessionController().getSessionList().Count]; int i = 0; foreach (Session s in getSessionController().getSessionList()) { tsmiArray[i] = new ToolStripMenuItem(s.SessionDisplayText, null, listBox1_DoubleClick); // Make sure the menu item is tagged with the session tsmiArray[i].Tag = s; i++; } if (tsmiArray != null) { parent.AddRange(tsmiArray); } // Now resume the layout cms.ResumeLayout(); }
private void InitializeControls() { m_localDesktopTextBox = new TextBox(); m_localDesktopTitle = new Label(); m_localDesktopCtrlAltHomeLabel = new Label(); m_localDesktopKeyboardBindingLabel = new Label(); m_textBoxes = new TextBox[5]; m_remoteDesktopTitles = new Label[5]; m_ctrlAltHomeLabels = new Label[5]; m_keyboardBindingLabels = new Label[5]; for (int i = 0; i < 5; i++) { m_textBoxes[i] = new TextBox(); m_remoteDesktopTitles[i] = new Label(); m_ctrlAltHomeLabels[i] = new Label(); m_keyboardBindingLabels[i] = new Label(); } m_notifyIcon = new NotifyIcon(components); m_contextMenuStrip = new ContextMenuStrip(components); m_openToolStripMenuItem = new ToolStripMenuItem(); m_exitToolStripMenuItem = new ToolStripMenuItem(); m_saveButton = new Button(); m_saveCloseButton = new Button(); m_contextMenuStrip.SuspendLayout(); SuspendLayout(); }
private void InitializeComponent() { TrayIcon = new NotifyIcon(); TrayIcon.BalloonTipIcon = ToolTipIcon.Info; TrayIcon.Text = "sub.io Server Status"; TrayIcon.Icon = Properties.Resources.TrayIcon; //Optional - Add a context menu to the TrayIcon: TrayIconContextMenu = new ContextMenuStrip(); CloseMenuItem = new ToolStripMenuItem(); TrayIconContextMenu.SuspendLayout(); // // CloseMenuItem // CloseMenuItem.Name = "Close"; CloseMenuItem.Size = new Size(152, 22); CloseMenuItem.Text = "Exit"; CloseMenuItem.Click += new EventHandler(CloseMenuItem_Click); // // TrayIconContextMenu // TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { CloseMenuItem }); TrayIconContextMenu.Name = "Server Statuses"; TrayIconContextMenu.Size = new Size(153, 70); TrayIconContextMenu.ResumeLayout(false); TrayIcon.ContextMenuStrip = TrayIconContextMenu; Task.Run(() => serverUpdater.PollServers()); }
private void InitTray() { TrayIcon = new NotifyIcon(); TrayIcon.Visible = true; TrayIcon.Icon = SystemIcons.Asterisk; TrayIcon.DoubleClick += new System.EventHandler(this.trayTrayIcon_DoubleClick); var ContextMenu = new ContextMenuStrip(); var CloseMenuItem = new ToolStripMenuItem(); ContextMenu.SuspendLayout(); ContextMenu.Items.Add(CloseMenuItem); CloseMenuItem.Name = "ContextMenu"; CloseMenuItem.Text = "Exit"; CloseMenuItem.Click += new EventHandler((e, b) => { _Window.Close(); Environment.Exit(0); }); ContextMenu.ResumeLayout(false); TrayIcon.ContextMenuStrip = ContextMenu; }
public WpfNotifyIcon(string notfiyIconText, IEnumerable <WpfNotifyIconAction> actions) { notifyIcon = new NotifyIcon(); contextMenuStripNotfiyIcon = new ContextMenuStrip(); contextMenuStripNotfiyIcon.SuspendLayout(); // // notifyIcon // notifyIcon.Icon = Properties.Resources.defaultIcon; notifyIcon.Text = "AntiAutoAwake Watcher"; notifyIcon.Visible = true; notifyIcon.ContextMenuStrip = contextMenuStripNotfiyIcon; // // contextMenuStripNotfiyIcon // contextMenuStripNotfiyIcon.Items.AddRange(toolStripMenuItems = CreateItems(actions).ToArray()); contextMenuStripNotfiyIcon.Name = "contextMenuStripNotfiyIcon"; contextMenuStripNotfiyIcon.RenderMode = ToolStripRenderMode.System; //contextMenuStripNotfiyIcon.Size = new System.Drawing.Size(177, 26); contextMenuStripNotfiyIcon.ResumeLayout(false); }
private void InitializeComponent() { _trayIcon = new NotifyIcon(); UpdateIcon(); _trayIcon.MouseClick += TrayIcon_Click; //Optional - Add a context menu to the TrayIcon: _contextMenu = new ContextMenuStrip(); _closeMenuItem = new ToolStripMenuItem(); _contextMenu.SuspendLayout(); // // TrayIconContextMenu // this._contextMenu.Items.AddRange(new ToolStripItem[] { this._closeMenuItem }); this._contextMenu.Name = "TrayIconContextMenu"; this._contextMenu.Size = new Size(153, 70); // // CloseMenuItem // this._closeMenuItem.Name = "CloseMenuItem"; this._closeMenuItem.Size = new Size(152, 22); this._closeMenuItem.Text = "Exit Deprox"; this._closeMenuItem.Click += new EventHandler(this.CloseMenuItem_Click); _contextMenu.ResumeLayout(false); _trayIcon.ContextMenuStrip = _contextMenu; }
//#region Properties //public FormDataEntryLogic DataEntryController { get; set; } //public bool ViewLoading { get { return _viewLoading; } } //public ICollection<Tree> Trees //{ // get // { // return DataService.NonPlotTrees; // } //} //#region DataService //IDataEntryDataService _dataService; //IDataEntryDataService DataService //{ // get { return _dataService; } // set // { // OnDataServiceChanging(); // _dataService = value; // OnDataServiceChanged(); // } //} //void OnDataServiceChanged() //{ // if (_dataService != null) // { // _dataService.EnableLogGradingChanged += HandleEnableLogGradingChanged; // } //} //void OnDataServiceChanging() //{ // if (_dataService != null) // { // _dataService.EnableLogGradingChanged -= HandleEnableLogGradingChanged; // } //} //void HandleEnableLogGradingChanged(object sender, EventArgs e) //{ // if (_logsColumn != null) // { // var logGradingEnabled = DataService.EnableLogGrading; // _logsColumn.Visible = logGradingEnabled; // _logToolStripMenuItem.Text = logGradingEnabled ? // "Disable Log Grading" : "Enable Log Grading"; // } //} //#endregion DataService //#region AppSettings //private ApplicationSettings _appSettings; //public ApplicationSettings AppSettings //{ // get { return _appSettings; } // set // { // OnAppSettingsChanging(); // _appSettings = value; // OnAppSettingsChanged(); // } //} //private void OnAppSettingsChanging() //{ // if (_appSettings != null) // { // _appSettings.CruisersChanged -= Settings_CruisersChanged; // } //} //private void OnAppSettingsChanged() //{ // if (_appSettings != null) // { // _appSettings.CruisersChanged += Settings_CruisersChanged; // } //} //#endregion AppSettings //#endregion Properties ControlTreeDataGrid() { UpdatePageText(); EditMode = DataGridViewEditMode.EditOnEnter; AutoGenerateColumns = false; AllowUserToDeleteRows = false; AllowUserToAddRows = false; CellClick += new DataGridViewCellEventHandler(ControlTreeDataGrid_CellClick); _BS_trees = new BindingSource(); ((System.ComponentModel.ISupportInitialize)_BS_trees).BeginInit(); _BS_trees.DataSource = typeof(Tree); DataSource = _BS_trees; ((System.ComponentModel.ISupportInitialize)_BS_trees).EndInit(); ColumnHeaderMouseClick += new DataGridViewCellMouseEventHandler(ControlTreeDataGrid_ColumnHeaderMouseClick); _logToolStripMenuItem = new ToolStripMenuItem(); _logToolStripMenuItem.Name = "logToolStripMenuItem"; _logToolStripMenuItem.Size = new System.Drawing.Size(180, 22); _logToolStripMenuItem.Click += logToolStripMenuItem_Click; _contexMenu = new ContextMenuStrip(new System.ComponentModel.Container()); _contexMenu.SuspendLayout(); _contexMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { _logToolStripMenuItem }); _contexMenu.Name = "_contexMenu"; _contexMenu.Size = new System.Drawing.Size(181, 26); _contexMenu.ResumeLayout(false); }
private void InitializeComponent() { TrayIcon = new NotifyIcon(); TrayIcon.BalloonTipIcon = ToolTipIcon.Info; TrayIcon.Text = "STORJ Virtual Disk"; TrayIcon.Icon = Properties.Resources.TrayIcon; TrayIconContextMenu = new ContextMenuStrip(); CloseMenuItem = new ToolStripMenuItem(); TrayIconContextMenu.SuspendLayout(); // // TrayIconContextMenu // this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { this.CloseMenuItem }); this.TrayIconContextMenu.Name = "TrayIconContextMenu"; this.TrayIconContextMenu.Size = new Size(153, 70); // // CloseMenuItem // this.CloseMenuItem.Name = "CloseMenuItem"; this.CloseMenuItem.Size = new Size(152, 22); this.CloseMenuItem.Text = "Exit"; this.CloseMenuItem.Click += new EventHandler(this.CloseMenuItem_Click); TrayIconContextMenu.ResumeLayout(false); TrayIcon.ContextMenuStrip = TrayIconContextMenu; }
protected void AddZone(MapZone zone) { TreeNode node = new TreeNode(zone.Name); node.Tag = zone; zonesNode.Nodes.Add(node); ContextMenuStrip menu = new ContextMenuStrip(); menu.ShowCheckMargin = false; menu.ShowImageMargin = false; menu.SuspendLayout(); ToolStripButton button = new ToolStripButton("Load Layer..."); button.Tag = zone; button.Click += new EventHandler(loadLayerHandler); menu.Items.Add(button); menu.ResumeLayout(); // update menu width int w = 0; foreach (ToolStripItem item in menu.Items) { if (item.Width > w) { w = item.Width; } } menu.Width = w; node.ContextMenuStrip = menu; }
private void InitializeComponent() { components = new Container(); lblValueType = new Label(); lblValueName = new Label(); pictureBox1 = new PictureBox(); contextMenuStrip1 = new ContextMenuStrip(components); displayInformationToolStripMenuItem = new ToolStripMenuItem(); toolStripSeparator1 = new ToolStripSeparator(); editValueInPluginToolStripMenuItem = new ToolStripMenuItem(); ((ISupportInitialize)pictureBox1).BeginInit(); contextMenuStrip1.SuspendLayout(); base.SuspendLayout(); lblValueType.Anchor = AnchorStyles.Right | AnchorStyles.Top; lblValueType.Font = new Font("Microsoft Sans Serif", 7f, FontStyle.Regular, GraphicsUnit.Point, 0); lblValueType.Location = new Point(150, 0); lblValueType.Name = "lblValueType"; lblValueType.Size = new Size(50, 30); lblValueType.TabIndex = 15; lblValueType.Text = "color"; lblValueType.TextAlign = ContentAlignment.MiddleLeft; lblValueName.Font = new Font("Microsoft Sans Serif", 7f, FontStyle.Regular, GraphicsUnit.Point, 0); lblValueName.Location = new Point(3, 0); lblValueName.Name = "lblValueName"; lblValueName.Size = new Size(0x66, 30); lblValueName.TabIndex = 14; lblValueName.Text = "name"; lblValueName.TextAlign = ContentAlignment.MiddleLeft; pictureBox1.BorderStyle = BorderStyle.Fixed3D; pictureBox1.Cursor = Cursors.Hand; pictureBox1.Location = new Point(0x7b, 6); pictureBox1.Name = "pictureBox1"; pictureBox1.Size = new Size(20, 20); pictureBox1.TabIndex = 0x10; pictureBox1.TabStop = false; pictureBox1.Click += new EventHandler(pictureBox1_Click); contextMenuStrip1.Items.AddRange(new ToolStripItem[] { displayInformationToolStripMenuItem, toolStripSeparator1, editValueInPluginToolStripMenuItem }); contextMenuStrip1.Name = "contextMenuStrip1"; contextMenuStrip1.Size = new Size(0xb3, 0x36); displayInformationToolStripMenuItem.Name = "displayInformationToolStripMenuItem"; displayInformationToolStripMenuItem.Size = new Size(0xb2, 0x16); displayInformationToolStripMenuItem.Text = "Display Information"; displayInformationToolStripMenuItem.Click += new EventHandler(displayInformationToolStripMenuItem_Click); toolStripSeparator1.Name = "toolStripSeparator1"; toolStripSeparator1.Size = new Size(0xaf, 6); editValueInPluginToolStripMenuItem.Name = "editValueInPluginToolStripMenuItem"; editValueInPluginToolStripMenuItem.Size = new Size(0xb2, 0x16); editValueInPluginToolStripMenuItem.Text = "Edit value in Plugin"; base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = AutoScaleMode.Font; BackColor = SystemColors.Control; base.Controls.Add(lblValueName); base.Controls.Add(pictureBox1); base.Controls.Add(lblValueType); base.Name = "uiColor"; base.Size = new Size(0xde, 30); ((ISupportInitialize)pictureBox1).EndInit(); contextMenuStrip1.ResumeLayout(false); base.ResumeLayout(false); }
public void OnLoad() { Task.Run(async() => { _started = true; await CreateWindow(); Electron.WindowManager.IsQuitOnWindowAllClosed = false; Electron.GlobalShortcut.Register(_config.Keybind, Show); _mainWindow.OnBlur += () => { if (_config.HideAfterLostFocus) { _mainWindow.Hide(); } }; Electron.App.SetLoginItemSettings(new LoginSettings() { OpenAtLogin = _config.RunOnStart }); }); Task.Run(() => { NotifyIcon icon = new NotifyIcon(); icon.Icon = new Icon("icon.ico"); icon.Text = "Show EmojiPad"; var strip = new ContextMenuStrip(); strip.SuspendLayout(); strip.Size = new Size(152, 44); icon.DoubleClick += (sender, args) => { Show(); }; var item1 = new ToolStripMenuItem("Show EmojiPad"); item1.Size = new Size(152, 22); item1.Click += (sender, args) => { Show(); }; var item2 = new ToolStripMenuItem("Exit EmojiPad"); item2.Size = new Size(152, 22); item2.Click += (sender, args) => { try { Electron.App.Exit(); } catch { } }; strip.Items.Add(item1); strip.Items.Add(item2); strip.ResumeLayout(); icon.ContextMenuStrip = strip; icon.Visible = true; Application.Run(); }); }
//--------------------------------------------------------------------------------- private void ButtonClassicRank_Click(object sender, EventArgs e) { ContextMenuStrip contextMenuStrip = new ContextMenuStrip(); contextMenuStrip.SuspendLayout(); ToolStripMenuItem item; string currentCategory = ""; foreach (ClassicRankEnum value in VinceToolbox.Helpers.enumHelper.GetValues <ClassicRankEnum>()) { string category = VinceToolbox.Helpers.enumHelper.GetEnumCategory(value); if (currentCategory != "" && currentCategory != category) { contextMenuStrip.Items.Add(new ToolStripSeparator()); } currentCategory = category; item = new System.Windows.Forms.ToolStripMenuItem(VinceToolbox.Helpers.enumHelper.GetEnumDescription(value), null, OnSetClassicRank); item.Tag = value; if (value == Edited.Desc.ClassicRank) { item.Checked = true; } contextMenuStrip.Items.Add(item); } contextMenuStrip.RightToLeft = RightToLeft.Yes; contextMenuStrip.ResumeLayout(); contextMenuStrip.Show(buttonClassicRank, new Point(-contextMenuStrip.Width + buttonClassicRank.Width, buttonClassicRank.Height)); }
private void InitializeComponent() { TrayIcon = new NotifyIcon(); TrayIcon.Visible = true; TrayIconContextMenu = new ContextMenuStrip(); var _closeMenuItem = new ToolStripMenuItem(); var _opemTMMenuItem = new ToolStripMenuItem(); TrayIconContextMenu.SuspendLayout(); this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { _opemTMMenuItem, _closeMenuItem }); this.TrayIconContextMenu.Name = "cm"; this.TrayIconContextMenu.Size = new Size(153, 70); _closeMenuItem.Name = "miClose"; _closeMenuItem.Size = new Size(152, 22); _closeMenuItem.Text = "Exit"; _closeMenuItem.Click += new EventHandler(this.CloseMenuItem_Click); _opemTMMenuItem.Name = "miOpenTM"; _opemTMMenuItem.Size = new Size(152, 22); _opemTMMenuItem.Text = "Open taskmgr"; _opemTMMenuItem.Click += new EventHandler((o, ea) => { Process.Start("taskmgr"); }); TrayIconContextMenu.ResumeLayout(false); TrayIcon.ContextMenuStrip = TrayIconContextMenu; }
public void InitializeComponent() { // NotifyIcon StatusIcon = new NotifyIcon(); StatusIcon.Visible = true; StatusIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); StatusIcon.DoubleClick += StatusIcon_DoubleClick; // Context Menu TrayIconContextMenu = new ContextMenuStrip(); // ConextMenus StatusTextMenuItem = new ToolStripMenuItem(); CloseMenuItem = new ToolStripMenuItem(); OpenOldFormMenuItem = new ToolStripMenuItem(); SettingsMenuItem = new ToolStripMenuItem(); TrayIconContextMenu.SuspendLayout(); // // TrayIconContextMenu // this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { this.StatusTextMenuItem, this.OpenOldFormMenuItem, this.SettingsMenuItem, this.CloseMenuItem }); this.TrayIconContextMenu.Name = "TrayIconContextMenu"; this.TrayIconContextMenu.Size = new Size(153, 70); // // StatusTextMenuItem // this.StatusTextMenuItem.Name = "StatusTextMenuItem"; this.StatusTextMenuItem.Size = new Size(152, 22); this.StatusTextMenuItem.Text = "FlyAtlantic ACARS"; // // CloseMenuItem // this.CloseMenuItem.Name = "CloseMenuItem"; this.CloseMenuItem.Size = new Size(152, 22); this.CloseMenuItem.Text = "Exit"; this.CloseMenuItem.Click += (s, e) => { Close_Click(this, e); }; // // OpenOldFormMenuItem // this.OpenOldFormMenuItem.Name = "OpenOldFormMenuItem"; this.OpenOldFormMenuItem.Size = new Size(152, 22); this.OpenOldFormMenuItem.Text = "Flight Status"; this.OpenOldFormMenuItem.Click += (s, e) => { OpenFlightStatus_Click(this, e); }; // // SettingsMenuItem // this.SettingsMenuItem.Name = "SettingsMenuItem"; this.SettingsMenuItem.Size = new Size(152, 22); this.SettingsMenuItem.Text = "Settings"; this.SettingsMenuItem.Click += (s, e) => { OpenSettings_Click(this, e); }; TrayIconContextMenu.ResumeLayout(false); StatusIcon.ContextMenuStrip = TrayIconContextMenu; }
private void InitializeComponent() { trayIcon = new NotifyIcon(); //The icon is added to the project resources. trayIcon.Icon = Properties.Resources.blink_off; // TrayIconContextMenu trayIconContextMenu = new ContextMenuStrip(); trayIconContextMenu.SuspendLayout(); trayIconContextMenu.Name = "TrayIconContextMenu"; // Tray Context Menuitems to set color this.trayIconContextMenu.Items.Add("Available", null, new EventHandler(AvailableMenuItem_Click)); this.trayIconContextMenu.Items.Add("Busy", null, new EventHandler(BusyMenuItem_Click)); this.trayIconContextMenu.Items.Add("Away", null, new EventHandler(AwayMenuItem_Click)); this.trayIconContextMenu.Items.Add("Off", null, new EventHandler(OffMenuItem_Click)); // Separation Line this.trayIconContextMenu.Items.Add(new ToolStripSeparator()); // About Form Line this.trayIconContextMenu.Items.Add("About", null, new EventHandler(aboutMenuItem_Click)); // Separation Line this.trayIconContextMenu.Items.Add(new ToolStripSeparator()); // CloseMenuItem this.trayIconContextMenu.Items.Add("Exit", null, new EventHandler(CloseMenuItem_Click)); trayIconContextMenu.ResumeLayout(false); trayIcon.ContextMenuStrip = trayIconContextMenu; }
private void InitializeComponent() { TrayIcon = new NotifyIcon(); TrayIcon.Text = "Display Brightness"; //The icon is added to the project resources. TrayIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); contextMenu = new ContextMenuStrip(); contextMenu.Closed += TrayIconContextMenu_Closed; contextMenu.SuspendLayout(); contextMenu.ShowCheckMargin = false; contextMenu.ShowImageMargin = false; contextMenu.ResumeLayout(false); // Check monitors and populate menu AddMonitors(); // Add a seperator contextMenu.Items.Add(new ToolStripSeparator()); // Add addtional tools ToolsMenuItem toolsMenuItem = new ToolsMenuItem(); toolsMenuItem.ToolsControl.RefreshButton.Click += (s, e) => { RefreshMonitors(); }; contextMenu.Items.Add(toolsMenuItem); TrayIcon.ContextMenuStrip = contextMenu; }
private void InitializeComponent() { TrayIcon = new NotifyIcon(); //Optional - handle doubleclicks on the icon: TrayIcon.DoubleClick += TrayIcon_DoubleClick; //Optional - Add a context menu to the TrayIcon: TrayIconContextMenu = new ContextMenuStrip(); CloseMenuItem = new ToolStripMenuItem(); TrayIconContextMenu.SuspendLayout(); // // TrayIconContextMenu // this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { this.CloseMenuItem }); this.TrayIconContextMenu.Name = "TrayIconContextMenu"; this.TrayIconContextMenu.Size = new Size(153, 70); // // CloseMenuItem // this.CloseMenuItem.Name = "CloseMenuItem"; this.CloseMenuItem.Size = new Size(152, 22); this.CloseMenuItem.Text = "Close the tray icon program"; this.CloseMenuItem.Click += new EventHandler(this.CloseMenuItem_Click); TrayIconContextMenu.ResumeLayout(false); TrayIcon.ContextMenuStrip = TrayIconContextMenu; }
public NotificationApplicationContext() { Application.ApplicationExit += OnApplicationExit; if (!TryGetToken(out _token)) { ExitThread(); } _notifyIcon = new NotifyIcon(); _notifyIcon.Icon = Properties.Resources.TrayIcon; _notifyIcon.Text = "Unicord"; _contextMenu = new ContextMenuStrip(); _contextMenu.SuspendLayout(); _openMenuItem = new ToolStripMenuItem("Open Unicord"); _openMenuItem.Click += OnOpenMenuItemClicked; _contextMenu.Items.Add(_openMenuItem); _contextMenu.Items.Add(new ToolStripSeparator()); _closeMenuItem = new ToolStripMenuItem("Close"); _closeMenuItem.Click += OnCloseMenuItemClicked; _contextMenu.Items.Add(_closeMenuItem); _contextMenu.ResumeLayout(false); _notifyIcon.ContextMenuStrip = _contextMenu; _connectTask = Task.Run(async() => await InitialiseAsync()); _notifyIcon.Visible = true; }
/// <summary>Grid context menu</summary> private void ShowContextMenu(Instrument instr, Point pt) { var cmenu = new ContextMenuStrip(); using (cmenu.SuspendLayout(true)) { { // Add Chart var opt = cmenu.Items.Add2(new ToolStripMenuItem("Add Chart", Resources.graph)); opt.Enabled = instr != null; opt.ToolTipText = "Open a chart for this symbol"; opt.Click += (s, a) => { Model.ShowChart(instr.SymbolCode); }; } { // Clear Cached Data var opt = cmenu.Items.Add2(new ToolStripMenuItem("Purge Cached Data", Resources.recycle)); opt.Enabled = instr != null; opt.ToolTipText = "Flush the cached data for this symbol"; opt.Click += (s, a) => { var r = MsgBox.Show(this, "Purge cache price data for {0}?".Fmt(instr.SymbolCode), "Purge Data", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (r == DialogResult.Yes) { Model.MarketData.PurgeCachedInstrument(instr.SymbolCode); } }; } } cmenu.Show(this, pt); }
private void InitializeComponent() { TrayIcon = new NotifyIcon(); TrayIcon.BalloonTipIcon = ToolTipIcon.Info; TrayIcon.BalloonTipText = "I noticed that you double-clicked me! What can I do for you?"; TrayIcon.BalloonTipTitle = "You called Master?"; TrayIcon.Text = "My fabulous tray icon demo application"; //The icon is added to the project resources. //Here I assume that the name of the file is 'TrayIcon.ico' TrayIcon.Icon = Properties.Resources._5491974_Lhk_icon; //Optional - handle doubleclicks on the icon: TrayIcon.DoubleClick += TrayIcon_DoubleClick; //Optional - Add a context menu to the TrayIcon: TrayIconContextMenu = new ContextMenuStrip(); CloseMenuItem = new ToolStripMenuItem(); SettingMenuItem = new ToolStripMenuItem(); TestMenuItem = new ToolStripMenuItem(); TrayIconContextMenu.SuspendLayout(); // // TrayIconContextMenu // this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { this.CloseMenuItem, this.SettingMenuItem, this.TestMenuItem }); this.TrayIconContextMenu.Name = "TrayIconContextMenu"; this.TrayIconContextMenu.Size = new Size(153, 70); // // CloseMenuItem // this.CloseMenuItem.Name = "CloseMenuItem1"; this.CloseMenuItem.Size = new Size(152, 22); this.CloseMenuItem.Text = "خروج"; this.CloseMenuItem.Click += new EventHandler(this.CloseMenuItem_Click); // // SettingMenuItem // this.SettingMenuItem.Name = "SettingMenuItem1"; this.SettingMenuItem.Size = new Size(152, 22); this.SettingMenuItem.Text = "تنظیمات"; this.SettingMenuItem.Click += new EventHandler(this.SettingMenuItem_Click); // // SettingMenuItem // this.TestMenuItem.Name = "TestMenuItem1"; this.TestMenuItem.Size = new Size(152, 22); this.TestMenuItem.Text = "Test"; this.TestMenuItem.Click += new EventHandler(this.TestMenuItem_Click); TrayIconContextMenu.ResumeLayout(false); TrayIcon.ContextMenuStrip = TrayIconContextMenu; }
private void InitializeComponent() { Components = new Container(); cms = new ContextMenuStrip(Components); extract = new ToolStripMenuItem(); verify = new ToolStripMenuItem(); cms.SuspendLayout(); SuspendLayout(); cms.Items.AddRange(new ToolStripItem[] { extract, verify }); cms.Name = "CMS"; cms.Size = new Size(119, 48); cms.Opening += Cms_Opening; extract.Name = "Extract"; extract.Size = new Size(118, 22); extract.Text = "E&xtract"; extract.Click += Extract_Click; verify.Name = "Verify"; verify.Size = new Size(118, 22); verify.Text = "&Verify"; verify.Click += Verify_Click; ContextMenuStrip = cms; HideSelection = false; LineColor = Color.Blue; AfterSelect += FolderTreeView_AfterSelect; MouseDown += FolderTreeView_MouseDown; cms.ResumeLayout(); ResumeLayout(); }
private void FireSymbolSelected(object sender, EventArgs e) { ToolStripMenuItem tsmi = (ToolStripMenuItem)sender; symbolButton.Text = tsmi.Text; this.SuspendLayout(); instrumentButtonDropDown.SuspendLayout(); instrumentButton.SuspendLayout(); instrumentButtonDropDown.Items.Clear(); instrumentButton.Text = "Instrument..."; foreach (Instrument instrument in controller.Cache.Instruments) { if (tsmi.Tag.Equals(instrument[DatabaseObject.SYMBOL])) { ToolStripMenuItem instrument_tsmi = new ToolStripMenuItem(); instrument_tsmi.Name = instrument[DatabaseObject.INSTRUMENT_ID]; instrument_tsmi.Text = instrument[DatabaseObject.NAME]; instrument_tsmi.Size = new System.Drawing.Size(188, 22); instrument_tsmi.Click += new EventHandler(FireInstrumentSelected); instrument_tsmi.Tag = instrument; instrumentButtonDropDown.Items.Add(instrument_tsmi); } } instrumentButtonDropDown.ResumeLayout(); instrumentButton.ResumeLayout(); this.ResumeLayout(); }
private void InitializeComponent() { trayIcon = new NotifyIcon(); trayIcon.BalloonTipIcon = ToolTipIcon.Info; trayIcon.BalloonTipText = "Timeshit is running..."; trayIcon.BalloonTipTitle = "..."; trayIcon.Text = "Timeshit logger."; trayIcon.Icon = Resources.Icon1; trayIcon.Visible = true; trayIcon.DoubleClick += trayIcon_DoubleClick; trayIconContextMenu = new ContextMenuStrip(); closeMenuItem = new ToolStripMenuItem(); trayIconContextMenu.SuspendLayout(); trayIconContextMenu.Items.Add(this.closeMenuItem); trayIconContextMenu.Name = "TrayIconContextMenu"; trayIconContextMenu.Size = new Size(153, 70); closeMenuItem.Name = "CloseMenuItem"; closeMenuItem.Size = new Size(152, 22); closeMenuItem.Text = "Exit"; closeMenuItem.Click += CloseMenuItemOnClick; trayIconContextMenu.ResumeLayout(false); trayIcon.ContextMenuStrip = trayIconContextMenu; Scheduler.Instance.InitTimer(Settings.Instance.Interval); Scheduler.Instance.StartTimer(); }
private void AddContextMenuItems(ContextMenuStrip menu, IEnumerable <ToolStripItem> items, ToolStripItem insertAfter = null) { menu.SuspendLayout(); int index = insertAfter is null ? 0 : Math.Max(0, menu.Items.IndexOf(insertAfter) + 1); items.ForEach(item => menu.Items.Insert(index++, item)); menu.ResumeLayout(); }
private void InitializeComponent() { _components = new Container(); _contextMenu = new ContextMenuStrip(_components); _copyMenuItem = new ToolStripMenuItem(); _pasteMenuItem = new ToolStripMenuItem(); _deleteMenuItem = new ToolStripMenuItem(); _cutMenuItem = new ToolStripMenuItem(); _contextMenu.SuspendLayout(); ((ISupportInitialize)this).BeginInit(); SuspendLayout(); // // contextMenu // _contextMenu.Items.AddRange(new ToolStripItem[] { _cutMenuItem, _copyMenuItem, _pasteMenuItem, _deleteMenuItem }); _contextMenu.Name = "_contextMenu"; _contextMenu.Size = new Size(165, 100); // // copyMenuItem // _copyMenuItem.Name = "_copyMenuItem"; _copyMenuItem.ShortcutKeys = Keys.Control | Keys.C; _copyMenuItem.Size = new Size(164, 24); _copyMenuItem.Text = "Copy"; // // pasteMenuItem // _pasteMenuItem.Name = "_pasteMenuItem"; _pasteMenuItem.ShortcutKeys = Keys.Control | Keys.V; _pasteMenuItem.Size = new Size(164, 24); _pasteMenuItem.Text = "Paste"; // // deleteMenuItem // _deleteMenuItem.Name = "_deleteMenuItem"; _deleteMenuItem.ShortcutKeys = Keys.Delete; _deleteMenuItem.Size = new Size(164, 24); _deleteMenuItem.Text = "Delete"; // // cutMenuItem // _cutMenuItem.Name = "_cutMenuItem"; _cutMenuItem.ShortcutKeys = Keys.Control | Keys.X; _cutMenuItem.Size = new Size(164, 24); _cutMenuItem.Text = "Cut"; // // AbstractInputLog // RowTemplate.Height = 24; _contextMenu.ResumeLayout(false); ((ISupportInitialize)this).EndInit(); ResumeLayout(false); }
private void InitializeComponent() { components = new Container(); txtArrayBox = new TextBox(); lblByteCount = new Label(); lblValueName = new Label(); contextMenuStrip1 = new ContextMenuStrip(components); displayInformationToolStripMenuItem = new ToolStripMenuItem(); toolStripSeparator1 = new ToolStripSeparator(); editValueInPluginToolStripMenuItem = new ToolStripMenuItem(); contextMenuStrip1.SuspendLayout(); base.SuspendLayout(); txtArrayBox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top; txtArrayBox.Location = new Point(0xb8, 5); txtArrayBox.Multiline = true; txtArrayBox.Name = "txtArrayBox"; txtArrayBox.Size = new Size(0x9d, 0x45); txtArrayBox.TabIndex = 0x13; txtArrayBox.TextChanged += new EventHandler(txtArrayBox_TextChanged); lblByteCount.Anchor = AnchorStyles.Right | AnchorStyles.Top; lblByteCount.Font = new Font("Microsoft Sans Serif", 7f, FontStyle.Regular, GraphicsUnit.Point, 0); lblByteCount.Location = new Point(0x15b, 5); lblByteCount.Name = "lblByteCount"; lblByteCount.Size = new Size(50, 0x18); lblByteCount.TabIndex = 0x12; lblByteCount.Text = "(32)"; lblByteCount.TextAlign = ContentAlignment.MiddleLeft; lblValueName.Font = new Font("Microsoft Sans Serif", 7f, FontStyle.Regular, GraphicsUnit.Point, 0); lblValueName.Location = new Point(3, 0); lblValueName.Name = "lblValueName"; lblValueName.Size = new Size(0xaf, 30); lblValueName.TabIndex = 0x11; lblValueName.Text = "name"; lblValueName.TextAlign = ContentAlignment.MiddleLeft; contextMenuStrip1.Items.AddRange(new ToolStripItem[] { displayInformationToolStripMenuItem, toolStripSeparator1, editValueInPluginToolStripMenuItem }); contextMenuStrip1.Name = "contextMenuStrip1"; contextMenuStrip1.Size = new Size(0xb3, 0x4c); displayInformationToolStripMenuItem.Name = "displayInformationToolStripMenuItem"; displayInformationToolStripMenuItem.Size = new Size(0xb2, 0x16); displayInformationToolStripMenuItem.Text = "Display Information"; displayInformationToolStripMenuItem.Click += new EventHandler(displayInformationToolStripMenuItem_Click); toolStripSeparator1.Name = "toolStripSeparator1"; toolStripSeparator1.Size = new Size(0xaf, 6); editValueInPluginToolStripMenuItem.Name = "editValueInPluginToolStripMenuItem"; editValueInPluginToolStripMenuItem.Size = new Size(0xb2, 0x16); editValueInPluginToolStripMenuItem.Text = "Edit value in Plugin"; base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = AutoScaleMode.Font; BackColor = SystemColors.Control; base.Controls.Add(txtArrayBox); base.Controls.Add(lblByteCount); base.Controls.Add(lblValueName); base.Name = "uiByteArray"; base.Size = new Size(400, 0x4f); contextMenuStrip1.ResumeLayout(false); base.ResumeLayout(false); base.PerformLayout(); }
private void InitializeComponent() { _trayIcon = new NotifyIcon { BalloonTipIcon = ToolTipIcon.Info, BalloonTipTitle = " AutoRotate ", Text = "AutoRotate Rotate the screen with Raspberry Pi", Icon = Resources.TrayIcon }; //The icon is added to the project resources. //Here I assume that the name of the file is 'TrayIcon.ico' //Optional - handle doubleclicks on the icon: _trayIcon.DoubleClick += TrayIcon_DoubleClick; //Optional - Add a context menu to the TrayIcon: _trayIconContextMenu = new ContextMenuStrip(); _closeMenuItem = new ToolStripMenuItem(); _aboutMenuItem = new ToolStripMenuItem(); _startUpMenuItem = new ToolStripMenuItem(); _trayIconContextMenu.SuspendLayout(); // // TrayIconContextMenu // _trayIconContextMenu.Items.AddRange(new ToolStripItem[] { _startUpMenuItem, _aboutMenuItem, _closeMenuItem }); _trayIconContextMenu.Name = "_trayIconContextMenu"; _trayIconContextMenu.Size = new Size(153, 70); // // CloseMenuItem // _closeMenuItem.Name = "_closeMenuItem"; _closeMenuItem.Size = new Size(152, 22); _closeMenuItem.Text = "Close the program"; _closeMenuItem.Click += new EventHandler(this.CloseMenuItem_Click); // // AboutMenuItem // _aboutMenuItem.Name = "_aboutMenuItem"; _aboutMenuItem.Size = new Size(152, 22); _aboutMenuItem.Text = "About"; _aboutMenuItem.Click += new EventHandler(this.AboutMenuItem_Click); // // _startUpMenuItem // _startUpMenuItem.Name = "_startUpMenuItem"; _startUpMenuItem.Size = new Size(152, 22); _startUpMenuItem.Text = "Start with windows"; _startUpMenuItem.Click += new EventHandler(this.StartUpMenuItem_Click); _startUpMenuItem.Checked = _settings.Checked; _trayIconContextMenu.ResumeLayout(false); _trayIcon.ContextMenuStrip = _trayIconContextMenu; ARTask(); }
private void InitializeComponent() { TrayIcon = new NotifyIcon { BalloonTipIcon = ToolTipIcon.Info, BalloonTipText = "I noticed that you double-clicked me! What can I do for you?", BalloonTipTitle = "You called Master?", Text = "Yumapos test client", Icon = Resources.Resource.TrayIcon }; MainWindow = new MainForm(); MainWindow.Show(); MainWindow.MainWindowModel.Stopped += OnApplicationExit; //The icon is added to the project resources. //Here I assume that the name of the file is 'TrayIcon.ico' //Optional - handle doubleclicks on the icon: TrayIcon.Click += TrayIcon_Click; TrayIcon.DoubleClick += TrayIcon_DoubleClick; //Optional - Add a context menu to the TrayIcon: TrayIconContextMenu = new ContextMenuStrip(); CloseMenuItem = new ToolStripMenuItem(); ShowMenuItem = new ToolStripMenuItem(); TrayIconContextMenu.SuspendLayout(); // // TrayIconContextMenu // this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { ShowMenuItem, new ToolStripSeparator(), CloseMenuItem }); this.TrayIconContextMenu.Name = "TrayIconContextMenu"; this.TrayIconContextMenu.Size = new Size(153, 70); // // CloseMenuItem // this.CloseMenuItem.Name = "CloseMenuItem"; this.CloseMenuItem.Size = new Size(152, 22); this.CloseMenuItem.Text = "Exit"; this.CloseMenuItem.Click += new EventHandler(this.CloseMenuItem_Click); // // ShowMenuItem // this.ShowMenuItem.Name = "ShowMenuItem"; this.ShowMenuItem.Size = new Size(152, 22); this.ShowMenuItem.Text = "Open window"; this.ShowMenuItem.Click += new EventHandler(this.ShowMenuItem_Click); TrayIconContextMenu.ResumeLayout(false); TrayIcon.ContextMenuStrip = TrayIconContextMenu; App = Bootstrapper.GetObjectInstance <App>(); App.WindowModel = MainWindow.MainWindowModel; TaskScheduler.UnobservedTaskException += ErrorHandler; Task.Factory.StartNew(App.Start, TaskCreationOptions.LongRunning); }
private void InitializeComponent() { lock (ContextMenuLock) { TrayIcon = new NotifyIcon(); Application.ApplicationExit += new EventHandler(this.OnApplicationExit); TrayIcon.BalloonTipText = "I am monitoring your computer for fullscreen programs and idle time!"; TrayIcon.BalloonTipIcon = ToolTipIcon.None; TrayIcon.Text = "IdleMon"; TrayIcon.Icon = MiningService.Properties.Resources.TrayIcon; //Optional - handle doubleclicks on the icon: TrayIcon.DoubleClick += TrayIcon_DoubleClick; //TrayIcon.MouseUp += TrayIcon_MouseUp; //Optional - Add a context menu to the TrayIcon: TrayIconContextMenu = new ContextMenuStrip(); CloseMenuItem = new ToolStripMenuItem(); PauseMenuItem = new ToolStripMenuItem(); IgnoreFullscreenMenuItem = new ToolStripMenuItem(); TrayIconContextMenu.SuspendLayout(); // TrayIconContextMenu this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { this.CloseMenuItem, this.PauseMenuItem, this.IgnoreFullscreenMenuItem }); this.TrayIconContextMenu.Name = "TrayIconContextMenu"; this.TrayIconContextMenu.Size = new Size(153, 70); // CloseMenuItem this.CloseMenuItem.Name = "CloseMenuItem"; this.CloseMenuItem.Size = new Size(152, 22); this.CloseMenuItem.Text = "Exit IdleMon"; this.CloseMenuItem.Click += new EventHandler(this.CloseMenuItem_Click); // PauseMenuItem this.PauseMenuItem.Name = "PauseMenuItem"; this.PauseMenuItem.Size = new Size(152, 22); this.PauseMenuItem.Text = "Pause mining"; this.PauseMenuItem.Click += new EventHandler(this.PauseMenuItem_Click); // IgnoreFullscreenMenuItem this.IgnoreFullscreenMenuItem.Name = "IgnoreFullscreenMenuItem"; this.IgnoreFullscreenMenuItem.Size = new Size(152, 22); this.IgnoreFullscreenMenuItem.Text = "Ignore Fullscreen App: "; this.IgnoreFullscreenMenuItem.Click += new EventHandler(this.IgnoreFullscreenMenuItem_Click); this.IgnoreFullscreenMenuItem.Visible = false; TrayIconContextMenu.ResumeLayout(true); TrayIcon.ContextMenuStrip = TrayIconContextMenu; TrayIcon.Visible = true; } }
private void InitializeComponent() { TrayIcon = new NotifyIcon(); TrayIcon.Text = Name; /////////////////////////////////////////////////////////////////////////// // Set m_icon from resource string resourceName = "icon.ico"; var assembly = Assembly.GetExecutingAssembly(); resourceName = typeof(App).Namespace + "." + resourceName.Replace(" ", "_") .Replace("\\", ".").Replace("/", "."); using (Stream stream = assembly.GetManifestResourceStream(resourceName)) //The icon is added to the project resources. //Here I assume that the name of the file is 'TrayIcon.ico' TrayIcon.Icon = new Icon(stream); //Properties.Resources.TrayIcon; //Optional - handle doubleclicks on the icon: TrayIcon.MouseClick += (se, ev) => { switch (ev.Button) { case MouseButtons.Right: break; case MouseButtons.Left: if (OnClick != null) { OnClick(); } break; } }; //Optional - Add a context menu to the TrayIcon: TrayIconContextMenu = new ContextMenuStrip(); ToolStripMenuItem mn_close = new ToolStripMenuItem() { Text = "Close " + Name }; mn_close.Click += new EventHandler(this.CloseMenuItem_Click); // // TrayIconContextMenu // TrayIconContextMenu.SuspendLayout(); TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { mn_close }); TrayIconContextMenu.Name = "TrayIconContextMenu"; TrayIconContextMenu.Size = new Size(153, 70); TrayIconContextMenu.ResumeLayout(false); TrayIcon.ContextMenuStrip = TrayIconContextMenu; }