locked
Detecting changes to a workflow in rehosted designer. RRS feed

  • Question

  • Is it possible to check to see if any changes were made to a workflow in the rehosted designer? I'd like to prompt the user to save their changes if they are trying to close or load a different workflow and they have not yet saved them.

    Thanks

    Wednesday, September 29, 2010 10:31 PM

Answers

  • Hi, Parry

    You can detect workflow changes by the following code when you load up a workflow or create a new one:

                ModelService modelService = wd.Context.Services.GetService<ModelService>();
                modelService.ModelChanged += (obj, arg) => {
                    Console.WriteLine("workflow changed");
                };
    wd is a instance of WorkflowDesiger.

    Hope this helps
    Regards
    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support. My Blog:http://xhinker.com "Microsoft Windows Workflow Foundation 4.0 Cookbook"
    • Marked as answer by Andrew_Zhu Thursday, October 7, 2010 6:34 AM
    Monday, October 4, 2010 9:41 AM

All replies

  • Hi, Parry

    You can detect workflow changes by the following code when you load up a workflow or create a new one:

                ModelService modelService = wd.Context.Services.GetService<ModelService>();
                modelService.ModelChanged += (obj, arg) => {
                    Console.WriteLine("workflow changed");
                };
    wd is a instance of WorkflowDesiger.

    Hope this helps
    Regards
    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support. My Blog:http://xhinker.com "Microsoft Windows Workflow Foundation 4.0 Cookbook"
    • Marked as answer by Andrew_Zhu Thursday, October 7, 2010 6:34 AM
    Monday, October 4, 2010 9:41 AM
  • Hi Parry

     

    Within this ModelChanged event I want to process only when ItemsAdded count is more than one. how can I do this ?

     

    Thanks

    Ocean

    Saturday, March 5, 2011 7:25 AM