Esempio n. 1
0
		static bool IsChecked (ToolStripItem toolStripItem)
		{
			ToolStripButton tool_strip_button = toolStripItem as ToolStripButton;
			if (tool_strip_button == null)
				return false;
			return tool_strip_button.Checked;
		}
 public static void SetStatusLabel(ToolStripItem _label, string Text)
 {
     if (_label.GetCurrentParent().InvokeRequired)
     {
         _label.GetCurrentParent().Invoke(new MethodInvoker(delegate
         {
             _label.Text = Text;
         }));
     }
     else
     {
         _label.Text = Text;
     }
 }
		public int Add (ToolStripItem value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");
			
			if (Contains (value))
				return IndexOf (value);

			value.InternalOwner = owner;
				
			//if (value is ToolStripMenuItem && (value as ToolStripMenuItem).ShortcutKeys != Keys.None)
			//	ToolStripManager.AddToolStripMenuItem ((ToolStripMenuItem)value);
				
			int index = base.Add (value);
			value.Index = index;
			if (this.internal_created)
				owner.OnItemAdded (new ToolStripItemEventArgs (value));
				
			return index;
		}
		public void Insert (int index, ToolStripItem value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");

			//if (value is ToolStripMenuItem && (value as ToolStripMenuItem).ShortcutKeys != Keys.None)
			//	ToolStripManager.AddToolStripMenuItem ((ToolStripMenuItem)value);

			if (value.Owner != null)
				value.Owner.Items.Remove (value);
				
			base.Insert (index, value);
			
			if (internal_created) {
				value.InternalOwner = owner;
				owner.OnItemAdded (new ToolStripItemEventArgs (value));
			}
			
			if (owner.Created)
				owner.PerformLayout ();
		}
Esempio n. 5
0
        public void InsertItemBefore(ToolStripMenuItem menuItem, ToolStripItem thingOnRight)
        {
            int indexOfKey = _menuStrip.Items.IndexOf(thingOnRight);

            _menuStrip.Items.Insert(Math.Max(indexOfKey, 0), menuItem);
        }
 // Constructors
 public ToolStripItemAccessibleObject(ToolStripItem ownerItem)
 {
 }
 // Methods
 public void AddRange(ToolStripItem[] toolStripItems)
 {
 }
 public void Insert(int index, ToolStripItem value)
 {
 }
 public ToolStripItemImageRenderEventArgs(System.Drawing.Graphics g, ToolStripItem item, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle)
 {
 }
Esempio n. 10
0
        Rectangle GetBackgroundRectangle(ToolStripItem item)
        {
            if (!item.IsOnDropDown)
                return new Rectangle(new Point(), item.Bounds.Size);

            // For a drop-down menu item, the background rectangles of the items should be touching vertically.
            // This ensures that's the case.
            Rectangle rect = item.Bounds;

            // The background rectangle should be inset two pixels horizontally (on both sides), but we have 
            // to take into account the border.
            rect.X = item.ContentRectangle.X + 1;
            rect.Width = item.ContentRectangle.Width - 1;

            // Make sure we're using all of the vertical space, so that the edges touch.
            rect.Y = 0;
            return rect;
        }
 // Constructors
 public ToolStripArrowRenderEventArgs(System.Drawing.Graphics g, ToolStripItem toolStripItem, System.Drawing.Rectangle arrowRectangle, System.Drawing.Color arrowColor, ArrowDirection arrowDirection)
 {
 }
Esempio n. 12
0
        private void botonesForm1_ClickEventDelegateHandler(object sender, EventArgs e)
        {
            ToolStripItem miboton = (ToolStripItem)sender;

            //MessageBox.Show("tocaste un boton, boton " + miboton.Name + " TAB " + miboton.Tag);



            switch (miboton.Tag.ToString())
            {
            case "EDIT": {
                this.panelcarga.Visible    = true;
                this.panelbusqueda.Visible = false;

                // INSERTE SU CODIGO

                //botonesForm1.configMododeEdicion(ABMBotonesForm.VIEW);
                // botonesForm1.configMododeEdicion(ABMBotonesForm.EDIT);

                break;
            }

            case "ADD":
            {
                this.modoEdicion.Text      = "NO";
                this.panelcarga.Visible    = true;
                this.panelbusqueda.Visible = false;
                var registroBlanco = serviceModel.ObtenerRegistroBlanco();

                // INSERTE SU CODIGO

                botonesForm1.configMododeEdicion(ABMBotonesForm.ADD);
                break;
            }

            case "FIND":
            {
                //serviceConciliaciones.obtenerUsuariosConciliaciones();
                IEnumerable <Object> listadeConciliaciones = serviceModel.ObtenerRegistros(this.fechadesde.Value, this.fechahasta.Value, this.cbUsuariosConciliaciones.Text);

                this.cargarDataGridViewBusqueda(dataGridView2, listadeConciliaciones);

                this.modoEdicion.Text      = "NO";
                this.panelcarga.Visible    = false;
                this.panelbusqueda.Visible = true;
                botonesForm1.configMododeEdicion(ABMBotonesForm.FIND);
                break;
            }

            case "OK":
            {
                if (this.modoEdicion.Text == "NO")
                {
                    if (!altaRegistro())
                    {
                        break;
                    }
                }
                else
                {
                    if (!ediciondeRegistro())
                    {
                        break;
                    }
                }

                //cargarCombo(this.cbUsuariosConciliaciones, serviceConciliaciones.obtenerUsuariosConciliaciones());
                this.modoEdicion.Text = "NO";
                var btnFind = new ToolStripButton();
                btnFind.Tag = "FIND";
                MessageBox.Show("La operación se ha realizado con éxito.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Information);
                botonesForm1_ClickEventDelegateHandler(btnFind, null);
                break;
            }

            case "CANCEL":
            {
                this.modoEdicion.Text      = "NO";
                this.panelcarga.Visible    = false;
                this.panelbusqueda.Visible = true;
                botonesForm1.configMododeEdicion(ABMBotonesForm.CANCEL);
                break;
            }

            case "DELETE":
            {
                this.modoEdicion.Text = "NO";
                foreach (DataGridViewRow row in dataGridView2.SelectedRows)
                {
                    Object       unRegistro   = serviceModel.ObtenerRegistro(row.Cells["ID"].Value.ToString());
                    DialogResult dialogResult = MessageBox.Show("Confirma la eliminación del registro ", "Atención", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dialogResult == DialogResult.No)
                    {
                        break;
                    }
                    // COMLETAR ELIMINACION
                    serviceModel.AnularRegistro(unRegistro);
                    MessageBox.Show("La operación se ha realizado con éxito.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                var btnFind = new ToolStripButton();
                btnFind.Tag = "FIND";
                botonesForm1_ClickEventDelegateHandler(btnFind, null);
                break;
            }

            case "EXIT":
            {
                this.Close();
                break;
            }
            }
        }
Esempio n. 13
0
        private void InitializeComponent()
        {
            DataGridViewCellStyle    style   = new DataGridViewCellStyle();
            DataGridViewCellStyle    style2  = new DataGridViewCellStyle();
            DataGridViewCellStyle    style3  = new DataGridViewCellStyle();
            DataGridViewCellStyle    style4  = new DataGridViewCellStyle();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(fmAccountDashboard));

            this.menuStripNewMessage           = new MenuStrip();
            this.editToolStripMenuItem         = new ToolStripMenuItem();
            this.editAccountsToolStripMenuItem = new ToolStripMenuItem();
            this.optionsToolStripMenuItem      = new ToolStripMenuItem();
            this.settingsToolStripMenuItem     = new ToolStripMenuItem();
            this.toolStripSeparator2           = new ToolStripSeparator();
            this.openDashboardWithUnreadReminderToolStripMenuItem = new ToolStripMenuItem();
            this.helpToolStripMenuItem         = new ToolStripMenuItem();
            this.generalHelpToolStripMenuItem  = new ToolStripMenuItem();
            this.settingsHelpToolStripMenuItem = new ToolStripMenuItem();
            this.toolStripSeparator1           = new ToolStripSeparator();
            this.exitToolStripMenuItem         = new ToolStripMenuItem();
            this.syncFeaturesToolStripMenuItem = new ToolStripMenuItem();
            this.versionToolStripMenuItem      = new ToolStripMenuItem();
            this.dataGridViewAccounts          = new DataGridView();
            this.colPhoneNumber           = new DataGridViewTextBoxColumn();
            this.colTitle                 = new DataGridViewTextBoxColumn();
            this.colUnReadCount           = new DataGridViewTextBoxColumn();
            this.colOldestUnRead          = new DataGridViewTextBoxColumn();
            this.colLastSyncDate          = new DataGridViewTextBoxColumn();
            this.colConnectionStatus      = new DataGridViewTextBoxColumn();
            this.buttonRefresh            = new Button();
            this.labelTotalAccounts       = new Label();
            this.labelTotalUnread         = new Label();
            this.checkBoxFullRefresh      = new CheckBox();
            this.tryBETAToolStripMenuItem = new ToolStripMenuItem();
            this.menuStripNewMessage.SuspendLayout();
            ((ISupportInitialize)this.dataGridViewAccounts).BeginInit();
            base.SuspendLayout();
            ToolStripItem[] toolStripItems = new ToolStripItem[] { this.editToolStripMenuItem, this.optionsToolStripMenuItem, this.helpToolStripMenuItem };
            this.menuStripNewMessage.Items.AddRange(toolStripItems);
            this.menuStripNewMessage.Location = new Point(0, 0);
            this.menuStripNewMessage.Name     = "menuStripNewMessage";
            this.menuStripNewMessage.Size     = new Size(640, 0x18);
            this.menuStripNewMessage.TabIndex = 8;
            this.menuStripNewMessage.Text     = "menuStrip1";
            ToolStripItem[] itemArray2 = new ToolStripItem[] { this.editAccountsToolStripMenuItem };
            this.editToolStripMenuItem.DropDownItems.AddRange(itemArray2);
            this.editToolStripMenuItem.Name           = "editToolStripMenuItem";
            this.editToolStripMenuItem.Size           = new Size(0x27, 20);
            this.editToolStripMenuItem.Text           = "&Edit";
            this.editAccountsToolStripMenuItem.Name   = "editAccountsToolStripMenuItem";
            this.editAccountsToolStripMenuItem.Size   = new Size(0x93, 0x16);
            this.editAccountsToolStripMenuItem.Text   = "Edit &Accounts";
            this.editAccountsToolStripMenuItem.Click += new EventHandler(this.editAccountsToolStripMenuItem_Click);
            ToolStripItem[] itemArray3 = new ToolStripItem[] { this.settingsToolStripMenuItem, this.toolStripSeparator2, this.openDashboardWithUnreadReminderToolStripMenuItem };
            this.optionsToolStripMenuItem.DropDownItems.AddRange(itemArray3);
            this.optionsToolStripMenuItem.Name             = "optionsToolStripMenuItem";
            this.optionsToolStripMenuItem.Size             = new Size(0x3d, 20);
            this.optionsToolStripMenuItem.Text             = "&Options";
            this.optionsToolStripMenuItem.DropDownOpening += new EventHandler(this.optionsToolStripMenuItem_DropDownOpening);
            this.settingsToolStripMenuItem.Name            = "settingsToolStripMenuItem";
            this.settingsToolStripMenuItem.Size            = new Size(0x11e, 0x16);
            this.settingsToolStripMenuItem.Text            = "&Settings";
            this.settingsToolStripMenuItem.Click          += new EventHandler(this.settingsToolStripMenuItem_Click);
            this.toolStripSeparator2.Name = "toolStripSeparator2";
            this.toolStripSeparator2.Size = new Size(0x11b, 6);
            this.openDashboardWithUnreadReminderToolStripMenuItem.CheckOnClick = true;
            this.openDashboardWithUnreadReminderToolStripMenuItem.Name         = "openDashboardWithUnreadReminderToolStripMenuItem";
            this.openDashboardWithUnreadReminderToolStripMenuItem.Size         = new Size(0x11e, 0x16);
            this.openDashboardWithUnreadReminderToolStripMenuItem.Text         = "Open Dashboard With Unread Reminder";
            this.openDashboardWithUnreadReminderToolStripMenuItem.Click       += new EventHandler(this.openDashboardWithUnreadReminderToolStripMenuItem_Click);
            ToolStripItem[] itemArray4 = new ToolStripItem[] { this.generalHelpToolStripMenuItem, this.settingsHelpToolStripMenuItem, this.toolStripSeparator1, this.exitToolStripMenuItem, this.syncFeaturesToolStripMenuItem, this.versionToolStripMenuItem, this.tryBETAToolStripMenuItem };
            this.helpToolStripMenuItem.DropDownItems.AddRange(itemArray4);
            this.helpToolStripMenuItem.Name                    = "helpToolStripMenuItem";
            this.helpToolStripMenuItem.Size                    = new Size(0x2c, 20);
            this.helpToolStripMenuItem.Text                    = "&Help";
            this.generalHelpToolStripMenuItem.Name             = "generalHelpToolStripMenuItem";
            this.generalHelpToolStripMenuItem.Size             = new Size(0x98, 0x16);
            this.generalHelpToolStripMenuItem.Text             = "General Help";
            this.generalHelpToolStripMenuItem.Click           += new EventHandler(this.generalHelpToolStripMenuItem_Click);
            this.settingsHelpToolStripMenuItem.Name            = "settingsHelpToolStripMenuItem";
            this.settingsHelpToolStripMenuItem.Size            = new Size(0x98, 0x16);
            this.settingsHelpToolStripMenuItem.Text            = "Settings Help";
            this.settingsHelpToolStripMenuItem.Click          += new EventHandler(this.settingsHelpToolStripMenuItem_Click);
            this.toolStripSeparator1.Name                      = "toolStripSeparator1";
            this.toolStripSeparator1.Size                      = new Size(0x95, 6);
            this.exitToolStripMenuItem.Name                    = "exitToolStripMenuItem";
            this.exitToolStripMenuItem.Size                    = new Size(0x98, 0x16);
            this.exitToolStripMenuItem.Text                    = "Exit";
            this.exitToolStripMenuItem.Click                  += new EventHandler(this.exitToolStripMenuItem_Click);
            this.syncFeaturesToolStripMenuItem.Name            = "syncFeaturesToolStripMenuItem";
            this.syncFeaturesToolStripMenuItem.Size            = new Size(0x98, 0x16);
            this.syncFeaturesToolStripMenuItem.Text            = "Sync Features";
            this.syncFeaturesToolStripMenuItem.Click          += new EventHandler(this.syncFeaturesToolStripMenuItem_Click);
            this.versionToolStripMenuItem.Name                 = "versionToolStripMenuItem";
            this.versionToolStripMenuItem.Size                 = new Size(0x98, 0x16);
            this.versionToolStripMenuItem.Text                 = "Version";
            this.versionToolStripMenuItem.Click               += new EventHandler(this.versionToolStripMenuItem_Click);
            this.dataGridViewAccounts.AllowUserToAddRows       = false;
            this.dataGridViewAccounts.AllowUserToDeleteRows    = false;
            this.dataGridViewAccounts.AllowUserToResizeRows    = false;
            this.dataGridViewAccounts.Anchor                   = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.dataGridViewAccounts.AutoSizeColumnsMode      = DataGridViewAutoSizeColumnsMode.Fill;
            this.dataGridViewAccounts.AutoSizeRowsMode         = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;
            this.dataGridViewAccounts.BackgroundColor          = SystemColors.Control;
            this.dataGridViewAccounts.BorderStyle              = BorderStyle.None;
            this.dataGridViewAccounts.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
            style.Alignment          = DataGridViewContentAlignment.MiddleLeft;
            style.BackColor          = SystemColors.Control;
            style.Font               = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular, GraphicsUnit.Point, 0);
            style.ForeColor          = SystemColors.WindowText;
            style.SelectionBackColor = SystemColors.Highlight;
            style.SelectionForeColor = SystemColors.HighlightText;
            style.WrapMode           = DataGridViewTriState.True;
            this.dataGridViewAccounts.ColumnHeadersDefaultCellStyle = style;
            DataGridViewColumn[] dataGridViewColumns = new DataGridViewColumn[] { this.colPhoneNumber, this.colTitle, this.colUnReadCount, this.colOldestUnRead, this.colLastSyncDate, this.colConnectionStatus };
            this.dataGridViewAccounts.Columns.AddRange(dataGridViewColumns);
            style2.Alignment          = DataGridViewContentAlignment.MiddleLeft;
            style2.BackColor          = SystemColors.Window;
            style2.Font               = new Font("Microsoft Sans Serif", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
            style2.ForeColor          = SystemColors.ControlText;
            style2.Padding            = new Padding(1);
            style2.SelectionBackColor = SystemColors.Highlight;
            style2.SelectionForeColor = SystemColors.HighlightText;
            style2.WrapMode           = DataGridViewTriState.False;
            this.dataGridViewAccounts.DefaultCellStyle          = style2;
            this.dataGridViewAccounts.EditMode                  = DataGridViewEditMode.EditProgrammatically;
            this.dataGridViewAccounts.EnableHeadersVisualStyles = false;
            this.dataGridViewAccounts.GridColor                 = SystemColors.Control;
            this.dataGridViewAccounts.Location                  = new Point(0, 0x18);
            this.dataGridViewAccounts.MultiSelect               = false;
            this.dataGridViewAccounts.Name = "dataGridViewAccounts";
            style3.Alignment          = DataGridViewContentAlignment.MiddleLeft;
            style3.BackColor          = SystemColors.Control;
            style3.Font               = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
            style3.ForeColor          = SystemColors.WindowText;
            style3.SelectionBackColor = System.Drawing.Color.FromArgb(0xe8, 0xff, 0xcc);
            style3.SelectionForeColor = SystemColors.Desktop;
            style3.WrapMode           = DataGridViewTriState.True;
            this.dataGridViewAccounts.RowHeadersDefaultCellStyle = style3;
            this.dataGridViewAccounts.RowHeadersVisible          = false;
            this.dataGridViewAccounts.RowHeadersWidth            = 30;
            style4.BackColor          = System.Drawing.Color.White;
            style4.Font               = new Font("Microsoft Sans Serif", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
            style4.ForeColor          = System.Drawing.Color.Black;
            style4.SelectionBackColor = System.Drawing.Color.White;
            style4.SelectionForeColor = System.Drawing.Color.Black;
            this.dataGridViewAccounts.RowsDefaultCellStyle = style4;
            this.dataGridViewAccounts.RowTemplate.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            this.dataGridViewAccounts.RowTemplate.DefaultCellStyle.Padding   = new Padding(1);
            this.dataGridViewAccounts.SelectionMode    = DataGridViewSelectionMode.FullRowSelect;
            this.dataGridViewAccounts.Size             = new Size(640, 0x107);
            this.dataGridViewAccounts.TabIndex         = 9;
            this.dataGridViewAccounts.TabStop          = false;
            this.dataGridViewAccounts.CellDoubleClick += new DataGridViewCellEventHandler(this.dataGridViewAccounts_CellDoubleClick);
            this.dataGridViewAccounts.Sorted          += new EventHandler(this.dataGridViewAccounts_Sorted);
            this.colPhoneNumber.FillWeight             = 50f;
            this.colPhoneNumber.HeaderText             = "Number";
            this.colPhoneNumber.MinimumWidth           = 100;
            this.colPhoneNumber.Name                         = "colPhoneNumber";
            this.colTitle.FillWeight                         = 90f;
            this.colTitle.HeaderText                         = "Title";
            this.colTitle.MinimumWidth                       = 70;
            this.colTitle.Name                               = "colTitle";
            this.colUnReadCount.FillWeight                   = 40f;
            this.colUnReadCount.HeaderText                   = "Unread";
            this.colUnReadCount.MinimumWidth                 = 20;
            this.colUnReadCount.Name                         = "colUnReadCount";
            this.colOldestUnRead.HeaderText                  = "Oldest Unread";
            this.colOldestUnRead.MinimumWidth                = 100;
            this.colOldestUnRead.Name                        = "colOldestUnRead";
            this.colLastSyncDate.HeaderText                  = "Last Refresh";
            this.colLastSyncDate.MinimumWidth                = 100;
            this.colLastSyncDate.Name                        = "colLastSyncDate";
            this.colConnectionStatus.FillWeight              = 60f;
            this.colConnectionStatus.HeaderText              = "Connection Status";
            this.colConnectionStatus.MinimumWidth            = 50;
            this.colConnectionStatus.Name                    = "colConnectionStatus";
            this.buttonRefresh.Anchor                        = AnchorStyles.Right | AnchorStyles.Bottom;
            this.buttonRefresh.Font                          = new Font("Arial", 11.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.buttonRefresh.Location                      = new Point(0x21f, 0x12a);
            this.buttonRefresh.Margin                        = new Padding(4);
            this.buttonRefresh.Name                          = "buttonRefresh";
            this.buttonRefresh.Size                          = new Size(0x54, 0x1b);
            this.buttonRefresh.TabIndex                      = 11;
            this.buttonRefresh.Text                          = "Refresh";
            this.buttonRefresh.UseVisualStyleBackColor       = true;
            this.buttonRefresh.Click                        += new EventHandler(this.buttonRefresh_Click);
            this.labelTotalAccounts.Anchor                   = AnchorStyles.Left | AnchorStyles.Bottom;
            this.labelTotalAccounts.AutoSize                 = true;
            this.labelTotalAccounts.Font                     = new Font("Microsoft Sans Serif", 11.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.labelTotalAccounts.Location                 = new Point(0xa7, 0x12e);
            this.labelTotalAccounts.Name                     = "labelTotalAccounts";
            this.labelTotalAccounts.Size                     = new Size(0x6f, 0x12);
            this.labelTotalAccounts.TabIndex                 = 12;
            this.labelTotalAccounts.Text                     = "Total Accounts:";
            this.labelTotalUnread.Anchor                     = AnchorStyles.Left | AnchorStyles.Bottom;
            this.labelTotalUnread.AutoSize                   = true;
            this.labelTotalUnread.Font                       = new Font("Microsoft Sans Serif", 11.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.labelTotalUnread.Location                   = new Point(12, 0x12e);
            this.labelTotalUnread.Name                       = "labelTotalUnread";
            this.labelTotalUnread.Size                       = new Size(0x61, 0x12);
            this.labelTotalUnread.TabIndex                   = 14;
            this.labelTotalUnread.Text                       = "Total Unread:";
            this.checkBoxFullRefresh.Anchor                  = AnchorStyles.Right | AnchorStyles.Bottom;
            this.checkBoxFullRefresh.AutoSize                = true;
            this.checkBoxFullRefresh.Font                    = new Font("Arial", 8.25f, FontStyle.Italic);
            this.checkBoxFullRefresh.ForeColor               = System.Drawing.Color.FromArgb(0x40, 0x40, 0x40);
            this.checkBoxFullRefresh.Location                = new Point(0x1c1, 0x130);
            this.checkBoxFullRefresh.Name                    = "checkBoxFullRefresh";
            this.checkBoxFullRefresh.Size                    = new Size(0x57, 0x12);
            this.checkBoxFullRefresh.TabIndex                = 15;
            this.checkBoxFullRefresh.Text                    = "Full Refresh";
            this.checkBoxFullRefresh.UseVisualStyleBackColor = true;
            this.tryBETAToolStripMenuItem.Name               = "tryBETAToolStripMenuItem";
            this.tryBETAToolStripMenuItem.Size               = new Size(0x98, 0x16);
            this.tryBETAToolStripMenuItem.Text               = "Try BETA!";
            this.tryBETAToolStripMenuItem.Click             += new EventHandler(this.tryBETAToolStripMenuItem_Click);
            base.AutoScaleDimensions                         = new SizeF(6f, 13f);
            base.AutoScaleMode                               = AutoScaleMode.Font;
            base.ClientSize = new Size(640, 0x151);
            base.Controls.Add(this.checkBoxFullRefresh);
            base.Controls.Add(this.labelTotalUnread);
            base.Controls.Add(this.labelTotalAccounts);
            base.Controls.Add(this.buttonRefresh);
            base.Controls.Add(this.dataGridViewAccounts);
            base.Controls.Add(this.menuStripNewMessage);
            base.Icon          = (Icon)manager.GetObject("$this.Icon");
            base.MainMenuStrip = this.menuStripNewMessage;
            this.MinimumSize   = new Size(600, 0x177);
            base.Name          = "fmAccountDashboard";
            this.Text          = "Account Dashboard";
            base.Activated    += new EventHandler(this.fmAccountDashboard_Activated);
            base.FormClosing  += new FormClosingEventHandler(this.fmAccountDashboard_FormClosing);
            base.Load         += new EventHandler(this.fmAccountDashboard_Load);
            this.menuStripNewMessage.ResumeLayout(false);
            this.menuStripNewMessage.PerformLayout();
            ((ISupportInitialize)this.dataGridViewAccounts).EndInit();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
Esempio n. 14
0
        //========================================================================================
        // Join()
        //========================================================================================

        internal void Join(ToolStripItem item)
        {
            commands.Add(item);
        }
Esempio n. 15
0
 /// <include file='doc\ToolStripItemEventArgs.uex' path='docs/doc[@for="ToolStripItemEventArgs.ToolStripItemEventArgs"]/*' />
 public ToolStripItemEventArgs(ToolStripItem item) {
    this.item = item;
 }
 public ToolStripDropDownButton(string text, System.Drawing.Image image, ToolStripItem[] dropDownItems)
 {
 }
 // Constructors
 public ToolStripItemClickedEventArgs(ToolStripItem clickedItem)
 {
 }
Esempio n. 18
0
        private void tvProjects_AfterSelect(object sender, TreeViewEventArgs e)
        {
            INodeHandler handler = e.Node.Tag as INodeHandler;

            if (handler != null)
            {
                if (handler.IsFirstClick)
                {
                    handler.OnFirstClick();
                }
                else
                {
                    handler.OnClick();
                }
            }
            splitContainer1.Panel2.Controls.Clear();

            IDeleteable del = handler as IDeleteable;

            tsbtnDelete.Enabled = false;
            if (del != null)
            {
                tsbtnDelete.Enabled     = true;
                tsbtnDelete.ToolTipText = del.TitleOfDelete;
                menuProject.Items.Add(del.TitleOfDelete, actImgs.Images["delete"], cmDelete_Click);
            }

            IAddable add = handler as IAddable;

            tsbtnAdd.Enabled = false;
            if (add != null)
            {
                tsbtnAdd.Enabled     = true;
                tsbtnAdd.ToolTipText = add.TitleOfAdd;
                menuProject.Items.Add(add.TitleOfAdd, actImgs.Images["add"], cmAdd_Click);
            }

            IReloadable reload = handler as IReloadable;

            tsbtnReload.Enabled = false;
            if (reload != null)
            {
                tsbtnReload.Enabled = true;
            }

            ITestable test = handler as ITestable;

            tsbtnTest.Enabled = false;
            if (test != null)
            {
                tsbtnTest.Image   = actImgs.Images[test.TestImageKey];
                tsbtnTest.Enabled = true;
            }

            IRenameable rename = handler as IRenameable;

            tsbtnRename.Enabled = false;
            if (rename != null)
            {
                tsbtnRename.Enabled = true;
            }

            IExportable export = handler as IExportable;

            tsbtnExport.Enabled = false;
            if (export != null)
            {
                tsbtnExport.Enabled = true;
            }

            ISetupable setup = handler as ISetupable;

            cmSetup.Enabled = false;
            if (setup != null)
            {
                cmSetup.Enabled = true;
            }

            IDeployable deploy = handler as IDeployable;

            cmDeploy.Enabled = false;
            if (deploy != null)
            {
                cmDeploy.Enabled = true;
            }

            IDeployToPhysical phyDeploy = handler as IDeployToPhysical;

            tsbtnDeployToPhysical.Enabled = false;
            if (phyDeploy != null)
            {
                tsbtnDeployToPhysical.Enabled = true;
            }

            IImportFromPhysical phyImport = handler as IImportFromPhysical;

            tsbtnImportFromPhysical.Enabled = false;
            if (phyImport != null)
            {
                tsbtnImportFromPhysical.Enabled = true;
            }

            IImportable import = handler as IImportable;

            tsbtnImport.Enabled = false;
            if (import != null)
            {
                tsbtnImport.Enabled = true;
            }

            IJoinProject joinProject = handler as IJoinProject;

            tsbtnJoinProject.Enabled = false;
            if (joinProject != null)
            {
                tsbtnJoinProject.Enabled = true;
            }

            ILeaveProject leaveProject = handler as ILeaveProject;

            tsbtnLeaveProject.Enabled = false;
            if (leaveProject != null)
            {
                tsbtnLeaveProject.Enabled = true;
            }

            ISyncUpload syncUplaod = handler as ISyncUpload;

            cmUpload.Enabled = false;
            if (syncUplaod != null)
            {
                cmUpload.Enabled = true;
            }

            ISyncUpload syncDownload = handler as ISyncUpload;

            cmDownload.Enabled = false;
            if (syncDownload != null)
            {
                cmDownload.Enabled = true;
            }

            tsEditMode.Items.Clear();
            rsbtnSave.Enabled = false;
            IEditorManager manager = handler as IEditorManager;

            if (manager != null)
            {
                rsbtnSave.Enabled = false;
                foreach (IEditable editable in manager.Editors)
                {
                    ToolStripItem item = tsEditMode.Items.Add(editable.ModeTitle, actImgs.Images[editable.ImageKey], cmEdit_Click);
                    item.ToolTipText = editable.ModeTitle;
                    item.Text        = string.Empty;
                    item.Tag         = editable;
                }
            }
        }
Esempio n. 19
0
 private void camSelector_DropDown(object sender, EventArgs e)
 {
     this.activeToolItem = this.camSelector;
     this.InitCameraSelector();
 }
 private static void RegisterClick(ToolStripItem item, Action onClick)
 {
     item.Click += (o, e) => onClick();
 }
Esempio n. 21
0
    private ToolStripItem[] getBuildMenuItems()
    {
        return new ToolStripItem[] {
            p_DropDownRunButton = new ToolStripMenuItem("Run", Icons.GetBitmap("tools.run", 16), menu_build_run, Keys.F5),
            new ToolStripMenuItem("Stop", Icons.GetBitmap("tools.stop", 16), menu_build_stop),

            new ToolStripSeparator(),
            new ToolStripMenuItem("Build", Icons.GetBitmap("tools.build", 16), menu_build_build, Keys.F6)
        };
    }
 private void RegisterClick<T>(ToolStripItem item, Action<T> onClick) where T : class, INode
 {
     item.Click += (o, e) => Node.OnNode(treeMain.SelectedNode, onClick);
 }
Esempio n. 23
0
		static bool IsDisabled (ToolStripItem toolStripItem)
		{
			return !toolStripItem.Enabled;
		}
        public void BindingNavigator_ConstructorBool()
        {
            var bn = new BindingNavigator(true);

            Assert.NotNull(bn);

            Assert.NotNull(bn.PositionItem);
            Assert.NotNull(bn.CountItem);
            Assert.Equal("bindingNavigatorPositionItem", bn.PositionItem.Name);
            Assert.Equal("bindingNavigatorCountItem", bn.CountItem.Name);
            Assert.Equal(SR.BindingNavigatorCountItemTip, bn.CountItem.ToolTipText);
            Assert.Equal(SR.BindingNavigatorPositionItemTip, bn.PositionItem.ToolTipText);
            Assert.False(bn.CountItem.AutoToolTip);
            Assert.False(bn.PositionItem.AutoToolTip);
            Assert.Equal(SR.BindingNavigatorPositionAccessibleName, bn.PositionItem.AccessibleName);

            var items = new List <ToolStripItem>()
            {
                bn.MoveFirstItem,
                bn.MovePreviousItem,
                bn.MoveNextItem,
                bn.MoveLastItem,
                bn.AddNewItem,
                bn.DeleteItem
            };

            var itemNames = new List <string>()
            {
                "bindingNavigatorMoveFirstItem",
                "bindingNavigatorMovePreviousItem",
                "bindingNavigatorMoveNextItem",
                "bindingNavigatorMoveLastItem",
                "bindingNavigatorAddNewItem",
                "bindingNavigatorDeleteItem"
            };

            var itemTexts = new List <string>()
            {
                SR.BindingNavigatorMoveFirstItemText,
                SR.BindingNavigatorMovePreviousItemText,
                SR.BindingNavigatorMoveNextItemText,
                SR.BindingNavigatorMoveLastItemText,
                SR.BindingNavigatorAddNewItemText,
                SR.BindingNavigatorDeleteItemText
            };

            for (var i = 0; i < items.Count; i++)
            {
                ToolStripItem item = items[i];
                Assert.NotNull(item);
                Assert.Equal(itemNames[i], item.Name.Trim());
                Assert.Equal(itemTexts[i], item.Text.Trim());
                Assert.NotNull(item.Image);
                Assert.True(item.RightToLeftAutoMirrorImage);
                Assert.Equal(ToolStripItemDisplayStyle.Image, item.DisplayStyle);
            }

            Assert.False(bn.PositionItem.AutoSize);
            Assert.Equal(50, bn.PositionItem.Width);

            var index = 0;

            Assert.Equal(11, bn.Items.Count);
            Assert.Equal(bn.MoveFirstItem, bn.Items[index++]);
            Assert.Equal(bn.MovePreviousItem, bn.Items[index++]);
            Assert.NotNull(bn.Items[index]);
            Assert.IsType <ToolStripSeparator>(bn.Items[index++]);
            Assert.Equal(bn.PositionItem, bn.Items[index++]);
            Assert.Equal(bn.CountItem, bn.Items[index++]);
            Assert.NotNull(bn.Items[index]);
            Assert.IsType <ToolStripSeparator>(bn.Items[index++]);
            Assert.Equal(bn.MoveNextItem, bn.Items[index++]);
            Assert.Equal(bn.MoveLastItem, bn.Items[index++]);
            Assert.NotNull(bn.Items[index]);
            Assert.IsType <ToolStripSeparator>(bn.Items[index++]);
            Assert.Equal(bn.AddNewItem, bn.Items[index++]);
            Assert.Equal(bn.DeleteItem, bn.Items[index++]);
        }
	public virtual ToolStripItem GetNextItem(ToolStripItem start, ArrowDirection direction) {}
Esempio n. 26
0
        protected override void OnRenderMenuItemBackground(
            ToolStripItemRenderEventArgs e)
        {
            ToolStrip     toolStrip = e.ToolStrip;
            ToolStripItem item      = e.Item;

            if (!item.Enabled)
            {
                return;
            }

            Graphics  g    = e.Graphics;
            Rectangle rect = new Rectangle(Point.Empty, e.Item.Size);

            if (toolStrip is MenuStrip)
            {
                if (item.Selected)
                {
                    RenderHelper.RenderBackgroundInternal(
                        g,
                        rect,
                        ColorTable.BackHover,
                        ColorTable.BackHover,
                        RoundStyle.All,
                        m_radius,
                        true,
                        true);
                }
                else if (item.Pressed)
                {
                    RenderHelper.RenderBackgroundInternal(
                        g,
                        rect,
                        ColorTable.BackPressed,
                        ColorTable.BackPressed,
                        RoundStyle.All,
                        m_radius,
                        true,
                        true);
                }
                else
                {
                    base.OnRenderMenuItemBackground(e);
                }
            }
            else if (toolStrip is ToolStripDropDown)
            {
                bool bDrawLogo = NeedDrawLogo(toolStrip);

                int offsetMargin = bDrawLogo ? OffsetMargin : 0;

                if (item.RightToLeft == RightToLeft.Yes)
                {
                    rect.X += 4;
                }
                else
                {
                    rect.X += offsetMargin + 4;
                }
                rect.Width -= offsetMargin + 8;
                rect.Height--;

                if (item.Selected)
                {
                    RenderHelper.RenderBackgroundInternal(
                        g,
                        rect,
                        ColorTable.BackHover,
                        ColorTable.BackHover,
                        RoundStyle.All,
                        m_radius,
                        true,
                        true);
                }
                else
                {
                    base.OnRenderMenuItemBackground(e);
                }
            }
            else
            {
                base.OnRenderMenuItemBackground(e);
            }
        }
 // Constructors
 public ToolStripItemCollection(ToolStrip owner, ToolStripItem[] value)
 {
 }
 /// <summary>
 /// Finds out if the parent menu is disabled.
 /// </summary>
 /// <param name="menu">The child menu.</param>
 /// <returns>True if any parent menu is disabled, otherwise it returns false.
 /// </returns>
 public static bool HasParentMenuDisabled(ToolStripItem menu)
 {
     return(HasParentMenuDisabled(menu, true));
 }
 public void CopyTo(ToolStripItem[] array, int index)
 {
 }
Esempio n. 30
0
        private void CopyFileNames(bool fPath)
        {
            List <string>          lstPaths = new List <string>();
            DropDownMenuDropTarget root     = GetRoot(this);

            if (root != null)
            {
                GetCheckedItem(root, lstPaths, false, true);
            }
            if (lstPaths.Count == 0)
            {
                foreach (ToolStripItem item in DisplayedItems)
                {
                    if (!item.Selected)
                    {
                        continue;
                    }
                    QMenuItem item2 = item as QMenuItem;
                    if ((item2 != null) && !string.IsNullOrEmpty(item2.Path))
                    {
                        string path = item2.Path;
                        if (!fPath)
                        {
                            try {
                                path = System.IO.Path.GetFileName(path);
                            }
                            catch {
                            }
                        }
                        if (!string.IsNullOrEmpty(path))
                        {
                            QTUtility2.SetStringClipboard(path);
                            fContainsFileDropList    = false;
                            itemKeyInsertionMarkPrev = null;
                            Invalidate();
                        }
                    }
                    break;
                }
            }
            else
            {
                string str = string.Empty;
                foreach (string str3 in lstPaths)
                {
                    if (fPath)
                    {
                        str = str + str3 + Environment.NewLine;
                    }
                    else
                    {
                        try {
                            str = str + System.IO.Path.GetFileName(str3) + Environment.NewLine;
                            continue;
                        }
                        catch {
                            continue;
                        }
                    }
                }
                if (str.Length > 0)
                {
                    QTUtility2.SetStringClipboard(str);
                    fContainsFileDropList    = false;
                    itemKeyInsertionMarkPrev = null;
                    Invalidate();
                }
            }
        }
Esempio n. 31
0
        /// <summary>
        /// Add an action (on context menu) on the series grid.
        /// </summary>
        /// <param name="menuItemText">The text of the menu item</param>
        /// <param name="onClick">The event handler to call when menu is selected</param>
        public void AddContextAction(string menuItemText, System.EventHandler onClick)
        {
            ToolStripItem item = this.popupMenu.Items.Add(menuItemText);

            item.Click += onClick;
        }
Esempio n. 32
0
        private void dropTargetWrapper_DragFileOver(object sender, DragEventArgs e)
        {
            int           iSourceState = -1;
            Point         point        = PointToClient(new Point(e.X, e.Y));
            ToolStripItem itemAt       = GetItemAt(point);
            bool          flag         = false;

            if (itemAt != null)
            {
                Rectangle bounds = itemAt.Bounds;
                bool      flag2  = (bounds.Bottom - point.Y) >= (point.Y - bounds.Top);
                flag = fTop != flag2;
                fTop = flag2;
            }
            bool flag3 = ((fTop && (iItemDragOverRegion != 0)) || (!fTop && (iItemDragOverRegion != 1))) && (itemAt == Items[Items.Count - 1]);

            if ((itemAt != itemHover) || flag3)
            {
                if (itemAt != null)
                {
                    iItemDragOverRegion = fTop ? 0 : 1;
                    QMenuItem item2 = itemAt as QMenuItem;
                    if (item2 != null)
                    {
                        bool flag4 = item2 is SubDirTipForm.ToolStripMenuItemEx;
                        if ((flag3 && !fTop) && ShellMethods.PathIsFolder(Path))
                        {
                            fDrawDropTarget = false;
                            strTargetPath   = Path;
                            iSourceState    = MakeDragOverRetval();
                            if ((!flag4 && item2.HasDropDownItems) && !item2.DropDown.Visible)
                            {
                                OnMouseLeave(EventArgs.Empty);
                                OnMouseMove(new MouseEventArgs(MouseButtons, 0, point.X, point.Y, 0));
                            }
                        }
                        else if (flag4)
                        {
                            bool flag5;
                            if (PathIsExecutable(item2.Path, out flag5))
                            {
                                fDrawDropTarget = true;
                                if (flag5)
                                {
                                    iSourceState = -1;
                                    CloseAllDropDown();
                                }
                                else
                                {
                                    strTargetPath = item2.Path;
                                    item2.Select();
                                    iSourceState = 2;
                                }
                            }
                            else
                            {
                                fDrawDropTarget = false;
                                if (ShellMethods.PathIsFolder(Path))
                                {
                                    strTargetPath = Path;
                                    iSourceState  = MakeDragOverRetval();
                                }
                                CloseAllDropDown();
                            }
                        }
                        else if (ShellMethods.PathIsFolder(item2.TargetPath))
                        {
                            fDrawDropTarget = true;
                            strTargetPath   = item2.TargetPath;
                            iSourceState    = MakeDragOverRetval();
                            OnMouseLeave(EventArgs.Empty);
                            OnMouseMove(new MouseEventArgs(MouseButtons, 0, point.X, point.Y, 0));
                        }
                    }
                }
                flag = true;
            }
            else
            {
                iSourceState = iDDRetval;
            }
            if (itemAt != null)
            {
                BeginScrollTimer(itemAt, point);
            }
            itemHover = itemAt;
            iDDRetval = iSourceState;
            if (flag)
            {
                Invalidate();
            }
            if (iSourceState == -1)
            {
                strTargetPath = null;
                e.Effect      = DragDropEffects.None;
            }
            else if (fDrivesContained)
            {
                e.Effect = DragDropEffects.Link;
            }
            else if (iSourceState == 2)
            {
                e.Effect = DragDropEffects.Copy;
            }
            else
            {
                e.Effect = DropTargetWrapper.MakeEffect(e.KeyState, iSourceState);
            }
        }
        private void CreateSystemTrayIcon()
        {
            // ExitMenuItem
            exitMenuItem = new ToolStripMenuItem
            {
                Name = "Exit",
                Size = new System.Drawing.Size(152, 22),
                Text = "Quitter"
            };
            exitMenuItem.Click += ExitMenuItem_Click;

            // StopSynchronisationMenuItem
            stopSynchronizationMenuItem = new ToolStripMenuItem
            {
                Name = "Stop synchronization",
                Size = new System.Drawing.Size(152, 22),
                Text = "Arrêter la synchronisation"
            };
            stopSynchronizationMenuItem.Click += StopSynchronizationMenuItem_Click;

            // StartSynchronisationMenuItem
            startSynchronizationMenuItem = new ToolStripMenuItem
            {
                Name = "Start synchronization",
                Size = new System.Drawing.Size(152, 22),
                Text = "Démarrer la synchronisation"
            };
            startSynchronizationMenuItem.Click += StartSynchronizationMenuItem_Click;

            // TrayIconContextMenu
            trayIconContextMenu = new ContextMenuStrip()
            {
                Name = "Tray Icon Context Menu",
                Size = new System.Drawing.Size(153, 50)
            };
            trayIconContextMenu.SuspendLayout();
            ToolStripItem[] menuItems = new ToolStripItem[]
            {
                stopSynchronizationMenuItem,
                startSynchronizationMenuItem,
                exitMenuItem,
            };
            trayIconContextMenu.Items.AddRange(menuItems);

            // TrayIcon
            trayIcon = new NotifyIcon
            {
                BalloonTipIcon   = ToolTipIcon.Info,
                BalloonTipText   = "Cliquer avec le bouton de droite pour avoir les options.",
                BalloonTipTitle  = "FileSystemChangeReplicator",
                Text             = "FileSystemChangeReplicator",
                Visible          = true,
                ContextMenuStrip = trayIconContextMenu,
            };
            trayIcon.DoubleClick += TrayIcon_DoubleClick;

            if (properties.ContainsKey("TRAY_ICON"))
            {
                string applicationPath = Application.StartupPath;
                string iconPath        = Path.Combine(applicationPath, "Graphics", properties["TRAY_ICON"].ToString());
                if (File.Exists(iconPath))
                {
                    trayIcon.Icon = new System.Drawing.Icon(iconPath);
                }
                else
                {
                    trayIcon.Icon = System.Drawing.SystemIcons.Application;
                }
            }
            else
            {
                trayIcon.Icon = System.Drawing.SystemIcons.Application;
            }

            trayIconContextMenu.ResumeLayout(true);
        }
Esempio n. 34
0
 protected override void OnPreviewKeyDown(PreviewKeyDownEventArgs e)
 {
     if (((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down)) && (fThisPathExists && fContainsFileDropList))
     {
         for (int i = 0; i < DisplayedItems.Count; i++)
         {
             ToolStripItem item = DisplayedItems[i];
             if (item.Selected)
             {
                 int index = Items.IndexOf(item);
                 if (index != -1)
                 {
                     int num3;
                     if (e.KeyCode == Keys.Up)
                     {
                         if (index == 0)
                         {
                             num3 = Items.Count - 1;
                         }
                         else
                         {
                             num3 = index - 1;
                         }
                     }
                     else if (index == (Items.Count - 1))
                     {
                         num3 = 0;
                     }
                     else
                     {
                         num3 = index + 1;
                     }
                     item = Items[num3];
                     if (((num3 == 0) && (e.KeyCode == Keys.Down)) && (!fEnterVirtualBottom && IsKeyTargetItem(Items[Items.Count - 1])))
                     {
                         itemKeyInsertionMarkPrev = Items[Items.Count - 1];
                         fEnterVirtualBottom      = true;
                         fKeyTargetIsThis         = true;
                         Invalidate();
                         return;
                     }
                     fEnterVirtualBottom = false;
                     if (!IsKeyTargetItem(item))
                     {
                         itemKeyInsertionMarkPrev = item;
                         fKeyTargetIsThis         = true;
                         Invalidate();
                         return;
                     }
                     itemKeyInsertionMarkPrev = null;
                     if (fKeyTargetIsThis)
                     {
                         Invalidate();
                     }
                     fKeyTargetIsThis = false;
                 }
                 break;
             }
         }
     }
     base.OnPreviewKeyDown(e);
 }
Esempio n. 35
0
        private void tvProjects_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                tvProjects.SelectedNode = e.Node;

                menuProject.Items.Clear();

                //判斷是否可以開啟
                IEditorManager editorManager = e.Node.Tag as IEditorManager;
                if (editorManager != null)
                {
                    if (editorManager.Editors.Count == 1)
                    {
                        IEditable     editable = editorManager.Editors[0];
                        ToolStripItem item     = menuProject.Items.Add(editable.DocumentTitle, actImgs.Images[editable.ImageKey], cmEdit_Click);
                        item.Tag = editable;
                    }
                    else if (editorManager.Editors.Count > 0)
                    {
                        ToolStripMenuItem menuItem = new ToolStripMenuItem("開啟");
                        menuProject.Items.Add(menuItem);

                        foreach (IEditable editable in editorManager.Editors)
                        {
                            ToolStripItem item = menuItem.DropDownItems.Add(editable.DocumentTitle, actImgs.Images[editable.ImageKey], cmEdit_Click);
                            item.Tag = editable;
                        }
                    }
                }

                //判斷是否可以改名
                ToolStripMenuItem cmRename = new ToolStripMenuItem("重新命名(&N)");
                this.CheckMenuItemVisiable(typeof(IRenameable), cmRename);
                cmRename.Click += new EventHandler(cmRename_Click);
                cmRename.Image  = actImgs.Images["rename"];

                //判斷是否可以新增
                IAddable addable = e.Node.Tag as IAddable;
                if (addable != null)
                {
                    menuProject.Items.Add(addable.TitleOfAdd, actImgs.Images["add"], cmAdd_Click);
                }

                //判斷是否可以重新整理
                ToolStripMenuItem cmReload = new ToolStripMenuItem("重新整理(&R)");
                this.CheckMenuItemVisiable(typeof(IReloadable), cmReload);
                cmReload.Click += new EventHandler(cmReload_Click);
                cmReload.Image  = actImgs.Images["reload"];

                //判斷是否可以刪除
                IDeleteable deleteable = e.Node.Tag as IDeleteable;
                if (deleteable != null)
                {
                    menuProject.Items.Add(deleteable.TitleOfDelete, actImgs.Images["delete"], cmDelete_Click);
                }

                //判斷是否可以測試
                ITestable testable = e.Node.Tag as ITestable;
                if (testable != null)
                {
                    menuProject.Items.Add(testable.TitleOfTest, actImgs.Images[testable.TestImageKey], cmTest_Click);
                }

                //判斷是否可以匯出
                ToolStripMenuItem cmExport = new ToolStripMenuItem("匯出(&E)");
                this.CheckMenuItemVisiable(typeof(IExportable), cmExport);
                cmExport.Click += new EventHandler(cmExport_Click);
                cmExport.Image  = actImgs.Images["export"];

                //判斷是否可以匯入
                ToolStripMenuItem cmImport = new ToolStripMenuItem("匯入(&I)");
                this.CheckMenuItemVisiable(typeof(IImportable), cmImport);
                cmImport.Click += new EventHandler(cmImport_Click);
                cmImport.Image  = actImgs.Images["import"];

                //判斷是否可以加入專案
                IJoinProject join = e.Node.Tag as IJoinProject;
                if (join != null)
                {
                    menuProject.Items.Add("加入專案(&J)", actImgs.Images["join"], cmJoinProject_Click);
                }

                //判斷是否可以匯入
                ILeaveProject leave = e.Node.Tag as ILeaveProject;
                if (leave != null)
                {
                    menuProject.Items.Add("從專案卸載(&L)", actImgs.Images["leave"], cmLeaveProject_Click);
                }

                //判斷是否可以上傳
                ISyncUpload upload = e.Node.Tag as ISyncUpload;
                if (upload != null)
                {
                    menuProject.Items.Add("同步至伺服器(&U)", actImgs.Images["upload"], cmUpload_Click);
                }

                //判斷是否可以下載
                ISyncDownload download = e.Node.Tag as ISyncDownload;
                if (download != null)
                {
                    menuProject.Items.Add("自伺服器同步(&D)", actImgs.Images["download"], cmDownload_Click);
                }

                //判斷是否可以設定
                ISetupable setup = e.Node.Tag as ISetupable;
                if (setup != null)
                {
                    menuProject.Items.Add(setup.SetupTitle + "(&S)", actImgs.Images["setup"], cmSetup_Click);
                }

                //判斷是否可以佈署
                IDeployable deploy = e.Node.Tag as IDeployable;
                if (deploy != null)
                {
                    menuProject.Items.Add("佈署(&L)", actImgs.Images["deploy"], cmDeploy_Click);
                }

                //判斷是否可以佈署到實體
                IDeployToPhysical deployToPhysical = e.Node.Tag as IDeployToPhysical;
                if (deployToPhysical != null)
                {
                    menuProject.Items.Add("佈署到實體(&P)", actImgs.Images["deployToPhysical"], tsbtnDeployToPhysical_Click);
                }

                //判斷是否可以從實體 Service 載入
                IImportFromPhysical importFromPhysical = e.Node.Tag as IImportFromPhysical;
                if (importFromPhysical != null)
                {
                    menuProject.Items.Add("實體 Service 載入(&X)", actImgs.Images["importFromPhysical"], tsbtnImportFromPhysical_Click);
                }

                menuProject.Show(e.Location);
            }
        }
Esempio n. 36
0
 public static void ReplaceSerial(ToolStripItem menuItem, MainForm mainForm)
 {
     Wins.OnClipboardString(StringTemplateSerial);
 }
Esempio n. 37
0
 private void stateSelector_DropDown(object sender, EventArgs e)
 {
     this.activeToolItem = this.stateSelector;
     this.InitStateSelector();
 }
Esempio n. 38
0
        /// <summary>
        /// Process each ToolStripItem.
        /// </summary>
        /// <param name="control">ToolStripItem to process</param>
        /// <param name="tip">ToolTip object</param>

        private static void ProcessToolStripItem(ToolStripItem control, ToolTip tip)
        {
            SetToolStripItemText(control, tip);
        }
Esempio n. 39
0
    public MainIDE(Splash splash)
    {
        BackColor = Color.FromArgb(255, 230, 230, 230);
        ForeColor = Color.Black;

        Icon = Icons.GetIcon("icons.logo", 32);
        Text = "OS Development Studio";

        //trigger initialization of the text editor core
        TextEditor.Initialize();

        //once the form has loaded, send a signal to the
        //splash screen to close.
        Load += delegate(object sender, EventArgs e) {
            splash.Ready();
            Focus();
        };

        //load the size and location of the window the last time the application
        //was running.
        if (RuntimeState.ObjectExists("mainIDE.windowRect")) {
            RuntimeState.RECTANGLE rect = (RuntimeState.RECTANGLE)RuntimeState.GetObject(
                "mainIDE.windowRect",
                typeof(RuntimeState.RECTANGLE));
            //StartPosition = FormStartPosition.Manual;
            Location = new Point(rect.X, rect.Y);
            Size = new Size(rect.Width, rect.Height);

            //restore the window state
            if (RuntimeState.ObjectExists("mainIDE.windowState")) {
                WindowState = (FormWindowState)(byte)RuntimeState.GetObject(
                    "mainIDE.windowState",
                    typeof(byte));
            }
        }
        else {
            //set the initial size of the window to 75% of the current screen
            Size screenSize = Screen.FromPoint(Cursor.Position).WorkingArea.Size;
            Size = new Size(
                    (int)(screenSize.Width * 0.75),
                    (int)(screenSize.Height * 0.75));
            StartPosition = FormStartPosition.CenterScreen;
        }

        #region Create the initial panels
        p_StatusStrip = new StatusStrip { BackColor = BackColor };
        p_WorkingArea = new Panel { Dock = DockStyle.Fill };
        ToolStrip menu = new ToolStrip {
            GripStyle = ToolStripGripStyle.Hidden,
            Renderer = new toolStripRenderer(),
            BackColor = BackColor,
            ForeColor = ForeColor
        };
        p_Menu = menu;
        Controls.Add(menu);
        Controls.Add(p_StatusStrip);
        Controls.Add(p_WorkingArea);
        p_WorkingArea.BringToFront();
        #endregion

        #region Menu
        /*Build the main menu items*/
        menu.Items.Add(new ToolStripMenuItem("File", null, getFileMenuItems()));
        menu.Items.Add(new ToolStripMenuItem("Edit", null, getEditMenuItems()));
        menu.Items.Add(new ToolStripMenuItem("Build", null, getBuildMenuItems()));
        menu.Items.Add(new ToolStripMenuItem("Tools", null, getToolsMenuItems()));
        menu.Items.Add(new ToolStripMenuItem("Help", null, getHelpMenuItems()));

        /*Build shortcuts*/
        menu.Items.Add(new ToolStripSeparator());
        p_MenuStripRunButton = menu.Items.Add(null, Icons.GetBitmap("tools.run", 16), menu_build_run);
        menu.Items.Add(null, Icons.GetBitmap("tools.stop", 16), menu_build_stop);
        menu.Items.Add(new ToolStripSeparator());
        menu.Items.Add(null, Icons.GetBitmap("tools.build", 16), menu_build_build);
        #endregion

        //initialize the components
        initializeComponentSkeleton();
        initializeSolutionBrowser();
        initializeFileEditor();
        initializeOutputWindow();
        initializeStatusStrip();

        //create a UI update timer
        Timer updTimer = new Timer() {
            Interval = 30,
            Enabled = true
        };
        updTimer.Tick += uiUpdate;

        //clean up
        p_WorkingArea.BringToFront();
        p_SaveStateEnabled = true;
    }
Esempio n. 40
0
 protected override void OnMouseUp(MouseEventArgs mea)
 {
     base.OnMouseUp(mea);
     ToolStripItem newMouseOverItem = this.GetItemAt(mea.Location);
 }
Esempio n. 41
0
        private static int GetItemState(ToolStripItem item)
        {
            bool hot = item.Selected;

            if (item.IsOnDropDown)
            {
                if (item.Enabled)
                    return hot ? (int)MenuPopupItemStates.Hover : (int)MenuPopupItemStates.Normal;

                return hot ? (int)MenuPopupItemStates.DisabledHover : (int)MenuPopupItemStates.Disabled;
            }

            if (item.Pressed)
                return item.Enabled ? (int)MenuBarItemStates.Pushed : (int)MenuBarItemStates.DisabledPushed;
            
            if (item.Enabled)
                return hot ? (int)MenuBarItemStates.Hover : (int)MenuBarItemStates.Normal;

            return hot ? (int)MenuBarItemStates.DisabledHover : (int)MenuBarItemStates.Disabled;
        }
Esempio n. 42
0
        private void UpdateSystemTrayContextMenuRecents()
        {
            // make sure top [max count] recent items are in correct order
            List <RecentUsage> recentUsages = _config.RecentUsages.Take(Configuration.MAX_VISIBLE_RECENT_USAGE_COUNT).OrderBy(recent => recent.Name).ToList();

            foreach (RecentUsage recentUsage in recentUsages)
            {
                Application application          = ApplicationControl.GetApplicationByID(recentUsage.ID);
                bool        applicationIsRunning = (application != null ? application.IsRunning : false);
                Image       image        = imageList.Images[application != null ? (applicationIsRunning ? 0 : 1) : 2];
                int         menuIndex    = toolStripMenuItemSystemTrayRecent.DropDownItems.Cast <ToolStripItem>().Select(item => item.Text).ToList().IndexOf(recentUsage.Name);
                int         correctIndex = recentUsages.IndexOf(recentUsage);
                if (menuIndex == -1)
                {
                    // recent item does not exist in context menu
                    ToolStripMenuItem recentItem = new ToolStripMenuItem(recentUsage.Name, image);
                    toolStripMenuItemSystemTrayRecent.DropDownItems.Insert(correctIndex, recentItem);
                    if (application == null || !applicationIsRunning)
                    {
                        ToolStripItem recentStartItem = new ToolStripMenuItem("Start")
                        {
                            Tag = recentUsage.ID
                        };
                        recentStartItem.Click += StartRecent_Click;
                        recentItem.DropDownItems.Add(recentStartItem);
                    }
                    ToolStripItem recentRestartItem = new ToolStripMenuItem("Restart")
                    {
                        Tag = recentUsage.ID
                    };
                    recentRestartItem.Click += RestartRecent_Click;
                    recentItem.DropDownItems.Add(recentRestartItem);
                    if (application == null || applicationIsRunning)
                    {
                        ToolStripItem recentStopItem = new ToolStripMenuItem("Stop")
                        {
                            Tag = recentUsage.ID
                        };
                        recentStopItem.Click += StopRecent_Click;
                        recentItem.DropDownItems.Add(recentStopItem);
                    }
                }
                else
                {
                    // recent item exist in context menu, verify position and status
                    ToolStripMenuItem recentItem = (ToolStripMenuItem)toolStripMenuItemSystemTrayRecent.DropDownItems[menuIndex];
                    recentItem.Image = image;
                    if (menuIndex != correctIndex)
                    {
                        toolStripMenuItemSystemTrayRecent.DropDownItems.RemoveAt(menuIndex);
                        toolStripMenuItemSystemTrayRecent.DropDownItems.Insert(correctIndex, recentItem);
                    }
                    if (application != null)
                    {
                        ToolStripItem recentStartItem = recentItem.DropDownItems.Cast <ToolStripItem>().FirstOrDefault(item => (item.Text == "Start"));
                        if (applicationIsRunning && recentStartItem != null)
                        {
                            recentStartItem.Click -= StartRecent_Click;
                            recentItem.DropDownItems.Remove(recentStartItem);
                        }
                        else if (!applicationIsRunning && recentStartItem == null)
                        {
                            recentStartItem = new ToolStripMenuItem("Start")
                            {
                                Tag = recentUsage.ID
                            };
                            recentStartItem.Click += StartRecent_Click;
                            recentItem.DropDownItems.Insert(0, recentStartItem);
                        }
                        ToolStripItem recentStopItem = recentItem.DropDownItems.Cast <ToolStripItem>().FirstOrDefault(item => (item.Text == "Stop"));
                        if (!applicationIsRunning && recentStopItem != null)
                        {
                            recentStopItem.Click -= StopRecent_Click;
                            recentItem.DropDownItems.Remove(recentStopItem);
                        }
                        else if (applicationIsRunning && recentStopItem == null)
                        {
                            recentStopItem = new ToolStripMenuItem("Stop")
                            {
                                Tag = recentUsage.ID
                            };
                            recentStopItem.Click += StopRecent_Click;
                            recentItem.DropDownItems.Add(recentStopItem);
                        }
                    }
                }
            }
            // remove items exceeding [max count]
            for (int i = Configuration.MAX_VISIBLE_RECENT_USAGE_COUNT; i < toolStripMenuItemSystemTrayRecent.DropDownItems.Count; i++)
            {
                ToolStripMenuItem recentItem      = (ToolStripMenuItem)toolStripMenuItemSystemTrayRecent.DropDownItems[Configuration.MAX_VISIBLE_RECENT_USAGE_COUNT];
                ToolStripItem     recentStartItem = recentItem.DropDownItems.Cast <ToolStripItem>().FirstOrDefault(item => (item.Text == "Start"));
                if (recentStartItem != null)
                {
                    recentStartItem.Click -= StartRecent_Click;
                }
                ToolStripItem recentRestartItem = recentItem.DropDownItems.Cast <ToolStripItem>().FirstOrDefault(item => (item.Text == "Restart"));
                if (recentRestartItem != null)
                {
                    recentRestartItem.Click -= RestartRecent_Click;
                }
                ToolStripItem recentStopItem = recentItem.DropDownItems.Cast <ToolStripItem>().FirstOrDefault(item => (item.Text == "Stop"));
                if (recentStopItem != null)
                {
                    recentStopItem.Click -= StopRecent_Click;
                }
                recentItem.DropDownItems.Clear();
                toolStripMenuItemSystemTrayRecent.DropDownItems.RemoveAt(Configuration.MAX_VISIBLE_RECENT_USAGE_COUNT);
            }
        }
Esempio n. 43
0
        Color GetItemTextColor(ToolStripItem item)
        {
            int partId = item.IsOnDropDown ? (int)MenuParts.PopupItem : (int)MenuParts.BarItem;

            this.Renderer.SetParameters(MenuClass, partId, GetItemState(item));

            return Renderer.GetColor(ColorProperty.TextColor);
        }
        /// <summary>
        ///  Here is where all the fun stuff starts.  We create the structure and apply the naming here.
        /// </summary>
        private void CreateStandardToolStrip(IDesignerHost host, ToolStrip tool)
        {
            // build the static menu items structure.
            //
            string[] menuItemNames = new string[] { SR.StandardMenuNew, SR.StandardMenuOpen, SR.StandardMenuSave, SR.StandardMenuPrint, "-", SR.StandardToolCut, SR.StandardMenuCopy, SR.StandardMenuPaste, "-", SR.StandardToolHelp };

            // build a image list mapping one-one the above menuItems list... this is required so that the in LOCALIZED build we dont use the Localized item string.
            string[] menuItemImageNames = new string[] { "new", "open", "save", "print", "-", "cut", "copy", "paste", "-", "help" };
            Debug.Assert(host != null, "can't create standard menu without designer _host.");

            if (host is null)
            {
                return;
            }

            tool.SuspendLayout();
            ToolStripDesigner.s_autoAddNewItems = false;
            // create a transaction so this happens as an atomic unit.
            DesignerTransaction createMenu = _host.CreateTransaction(SR.StandardMenuCreateDesc);

            try
            {
                INameCreationService nameCreationService = (INameCreationService)_provider.GetService(typeof(INameCreationService));
                string defaultName = "standardMainToolStrip";
                string name        = defaultName;
                int    index       = 1;
                if (host != null)
                {
                    while (_host.Container.Components[name] != null)
                    {
                        name = defaultName + (index++).ToString(CultureInfo.InvariantCulture);
                    }
                }

                //keep an index in the MenuItemImageNames .. so that mapping is maintained.
                int menuItemImageNamesCount = 0;
                // now build the menu items themselves.
                foreach (string itemText in menuItemNames)
                {
                    name = null;
                    // for separators, just use the default name.  Otherwise, remove any non-characters and get the name from the text.
                    defaultName = "ToolStripButton";
                    name        = NameFromText(itemText, typeof(ToolStripButton), nameCreationService, true);
                    ToolStripItem item = null;
                    if (name.Contains("Separator"))
                    {
                        // create the componennt.
                        item = (ToolStripSeparator)_host.CreateComponent(typeof(ToolStripSeparator), name);
                        IDesigner designer = _host.GetDesigner(item);
                        if (designer is ComponentDesigner)
                        {
                            ((ComponentDesigner)designer).InitializeNewComponent(null);
                        }
                    }
                    else
                    {
                        // create the component.
                        item = (ToolStripButton)_host.CreateComponent(typeof(ToolStripButton), name);
                        IDesigner designer = _host.GetDesigner(item);
                        if (designer is ComponentDesigner)
                        {
                            ((ComponentDesigner)designer).InitializeNewComponent(null);
                        }

                        PropertyDescriptor displayStyleProperty = TypeDescriptor.GetProperties(item)["DisplayStyle"];
                        Debug.Assert(displayStyleProperty != null, "Could not find 'Text' property in ToolStripItem.");
                        if (displayStyleProperty != null)
                        {
                            displayStyleProperty.SetValue(item, ToolStripItemDisplayStyle.Image);
                        }

                        PropertyDescriptor textProperty = TypeDescriptor.GetProperties(item)["Text"];
                        Debug.Assert(textProperty != null, "Could not find 'Text' property in ToolStripItem.");
                        if (textProperty != null)
                        {
                            textProperty.SetValue(item, itemText);
                        }

                        Bitmap image = null;
                        try
                        {
                            image = GetImage(menuItemImageNames[menuItemImageNamesCount]);
                        }
                        catch
                        {
                            // eat the exception.. as you may not find image for all MenuItems.
                        }

                        if (image != null)
                        {
                            PropertyDescriptor imageProperty = TypeDescriptor.GetProperties(item)["Image"];
                            Debug.Assert(imageProperty != null, "Could not find 'Image' property in ToolStripItem.");
                            if (imageProperty != null)
                            {
                                imageProperty.SetValue(item, image);
                            }

                            item.ImageTransparentColor = Color.Magenta;
                        }
                    }

                    tool.Items.Add(item);
                    //increment the counter...
                    menuItemImageNamesCount++;
                }

                // finally, add it to the Main ToolStrip.
                MemberDescriptor topMember = TypeDescriptor.GetProperties(tool)["Items"];
                _componentChangeSvc.OnComponentChanging(tool, topMember);
                _componentChangeSvc.OnComponentChanged(tool, topMember, null, null);
            }
            catch (Exception e)
            {
                if (e is InvalidOperationException)
                {
                    IUIService uiService = (IUIService)_provider.GetService(typeof(IUIService));
                    uiService.ShowError(e.Message);
                }

                if (createMenu != null)
                {
                    createMenu.Cancel();
                    createMenu = null;
                }
            }
            finally
            {
                //Reset the AutoAdd state
                ToolStripDesigner.s_autoAddNewItems = true;
                if (createMenu != null)
                {
                    createMenu.Commit();
                    createMenu = null;
                }

                tool.ResumeLayout();
                // Select the Main Menu...
                ISelectionService selSvc = (ISelectionService)_provider.GetService(typeof(ISelectionService));
                if (selSvc != null)
                {
                    selSvc.SetSelectedComponents(new object[] { _designer.Component });
                }

                //Refresh the Glyph
                DesignerActionUIService actionUIService = (DesignerActionUIService)_provider.GetService(typeof(DesignerActionUIService));
                if (actionUIService != null)
                {
                    actionUIService.Refresh(_designer.Component);
                }

                // this will invalidate the Selection Glyphs.
                SelectionManager selMgr = (SelectionManager)_provider.GetService(typeof(SelectionManager));
                selMgr.Refresh();
            }
        }
Esempio n. 45
0
		static bool IsPressed (ToolStripItem toolStripItem)
		{
			return toolStripItem.Pressed;
		}
        /// <summary>
        ///  Here is where all the fun stuff starts.  We create the structure and apply the naming here.
        /// </summary>
        private void CreateStandardMenuStrip(IDesignerHost host, MenuStrip tool)
        {
            // build the static menu items structure.
            string[][] menuItemNames = new string[][]
            {
                new string[] { SR.StandardMenuFile, SR.StandardMenuNew, SR.StandardMenuOpen, "-", SR.StandardMenuSave, SR.StandardMenuSaveAs, "-", SR.StandardMenuPrint, SR.StandardMenuPrintPreview, "-", SR.StandardMenuExit },
                new string[] { SR.StandardMenuEdit, SR.StandardMenuUndo, SR.StandardMenuRedo, "-", SR.StandardMenuCut, SR.StandardMenuCopy, SR.StandardMenuPaste, "-", SR.StandardMenuSelectAll },
                new string[] { SR.StandardMenuTools, SR.StandardMenuCustomize, SR.StandardMenuOptions },
                new string[] { SR.StandardMenuHelp, SR.StandardMenuContents, SR.StandardMenuIndex, SR.StandardMenuSearch, "-", SR.StandardMenuAbout }
            };

            // build the static menu items image list that maps one-one with above menuItems structure. this is required so that the in LOCALIZED build we dont use the Localized item string.
            string[][] menuItemImageNames = new string[][]
            {
                new string[] { "", "new", "open", "-", "save", "", "-", "print", "printPreview", "-", "" },
                new string[] { "", "", "", "-", "cut", "copy", "paste", "-", "" },
                new string[] { "", "", "" },
                new string[] { "", "", "", "", "-", "" }
            };

            Keys[][] menuItemShortcuts = new Keys[][]
            {
                new Keys[] { /*File*/ Keys.None, /*New*/ Keys.Control | Keys.N, /*Open*/ Keys.Control | Keys.O, /*Separator*/ Keys.None, /*Save*/ Keys.Control | Keys.S, /*SaveAs*/ Keys.None, Keys.None, /*Print*/ Keys.Control | Keys.P, /*PrintPreview*/ Keys.None, /*Separator*/ Keys.None, /*Exit*/ Keys.None },
                new Keys[] { /*Edit*/ Keys.None, /*Undo*/ Keys.Control | Keys.Z, /*Redo*/ Keys.Control | Keys.Y, /*Separator*/ Keys.None, /*Cut*/ Keys.Control | Keys.X, /*Copy*/ Keys.Control | Keys.C, /*Paste*/ Keys.Control | Keys.V, /*Separator*/ Keys.None, /*SelectAll*/ Keys.None },
                new Keys[] { /*Tools*/ Keys.None, /*Customize*/ Keys.None, /*Options*/ Keys.None },
                new Keys[] { /*Help*/ Keys.None, /*Contents*/ Keys.None, /*Index*/ Keys.None, /*Search*/ Keys.None, /*Separator*/ Keys.None, /*About*/ Keys.None }
            };

            Debug.Assert(host != null, "can't create standard menu without designer _host.");
            if (host is null)
            {
                return;
            }

            tool.SuspendLayout();
            ToolStripDesigner.s_autoAddNewItems = false;
            // create a transaction so this happens as an atomic unit.
            DesignerTransaction createMenu = _host.CreateTransaction(SR.StandardMenuCreateDesc);

            try
            {
                INameCreationService nameCreationService = (INameCreationService)_provider.GetService(typeof(INameCreationService));
                string defaultName = "standardMainMenuStrip";
                string name        = defaultName;
                int    index       = 1;

                if (host != null)
                {
                    while (_host.Container.Components[name] != null)
                    {
                        name = defaultName + (index++).ToString(CultureInfo.InvariantCulture);
                    }
                }

                // now build the menu items themselves.
                for (int j = 0; j < menuItemNames.Length; j++)
                {
                    string[]          menuArray = menuItemNames[j];
                    ToolStripMenuItem rootItem  = null;
                    for (int i = 0; i < menuArray.Length; i++)
                    {
                        name = null;
                        // for separators, just use the default name.  Otherwise, remove any non-characters and  get the name from the text.
                        string itemText = menuArray[i];
                        name = NameFromText(itemText, typeof(ToolStripMenuItem), nameCreationService, true);
                        ToolStripItem item = null;
                        if (name.Contains("Separator"))
                        {
                            // create the componennt.
                            item = (ToolStripSeparator)_host.CreateComponent(typeof(ToolStripSeparator), name);
                            IDesigner designer = _host.GetDesigner(item);
                            if (designer is ComponentDesigner)
                            {
                                ((ComponentDesigner)designer).InitializeNewComponent(null);
                            }

                            item.Text = itemText;
                        }
                        else
                        {
                            // create the componennt.
                            item = (ToolStripMenuItem)_host.CreateComponent(typeof(ToolStripMenuItem), name);
                            IDesigner designer = _host.GetDesigner(item);
                            if (designer is ComponentDesigner)
                            {
                                ((ComponentDesigner)designer).InitializeNewComponent(null);
                            }

                            item.Text = itemText;
                            Keys shortcut = menuItemShortcuts[j][i];
                            if ((item is ToolStripMenuItem) && shortcut != Keys.None)
                            {
                                if (!ToolStripManager.IsShortcutDefined(shortcut) && ToolStripManager.IsValidShortcut(shortcut))
                                {
                                    ((ToolStripMenuItem)item).ShortcutKeys = shortcut;
                                }
                            }

                            Bitmap image = null;
                            try
                            {
                                image = GetImage(menuItemImageNames[j][i]);
                            }
                            catch
                            {
                                // eat the exception.. as you may not find image for all MenuItems.
                            }

                            if (image != null)
                            {
                                PropertyDescriptor imageProperty = TypeDescriptor.GetProperties(item)["Image"];
                                Debug.Assert(imageProperty != null, "Could not find 'Image' property in ToolStripItem.");
                                if (imageProperty != null)
                                {
                                    imageProperty.SetValue(item, image);
                                }

                                item.ImageTransparentColor = Color.Magenta;
                            }
                        }

                        // the first item in each array is the root item.
                        if (i == 0)
                        {
                            rootItem = (ToolStripMenuItem)item;
                            rootItem.DropDown.SuspendLayout();
                        }
                        else
                        {
                            rootItem.DropDownItems.Add(item);
                        }

                        //If Last SubItem Added the Raise the Events
                        if (i == menuArray.Length - 1)
                        {
                            // member is OK to be null...
                            MemberDescriptor member = TypeDescriptor.GetProperties(rootItem)["DropDownItems"];
                            _componentChangeSvc.OnComponentChanging(rootItem, member);
                            _componentChangeSvc.OnComponentChanged(rootItem, member, null, null);
                        }
                    }

                    // finally, add it to the MainMenu.
                    rootItem.DropDown.ResumeLayout(false);
                    tool.Items.Add(rootItem);
                    //If Last SubItem Added the Raise the Events
                    if (j == menuItemNames.Length - 1)
                    {
                        // member is OK to be null...
                        MemberDescriptor topMember = TypeDescriptor.GetProperties(tool)["Items"];
                        _componentChangeSvc.OnComponentChanging(tool, topMember);
                        _componentChangeSvc.OnComponentChanged(tool, topMember, null, null);
                    }
                }
            }
            catch (Exception e)
            {
                if (e is InvalidOperationException)
                {
                    IUIService uiService = (IUIService)_provider.GetService(typeof(IUIService));
                    uiService.ShowError(e.Message);
                }

                if (createMenu != null)
                {
                    createMenu.Cancel();
                    createMenu = null;
                }
            }
            finally
            {
                ToolStripDesigner.s_autoAddNewItems = true;
                if (createMenu != null)
                {
                    createMenu.Commit();
                    createMenu = null;
                }

                tool.ResumeLayout();
                // Select the Main Menu...
                ISelectionService selSvc = (ISelectionService)_provider.GetService(typeof(ISelectionService));
                if (selSvc != null)
                {
                    selSvc.SetSelectedComponents(new object[] { _designer.Component });
                }

                //Refresh the Glyph
                DesignerActionUIService actionUIService = (DesignerActionUIService)_provider.GetService(typeof(DesignerActionUIService));
                if (actionUIService != null)
                {
                    actionUIService.Refresh(_designer.Component);
                }

                // this will invalidate the Selection Glyphs.
                SelectionManager selMgr = (SelectionManager)_provider.GetService(typeof(SelectionManager));
                selMgr.Refresh();
            }
        }
Esempio n. 47
0
		static bool IsHot (ToolStripItem toolStripItem)
		{
			return toolStripItem.Selected;
		}
Esempio n. 48
0
 private static void Replace(ToolStripItem c)
 {
     c.Font = ReplacedFont(c.Font);
 }
 public int IndexOf(ToolStripItem value)
 {
 }
Esempio n. 50
0
        /// <summary>
        /// Attach.
        /// </summary>
#else
        /// <summary>
        /// アタッチ。
        /// </summary>
#endif
        protected override void Attach()
        {
            _control        = (ToolStripItem)ControlObject;
            _control.Click += ButtonClick;
        }
 public void Remove(ToolStripItem value)
 {
 }
Esempio n. 52
0
        /// <summary>
        /// build up a list of standard items separated by the custom items
        /// </summary>

        public static NewItemsContextMenuStrip GetNewItemDropDown(IComponent component, ToolStripItem currentItem, EventHandler onClick, bool convertTo, IServiceProvider serviceProvider, bool populateCustom)
        {
            NewItemsContextMenuStrip contextMenu = new NewItemsContextMenuStrip(component, currentItem, onClick, convertTo, serviceProvider);

            contextMenu.GroupOrdering.Add("StandardList");
            contextMenu.GroupOrdering.Add("CustomList");
            // plumb through the standard and custom items.
            foreach (ToolStripItem item in GetStandardItemMenuItems(component, onClick, convertTo))
            {
                contextMenu.Groups["StandardList"].Items.Add(item);
                if (convertTo)
                {
                    if (item is ItemTypeToolStripMenuItem toolItem && currentItem != null && toolItem.ItemType == currentItem.GetType())
                    {
                        toolItem.Enabled = false;
                    }
                }
            }
            if (populateCustom)
            {
                GetCustomNewItemDropDown(contextMenu, component, currentItem, onClick, convertTo, serviceProvider);
            }
            if (serviceProvider.GetService(typeof(IUIService)) is IUIService uis)
            {
                contextMenu.Renderer = (ToolStripProfessionalRenderer)uis.Styles["VsRenderer"];
                contextMenu.Font     = (Font)uis.Styles["DialogFont"];
                if (uis.Styles["VsColorPanelText"] is Color)
                {
                    contextMenu.ForeColor = (Color)uis.Styles["VsColorPanelText"];
                }
            }
            contextMenu.Populate();
            return(contextMenu);
        }
 public int Add(ToolStripItem value)
 {
 }
Esempio n. 54
0
 public static void GetCustomNewItemDropDown(NewItemsContextMenuStrip contextMenu, IComponent component, ToolStripItem currentItem, EventHandler onClick, bool convertTo, IServiceProvider serviceProvider)
 {
     foreach (ToolStripItem item in GetCustomItemMenuItems(component, onClick, convertTo, serviceProvider))
     {
         contextMenu.Groups["CustomList"].Items.Add(item);
         if (convertTo)
         {
             if (item is ItemTypeToolStripMenuItem toolItem && currentItem != null && toolItem.ItemType == currentItem.GetType())
             {
                 toolItem.Enabled = false;
             }
         }
     }
     contextMenu.Populate();
 }
 public bool Contains(ToolStripItem value)
 {
 }
Esempio n. 56
0
 private void InitializeComponent()
 {
     this.components = new Container();
     this.mnuJSONTree = new ContextMenuStrip(this.components);
     this.tsmiCopyNode = new ToolStripMenuItem();
     this.tsmiSendNodeToTextWizard = new ToolStripMenuItem();
     this.pnlFooter = new Panel();
     this.lblStatus = new Label();
     this.txtSearch = new TextBox();
     this.btnCollapseAll = new Button();
     this.btnExpandAll = new Button();
     this.tvJSON = new TreeView();
     this.mnuJSONTree.SuspendLayout();
     this.pnlFooter.SuspendLayout();
     base.SuspendLayout();
     ToolStripItem[] toolStripItemArray = new ToolStripItem[2];
     toolStripItemArray[0] = this.tsmiCopyNode;
     toolStripItemArray[1] = this.tsmiSendNodeToTextWizard;
     this.mnuJSONTree.Items.AddRange(toolStripItemArray);
     this.mnuJSONTree.Name = "contextMenuStrip1";
     this.mnuJSONTree.Size = new Size(185, 48);
     this.mnuJSONTree.Opening += new CancelEventHandler(this.mnuJSONTree_Opening);
     this.tsmiCopyNode.Name = "tsmiCopyNode";
     this.tsmiCopyNode.Size = new Size(184, 22);
     this.tsmiCopyNode.Text = "&Copy";
     this.tsmiCopyNode.Click += new EventHandler(this.tsmiCopyNode_Click);
     this.tsmiSendNodeToTextWizard.Name = "tsmiSendNodeToTextWizard";
     this.tsmiSendNodeToTextWizard.Size = new Size(184, 22);
     this.tsmiSendNodeToTextWizard.Text = "S&end to TextWizard...";
     this.tsmiSendNodeToTextWizard.Click += new EventHandler(this.tsmiSendNodeToTextWizard_Click);
     this.pnlFooter.Controls.Add(this.lblStatus);
     this.pnlFooter.Controls.Add(this.txtSearch);
     this.pnlFooter.Controls.Add(this.btnCollapseAll);
     this.pnlFooter.Controls.Add(this.btnExpandAll);
     this.pnlFooter.Dock = DockStyle.Bottom;
     this.pnlFooter.Location = new Point(0, 272);
     this.pnlFooter.Name = "pnlFooter";
     this.pnlFooter.Size = new Size(489, 25);
     this.pnlFooter.TabIndex = 1;
     this.lblStatus.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
     this.lblStatus.Location = new Point(162, 3);
     this.lblStatus.Name = "lblStatus";
     this.lblStatus.Size = new Size(314, 20);
     this.lblStatus.TabIndex = 3;
     this.lblStatus.TextAlign = ContentAlignment.MiddleLeft;
     this.txtSearch.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
     this.txtSearch.Location = new Point(421, 2);
     this.txtSearch.Name = "txtSearch";
     this.txtSearch.Size = new Size(65, 21);
     this.txtSearch.TabIndex = 2;
     this.txtSearch.Visible = false;
     this.btnCollapseAll.Location = new Point(81, 2);
     this.btnCollapseAll.Name = "btnCollapseAll";
     this.btnCollapseAll.Size = new Size(75, 23);
     this.btnCollapseAll.TabIndex = 1;
     this.btnCollapseAll.Text = "Collapse";
     this.btnCollapseAll.UseVisualStyleBackColor = true;
     this.btnCollapseAll.Click += new EventHandler(this.btnCollapseAll_Click);
     this.btnExpandAll.Location = new Point(0, 2);
     this.btnExpandAll.Name = "btnExpandAll";
     this.btnExpandAll.Size = new Size(75, 23);
     this.btnExpandAll.TabIndex = 0;
     this.btnExpandAll.Text = "Expand All";
     this.btnExpandAll.UseVisualStyleBackColor = true;
     this.btnExpandAll.Click += new EventHandler(this.btnExpandAll_Click);
     this.tvJSON.BackColor = Color.AliceBlue;
     this.tvJSON.ContextMenuStrip = this.mnuJSONTree;
     this.tvJSON.Dock = DockStyle.Fill;
     this.tvJSON.Font = new Font("Tahoma", 8.25f);
     this.tvJSON.Location = new Point(0, 0);
     this.tvJSON.Name = "tvJSON";
     this.tvJSON.Size = new Size(489, 272);
     this.tvJSON.TabIndex = 0;
     this.tvJSON.KeyDown += new KeyEventHandler(this.tvXML_KeyDown);
     base.Controls.Add(this.tvJSON);
     base.Controls.Add(this.pnlFooter);
     this.Font = new Font("Tahoma", 8.25f);
     base.Name = "JsonpView";
     base.Size = new Size(489, 297);
     this.mnuJSONTree.ResumeLayout(false);
     this.pnlFooter.ResumeLayout(false);
     this.pnlFooter.PerformLayout();
     base.ResumeLayout(false);
 }
Esempio n. 57
0
        public static void InvalidateSelection(ArrayList originalSelComps, ToolStripItem nextSelection, IServiceProvider provider, bool shiftPressed)
        {
            // if we are not selecting a ToolStripItem then return (dont invalidate).
            if (nextSelection == null || provider == null)
            {
                return;
            }
            //InvalidateOriginal SelectedComponents.
            Region invalidateRegion        = null;
            Region itemRegion              = null;
            int    GLYPHBORDER             = 1;
            int    GLYPHINSET              = 2;
            ToolStripItemDesigner designer = null;
            bool templateNodeSelected      = false;

            try
            {
                Rectangle     invalidateBounds = Rectangle.Empty;
                IDesignerHost designerHost     = (IDesignerHost)provider.GetService(typeof(IDesignerHost));

                if (designerHost != null)
                {
                    foreach (Component comp in originalSelComps)
                    {
                        if (comp is ToolStripItem selItem)
                        {
                            if ((originalSelComps.Count > 1) ||
                                (originalSelComps.Count == 1 && selItem.GetCurrentParent() != nextSelection.GetCurrentParent()) ||
                                selItem is ToolStripSeparator || selItem is ToolStripControlHost || !selItem.IsOnDropDown || selItem.IsOnOverflow)
                            {
                                // finally Invalidate the selection rect ...
                                designer = designerHost.GetDesigner(selItem) as ToolStripItemDesigner;
                                if (designer != null)
                                {
                                    invalidateBounds = designer.GetGlyphBounds();
                                    GetAdjustedBounds(selItem, ref invalidateBounds);
                                    invalidateBounds.Inflate(GLYPHBORDER, GLYPHBORDER);

                                    if (invalidateRegion == null)
                                    {
                                        invalidateRegion = new Region(invalidateBounds);
                                        invalidateBounds.Inflate(-GLYPHINSET, -GLYPHINSET);
                                        invalidateRegion.Exclude(invalidateBounds);
                                    }
                                    else
                                    {
                                        itemRegion = new Region(invalidateBounds);
                                        invalidateBounds.Inflate(-GLYPHINSET, -GLYPHINSET);
                                        itemRegion.Exclude(invalidateBounds);
                                        invalidateRegion.Union(itemRegion);
                                    }
                                }
                            }
                        }
                    }
                }

                if (invalidateRegion != null || templateNodeSelected || shiftPressed)
                {
                    BehaviorService behaviorService = (BehaviorService)provider.GetService(typeof(BehaviorService));
                    if (behaviorService != null)
                    {
                        if (invalidateRegion != null)
                        {
                            behaviorService.Invalidate(invalidateRegion);
                        }

                        // When a ToolStripItem is PrimarySelection, the glyph bounds are not invalidated  through the SelectionManager so we have to do this.
                        designer = designerHost.GetDesigner(nextSelection) as ToolStripItemDesigner;
                        if (designer != null)
                        {
                            invalidateBounds = designer.GetGlyphBounds();
                            GetAdjustedBounds(nextSelection, ref invalidateBounds);
                            invalidateBounds.Inflate(GLYPHBORDER, GLYPHBORDER);
                            invalidateRegion = new Region(invalidateBounds);

                            invalidateBounds.Inflate(-GLYPHINSET, -GLYPHINSET);
                            invalidateRegion.Exclude(invalidateBounds);
                            behaviorService.Invalidate(invalidateRegion);
                        }
                    }
                }
            }
            finally
            {
                if (invalidateRegion != null)
                {
                    invalidateRegion.Dispose();
                }

                if (itemRegion != null)
                {
                    itemRegion.Dispose();
                }
            }
        }
 public ToolStripMenuItem(string text, System.Drawing.Image image, ToolStripItem[] dropDownItems)
 {
 }
        /// <include file='doc\ToolStripItemClickedEventArgs.uex' path='docs/doc[@for="ToolStripItemClickedEventArgs.ToolStripItemClickedEventArgs"]/*' />
        /// <devdoc>
        /// This class represents event args a ToolStrip can use when an item has been clicked.
        /// </devdoc>
        public ToolStripItemClickedEventArgs(ToolStripItem clickedItem) {

            this.clickedItem = clickedItem;
        }
Esempio n. 60
0
        private ContextMenuStrip CreateItemMenu(object model, BrightIdeasSoftware.OLVColumn column)
        {
            if (model != null && model as IVideoJob != null)
            {
                IVideoJob        job  = model as IVideoJob;
                ContextMenuStrip menu = new ContextMenuStrip();

                {
                    IUserInputRequest uir = job.UserInputRequest;
                    if (uir != null)
                    {
                        ToolStripMenuItem item = new ToolStripMenuItem(uir.GetQuestion());
                        foreach (string option in uir.GetOptions())
                        {
                            item.DropDownItems.Add(option).Click += (sender, e) => {
                                if (uir != null)
                                {
                                    uir.SelectOption(option);
                                }
                            };
                        }
                        menu.Items.Add(item);
                        menu.Items.Add(new ToolStripSeparator());
                    }
                }

                bool queueOptionsAvailable = false;
                if ((job.JobStatus == VideoJobStatus.NotStarted || job.JobStatus == VideoJobStatus.Dead) && !VideoTaskGroups[job.VideoInfo.Service].IsInQueue(job))
                {
                    queueOptionsAvailable = true;
                    ToolStripItem item = menu.Items.Add("Enqueue");
                    item.Click += (sender, e) => {
                        VideoTaskGroups[job.VideoInfo.Service].Add(new WaitingVideoJob(job));
                    };
                }

                if ((job.JobStatus == VideoJobStatus.NotStarted || job.JobStatus == VideoJobStatus.Dead) && VideoTaskGroups[job.VideoInfo.Service].IsInQueue(job))
                {
                    queueOptionsAvailable = true;
                    ToolStripItem item = menu.Items.Add("Dequeue");
                    item.Click += (sender, e) => {
                        VideoTaskGroups[job.VideoInfo.Service].Dequeue(job);
                    };
                }

                if (job.JobStatus == VideoJobStatus.NotStarted || job.JobStatus == VideoJobStatus.Dead)
                {
                    queueOptionsAvailable = true;
                    ToolStripItem item = menu.Items.Add("Download now");
                    item.Click += (sender, e) => {
                        if (job.JobStatus == VideoJobStatus.NotStarted || job.JobStatus == VideoJobStatus.Dead)
                        {
                            VideoTaskGroups[job.VideoInfo.Service].Add(new WaitingVideoJob(job, true));
                        }
                    };
                }

                if (queueOptionsAvailable)
                {
                    menu.Items.Add(new ToolStripSeparator());
                }


                {
                    ToolStripItem item = menu.Items.Add("Copy Video ID");
                    item.Click += (sender, e) => {
                        string id = job?.VideoInfo?.VideoId;
                        if (id != null)
                        {
                            Clipboard.SetText(id);
                        }
                    };
                }
                {
                    ToolStripItem item = menu.Items.Add("Copy Output Filename");
                    item.Click += (sender, e) => {
                        string fn = job?.GenerateOutputFilename();
                        if (fn != null)
                        {
                            Clipboard.SetText(fn);
                        }
                    };
                }

                menu.Items.Add(new ToolStripSeparator());

                if (job.JobStatus == VideoJobStatus.Running)
                {
                    ToolStripItem item = menu.Items.Add("Stop");
                    item.Click += (sender, e) => {
                        if (job.JobStatus == VideoJobStatus.Running)
                        {
                            VideoTaskGroups[job.VideoInfo.Service].CancelJob(job);
                        }
                    };
                }

                if (job.JobStatus == VideoJobStatus.NotStarted)
                {
                    ToolStripItem item = menu.Items.Add("Kill");
                    item.Click += (sender, e) => {
                        if (job.JobStatus == VideoJobStatus.NotStarted)
                        {
                            job.JobStatus = VideoJobStatus.Dead;
                            job.Status    = "[Manually killed] " + job.Status;
                        }
                    };
                }

                if (job.JobStatus != VideoJobStatus.Running)
                {
                    ToolStripItem item = menu.Items.Add("Remove");
                    item.Click += (sender, e) => {
                        if (job.JobStatus != VideoJobStatus.Running)
                        {
                            objectListViewDownloads.RemoveObject(job);
                            JobSet.Remove(job);
                        }
                    };
                }

                return(menu.Items.Count > 0 ? menu : null);
            }
            return(null);
        }