WorkflowDesignerLoader.PerformFlush(IDesignerSerializationManager) Method

Definition

Writes cached changes to the location that the designer was loaded from.

C#
protected override void PerformFlush(System.ComponentModel.Design.Serialization.IDesignerSerializationManager serializationManager);

Parameters

serializationManager
IDesignerSerializationManager

Class that implements the IDesignerSerializationManager interface, which manages design-time serialization.

Examples

The following example demonstrates how to override the PerformFlush method to serialize the workflow using the WorkflowMarkupSerializer.

C#
public override void Flush()
{
    this.PerformFlush(null);
}

protected override void PerformFlush(IDesignerSerializationManager manager)
{
    IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

    if (host != null && host.RootComponent != null)
    {
        Activity service = host.RootComponent as Activity;

        if (service != null)
        {
            using (XmlWriter writer = XmlWriter.Create(this.xomlFile))
            {
                WorkflowMarkupSerializer xomlSerializer = new WorkflowMarkupSerializer();
                if (manager == null)
                {
                    xomlSerializer.Serialize(writer, service);
                }
                else
                {
                    xomlSerializer.Serialize(manager, writer, service);
                }
            }
        }
    }
}

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1