public void HandleToolBarCommand(CommandDetails commandDetails) { if (commandDetails.CommandType == CommandType.CustomMatrix) { MatrixInputForm inputForm = new MatrixInputForm(((int[])commandDetails.CommandParam)[0], ((int[])commandDetails.CommandParam)[1]); inputForm.ProcessRequest += (x, y) => { CommandDetails newCommand = new CommandDetails { CommandType = CommandType.Matrix }; newCommand.CommandParam = new int[] { x, y }; editor.HandleUserCommand(newCommand); }; inputForm.ShowDialog(this); } else { editor.HandleUserCommand(commandDetails); if (commandDetails.CommandType == CommandType.Text) { historyToolBar.AddItem(commandDetails.UnicodeString); } } }