private void OnTaskSetupButton(ref EdmCmd poCmd, ref EdmCmdData[] ppoData) { try { //Custom setup page, SetupPageObj, is created //in method Class1::OnTaskSetup; SetupPage::StoreData //saves the contents of the list box to poCmd.mpoExtra //in the IEdmTaskProperties interface if (poCmd.mbsComment == "OK" && (taskSettings != null)) { IEdmTaskProperties props = poCmd.mpoExtra as IEdmTaskProperties; //Pull settings from windows //Set up the menu commands to launch this task if (taskSettings.CreateMenu) { EdmTaskMenuCmd[] cmds = new EdmTaskMenuCmd[1]; cmds[0].mbsMenuString = taskSettings.MenuName; cmds[0].mbsStatusBarHelp = taskSettings.MenuDescription; cmds[0].mlCmdID = 2; cmds[0].mlEdmMenuFlags = (int)EdmMenuFlags.EdmMenu_MustHaveSelection; props.SetMenuCmds(cmds); } props.SetValEx(AutoCADTaskSettings.Acadtask_Settings, JsonConvert.SerializeObject(taskSettings)); } } catch (System.Runtime.InteropServices.COMException ex) { MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { taskSettings = null; } }