Partager via


WorkflowDesignerLoader.SaveDesignerLayout Méthode

Définition

Sérialise la disposition de concepteur.

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)

Paramètres

layoutWriter
XmlWriter

XmlWriter qui est utilisé pour sérialiser la disposition.

rootDesigner
ActivityDesigner

Activité racine à partir de laquelle vous obtenez les informations relatives à la disposition.

layoutSaveErrors
IList

Erreurs rencontrées au cours de la sérialisation.

Exemples

L'exemple suivant montre comment enregistrer les informations relatives à la disposition de design d'un workflow à l'aide de la méthode SaveDesignerLayout. Une fois l’objet XmlWriter créé, le ActivityDesigner pour le RootComponent du flux de travail est récupéré et passé à la SaveDesignerLayout méthode . Pour charger le fichier de disposition généré par cette méthode, consultez 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

S’applique à