Welcome to MSDN Blogs Sign in | Join | Help

Mark Schmidt's Abode

On Programming, Writing, Gaming, Fitness, Life

News

  • Have a Question?

    Click here to chat with me

    XBox Live GamerTag


    Twitter



    The Mark Cam


    My MoBlog

    www.flickr.com
    This is a Flickr badge showing public photos from codepunk. Make your own badge here.

    Community-Credit

Saving WF Designer layout information

So you created a fancy new application and it hosts the WF designer. It's all looking good and when you go to load up that cool state machine workflow you created earlier to add a bit more polish, you notice that all the layout you worked for hours (ok, maybe not that long) is gone. You know need to add the ability to load and save layout information for the workflow definitions your application creates. Note that you'll still need a way to associate specific layout information to a specific workflow, but I'll leave that as an exercise for you since there's about 5001 different ways). So, to save layout information for a workflow within a hosted designer, use the following code from your WorkflowDesignerLoader class:

public void SaveLayout()

{

    using (XmlWriter writer = XmlWriter.Create("wfInstanceId.designer.xml"))  

    {

        IList layoutSaveErrors = new ArrayList() as IList;

        IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

        ActivityDesigner rootDesigner =

            host.GetDesigner(host.RootComponent) as ActivityDesigner;

        this.SaveDesignerLayout(writer, rootDesigner, out layoutSaveErrors);

    }

}

Posted: Wednesday, August 09, 2006 3:45 PM by markhsch
Filed under:

Comments

Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker