private void OnlistBoxItems_SelectedIndexChanged(object sender, EventArgs e) { object[] destination = new object[this.listBoxItems.SelectedItems.Count]; if (destination.Length > 0) { this.listBoxItems.SelectedItems.CopyTo(destination, 0); } if ((destination.Length == 1) && (destination[0] is ToolStrip)) { ToolStrip strip = destination[0] as ToolStrip; if ((strip != null) && (strip.Site != null)) { if (this.toolStripCustomTypeDescriptor == null) { this.toolStripCustomTypeDescriptor = new ToolStripCustomTypeDescriptor((ToolStrip)destination[0]); } this.selectedItemProps.SelectedObjects = new object[] { this.toolStripCustomTypeDescriptor }; } else { this.selectedItemProps.SelectedObjects = null; } } else { this.selectedItemProps.SelectedObjects = destination; } this.btnMoveUp.Enabled = (this.listBoxItems.SelectedItems.Count == 1) && (this.listBoxItems.SelectedIndex > 1); this.btnMoveDown.Enabled = (this.listBoxItems.SelectedItems.Count == 1) && (this.listBoxItems.SelectedIndex < (this.listBoxItems.Items.Count - 1)); this.btnRemove.Enabled = destination.Length > 0; foreach (object obj2 in this.listBoxItems.SelectedItems) { if (obj2 is ToolStrip) { this.btnRemove.Enabled = this.btnMoveUp.Enabled = this.btnMoveDown.Enabled = false; break; } } this.listBoxItems.Invalidate(); this.selectedItemName.Invalidate(); }
private void OnlistBoxItems_SelectedIndexChanged(object sender, EventArgs e) { object[] destination = new object[this.listBoxItems.SelectedItems.Count]; if (destination.Length > 0) { this.listBoxItems.SelectedItems.CopyTo(destination, 0); } if ((destination.Length == 1) && (destination[0] is ToolStrip)) { ToolStrip strip = destination[0] as ToolStrip; if ((strip != null) && (strip.Site != null)) { if (this.toolStripCustomTypeDescriptor == null) { this.toolStripCustomTypeDescriptor = new ToolStripCustomTypeDescriptor((ToolStrip) destination[0]); } this.selectedItemProps.SelectedObjects = new object[] { this.toolStripCustomTypeDescriptor }; } else { this.selectedItemProps.SelectedObjects = null; } } else { this.selectedItemProps.SelectedObjects = destination; } this.btnMoveUp.Enabled = (this.listBoxItems.SelectedItems.Count == 1) && (this.listBoxItems.SelectedIndex > 1); this.btnMoveDown.Enabled = (this.listBoxItems.SelectedItems.Count == 1) && (this.listBoxItems.SelectedIndex < (this.listBoxItems.Items.Count - 1)); this.btnRemove.Enabled = destination.Length > 0; foreach (object obj2 in this.listBoxItems.SelectedItems) { if (obj2 is ToolStrip) { this.btnRemove.Enabled = this.btnMoveUp.Enabled = this.btnMoveDown.Enabled = false; break; } } this.listBoxItems.Invalidate(); this.selectedItemName.Invalidate(); }