c# - How to add the right-click breakpoints menu to a rehosted workflow designer -


a shortcoming of rehosted workflow designer not, default, include many of features necessary serious workflow development.

chief among these lack of native debug/breakpoint support.

there samples online show how enable debugging, didn't find included showing breakpoint section of right-click context menu activities

it turns out adding breakpoint menuitems context menu relatively straightforward.

first, make class implements system.activities.presentation.hosting.icommandservice

public class commandservice : icommandservice {     private workflowdesigner workflowdesigner;      public commandservice(workflowdesigner designer) { this.workflowdesigner = designer; }     public bool canexecutecommand(int commandid)     {         return true;      }      public event eventhandler breakpointschanged;     public event eventhandler showpropertiesrequested;      public void executecommand(int commandid, dictionary<string, object> parameters)     {         switch (commandid)         {             case commandvalues.insertbreakpoint:                 workflowdesigner.context.services.getservice<idesignerdebugview>().updatebreakpoint((sourcelocation)parameters["sourcelocation"], (breakpointtypes)parameters["breakpointtypes"] | breakpointtypes.enabled);                 if (breakpointschanged != null)                     breakpointschanged(this, new eventargs());                 break;             case commandvalues.deletebreakpoint:                 workflowdesigner.context.services.getservice<idesignerdebugview>().updatebreakpoint((sourcelocation)parameters["sourcelocation"], breakpointtypes.none);                 if (breakpointschanged != null)                     breakpointschanged(this, new eventargs());                 break;             case commandvalues.enablebreakpoint:                 workflowdesigner.context.services.getservice<idesignerdebugview>().updatebreakpoint((sourcelocation)parameters["sourcelocation"], breakpointtypes.enabled | breakpointtypes.bounded);                 if (breakpointschanged != null)                     breakpointschanged(this, new eventargs());                 break;             case commandvalues.disablebreakpoint:                 workflowdesigner.context.services.getservice<idesignerdebugview>().updatebreakpoint((sourcelocation)parameters["sourcelocation"], breakpointtypes.bounded);                 if (breakpointschanged != null)                     breakpointschanged(this, new eventargs());                 break;             case commandvalues.showproperties:                 if (showpropertiesrequested != null)                     showpropertiesrequested(this, new eventargs());                 break;         }     }      public bool iscommandsupported(int commandid)     {         switch (commandid)         {             case commandvalues.showproperties:             case commandvalues.insertbreakpoint:             case commandvalues.deletebreakpoint:             case commandvalues.enablebreakpoint:             case commandvalues.disablebreakpoint:                 return true;             default:                 return false;         }     } } 

then create it, register events, , publish workflow designer so

commandservice cmdsvc = new commandservice(workflowdesigner); cmdsvc.breakpointschanged += cmdsvc_breakpointschanged; cmdsvc.showpropertiesrequested+= cmdsvc_showpropertiesrequested; workflowdesigner.context.services.publish<icommandservice>(cmdsvc); 

the context menu items adding, removing, enabling , disabling breakpoints shown when right-click activity. there "properties" context item command should implement show property grid if hiding allowed


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -