Udostępnij przez


WorkflowDesignerLoader.SaveDesignerLayout Metoda

Definicja

Serializuje układ projektanta.

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)

Parametry

layoutWriter
XmlWriter

XmlWriter służy do serializacji układu w.

rootDesigner
ActivityDesigner

Działanie główne, z którego uzyskujesz informacje o układzie.

layoutSaveErrors
IList

Błędy napotkane podczas serializacji.

Przykłady

W poniższym przykładzie pokazano, jak zapisać informacje o układzie projektu przepływu pracy przy użyciu SaveDesignerLayout metody . Po utworzeniu XmlWriterActivityDesigner obiektu element dla RootComponent przepływu pracy jest pobierany i przekazywany do SaveDesignerLayout metody . Aby załadować plik układu generowany przez tę metodę, zobacz 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

Dotyczy