static void OnTaskSetup(ref EdmCmd poCmd, ref EdmCmdData[] ppoData) { try { //Get the property interface used to //access the framework var edmTaskProperties = (IEdmTaskProperties)poCmd.mpoExtra; //Set the property flag that says you want a //menu item for the user to launch the task //and a flag to support scheduling edmTaskProperties.TaskFlags = (int)EdmTaskFlag.EdmTask_SupportsInitForm + (int)EdmTaskFlag.EdmTask_SupportsDetails + (int)EdmTaskFlag.EdmTask_SupportsChangeState; //edmTaskProperties.TaskFlags = (int)EdmTaskFlag.EdmTask_SupportsChangeState + (int)EdmTaskFlag.EdmTask_SupportsInitExec; //Set up the menu commands to launch this task var edmTaskMenuCmds = new EdmTaskMenuCmd[1]; edmTaskMenuCmds[0].mbsMenuString = "Выгрузить eDrawing"; edmTaskMenuCmds[0].mbsStatusBarHelp = "Выгрузить eDrawing"; edmTaskMenuCmds[0].mlCmdID = 1; edmTaskMenuCmds[0].mlEdmMenuFlags = (int)EdmMenuFlags.EdmMenu_Nothing; edmTaskProperties.SetMenuCmds(edmTaskMenuCmds); } catch (COMException ex) { Logger.Add("OnTaskSetup HRESULT = 0x" + ex.ErrorCode.ToString("X") + "; " + ex.Message); } catch (Exception ex) { Logger.Add("OnTaskSetup Error" + ex.Message + ppoData); } }
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; } }