private void btnAll_Click(object sender, EventArgs e) { var button = (Infragistics.Win.Misc.UltraButton) sender; switch(button.Text) { case "Cancel": _groupItem = new GroupItem(); break; case "Delete": DeleteRealObject(_groupName, _realItem); break; default: UpdateCreateRealObject(_groupName, _realItem); break; } this.Close(); }
internal void UpdateExplorerBar(ContextMenuHelper helper, string menuItemText, GroupItem groupItem) { // Note - DB updates have already been done, we're just updating explorer bar if(groupItem.ID == 0) // User cancelled { return; } // We are deleting item if(groupItem.Name == "") { MessageBox.Show("Delete " + helper.Group.Text + ": " + groupItem.ID.ToString()); // delete item helper.Item.ParentCollection.Remove(helper.Item); return; } if(menuItemText == "Add") { // New item was added var nameChar = helper.Group.Text.Substring(0, 1); var stateItem = helper.Group.Items.Add(nameChar + groupItem.ID, groupItem.Name); stateItem.Tag = groupItem.ID; } else { // Update existing item text helper.Item.Text = groupItem.Name; } }