WorkflowDesignerLoader.SaveDesignerLayout Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Serializa o layout do designer.
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)
Parâmetros
- layoutWriter
- XmlWriter
XmlWriter
que é usado para serializar o layout.
- rootDesigner
- ActivityDesigner
Atividade raiz de onde você obtém as informações de layout.
- layoutSaveErrors
- IList
Erros encontrados durante a serialização.
Exemplos
O exemplo a seguir demonstra como salvar as informações de layout de design de um fluxo de trabalho usando o SaveDesignerLayout método. Depois que o XmlWriter objeto é criado, o ActivityDesigner RootComponent
fluxo de trabalho é recuperado e passado para o SaveDesignerLayout método. Para carregar o arquivo de layout gerado por esse método, consulte 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