protected void AddMenu(string text, ControllerMenuDelegate proc) { EventHandler handler = delegate(object sender, EventArgs e) { try { proc(); } catch (GUIException ex) { MessageBox.Show(ex.Message, text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }; contextmenu.MenuItems.Add(text, handler); }
protected void AddMenu(string text,ControllerMenuDelegate proc) { EventHandler handler = delegate(object sender,EventArgs e) { try { proc(); } catch (GUIException ex) { MessageBox.Show(ex.Message,text,MessageBoxButtons.OK,MessageBoxIcon.Error); } }; contextmenu.MenuItems.Add(text,handler); }