다음을 통해 공유


WorkflowDesignerLoader.SaveDesignerLayout 메서드

정의

디자이너 레이아웃을 serialize합니다.

protected:
 void SaveDesignerLayout(System::Xml::XmlWriter ^ layoutWriter, System::Workflow::ComponentModel::Design::ActivityDesigner ^ rootDesigner, [Runtime::InteropServices::Out] System::Collections::IList ^ % layoutSaveErrors);
protected void SaveDesignerLayout (System.Xml.XmlWriter layoutWriter, System.Workflow.ComponentModel.Design.ActivityDesigner rootDesigner, out System.Collections.IList layoutSaveErrors);
member this.SaveDesignerLayout : System.Xml.XmlWriter * System.Workflow.ComponentModel.Design.ActivityDesigner * IList -> unit
Protected Sub SaveDesignerLayout (layoutWriter As XmlWriter, rootDesigner As ActivityDesigner, ByRef layoutSaveErrors As IList)

매개 변수

layoutWriter
XmlWriter

레이아웃을 serialize하는 데 사용되는 XmlWriter입니다.

rootDesigner
ActivityDesigner

레이아웃 정보를 가져올 루트 활동입니다.

layoutSaveErrors
IList

serialize하는 동안 발생된 오류입니다.

예제

다음 예제에서는 SaveDesignerLayout 메서드를 사용하여 워크플로의 디자인 레이아웃 정보를 저장하는 방법을 보여 줍니다. 후는 XmlWriter 개체를 만든를 ActivityDesigner 에 대 한 합니다 RootComponent 의 워크플로 검색 하 고 전달할는 SaveDesignerLayout 메서드. 이 메서드가 생성한 레이아웃 파일을 로드하려면 LoadDesignerLayout을 참조하십시오.

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);

        if (layoutSaveErrors.Count > 0)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder("Errors:\r\n");
            foreach (WorkflowMarkupSerializationException error in layoutSaveErrors)
            {
                sb.Append(error.Message + "\r\n");
            }
            MessageBox.Show(sb.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
Public Sub SaveLayout()
    Using writer As XmlWriter = XmlWriter.Create("wfInstanceId.designer.xml")
        Dim layoutSaveErrors As IList = CType(New ArrayList(), IList)

        Dim host As IDesignerHost = CType(GetService(GetType(IDesignerHost)), IDesignerHost)
        Dim rootDesigner As ActivityDesigner = CType(host.GetDesigner(host.RootComponent), ActivityDesigner)
        Me.SaveDesignerLayout(writer, rootDesigner, layoutSaveErrors)

        If layoutSaveErrors.Count > 0 Then
            Dim sb As New System.Text.StringBuilder("Errors:\r\n")
            For Each errorMessage As WorkflowMarkupSerializationException In layoutSaveErrors
                sb.Append(errorMessage.Message + "\r\n")
            Next
            MessageBox.Show(sb.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Using
End Sub

적용 대상