다음을 통해 공유


WorkflowDesignerLoader.Flush 메서드

정의

보류 중인 변경 내용을 디자이너가 로드된 위치에 씁니다.

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

예제

다음 예제에서는 Flush를 사용하여 워크플로를 serialize하기 위해 WorkflowMarkupSerializer 메서드를 재정의하는 방법을 보여 줍니다. 이 예제에서 재정의된 FlushPerformFlush 파생 클래스에서 정의된 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

적용 대상