/// <summary> /// 将UI序列化到指定的文件 /// 需要外部捕获异常 /// </summary> /// <param name="packageName">资源包名称</param> /// <param name="fileName">文件名称</param> /// <param name="windowToSerialize">指定序列化那个窗体(包含其所有的子窗体)</param> public void Serialize(string packageName, string fileName, Window windowToSerialize) { //XmlSerializeWriter writer = new XmlSerializeWriter("F:/Test.nui"); NXmlSerializeDataWriter writer = new NXmlSerializeDataWriter(packageName, fileName); SerializeWriter serializer = new SerializeWriter(writer); serializer.Serialize(windowToSerialize); writer.Close(); }