WorkflowDesignerLoader.Flush Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Writes pending changes to the location that the designer was loaded from.
public:
override void Flush();
public override void Flush ();
override this.Flush : unit -> unit
Public Overrides Sub Flush ()
Examples
The following example demonstrates how to override the Flush method to serialize a workflow using the WorkflowMarkupSerializer. In this example, the overridden Flush delegates to the PerformFlush method defined in the WorkflowDesignerLoader derived class.
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
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET