Compartir a través de


WorkflowDesignerLoader.Flush Método

Definición

Escribe los cambios pendientes en la ubicación desde la que se cargó el diseñador.

public:
 override void Flush();
public override void Flush ();
override this.Flush : unit -> unit
Public Overrides Sub Flush ()

Ejemplos

El ejemplo siguiente muestra cómo invalidar el método Flush para serializar un flujo de trabajo utilizando WorkflowMarkupSerializer. En este ejemplo, el método invalidado Flush delega al método PerformFlush definido en la clase derivada WorkflowDesignerLoader.

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);
                }
            }
        }
    }
}
Public Overrides Sub Flush()
    Me.PerformFlush(Nothing)
End Sub

Protected Overrides Sub PerformFlush(ByVal manager As IDesignerSerializationManager)
    Dim host As IDesignerHost = CType(GetService(GetType(IDesignerHost)), IDesignerHost)

    If host IsNot Nothing And host.RootComponent IsNot Nothing Then
        Dim service As Activity = CType(host.RootComponent, Activity)

        If service IsNot Nothing Then
            Using writer As XmlWriter = XmlWriter.Create(Me.XomlFile)
                Dim xomlSerializer As New WorkflowMarkupSerializer()
                If manager IsNot Nothing Then
                    xomlSerializer.Serialize(writer, service)
                Else
                    xomlSerializer.Serialize(manager, writer, service)
                End If
            End Using
        End If
    End If
End Sub

Se aplica a