public static string GetClassicDesignXml(int designId) { //Gis MM Package includes full design xml //But requires a Designer License to retrieve //use normal package IMMPackageByUser mpm = new MMPackageManagerClass(); IMMPackageName pname = new MMPackageNameClass(); pname.Initialize(-1, designId.ToString(), mmPackageType.mmPTHidden, mmPackageCategory.mmPCDesignXML); IMMPackageName packname = mpm.GetPackageNameByUser(pname, designId.ToString()); if (packname != null) { IMMPackage package = mpm.GetPackageByUser(packname, designId.ToString()); if (package != null) { IMMDesignPackage dpack = package.Contents as IMMDesignPackage; return dpack.DesignXML.xml; } } //If we got here, we couldn't load the package return null; }
public static string GetClassicDesignXml(int designId) { //Gis MM Package includes full design xml //But requires a Designer License to retrieve //use normal package IMMPackageByUser mpm = new MMPackageManagerClass(); IMMPackageName pname = new MMPackageNameClass(); pname.Initialize(-1, designId.ToString(), mmPackageType.mmPTHidden, mmPackageCategory.mmPCDesignXML); IMMPackageName packname = mpm.GetPackageNameByUser(pname, designId.ToString()); if (packname != null) { IMMPackage package = mpm.GetPackageByUser(packname, designId.ToString()); if (package != null) { IMMDesignPackage dpack = package.Contents as IMMDesignPackage; return(dpack.DesignXML.xml); } } //If we got here, we couldn't load the package return(null); }
/// <summary> /// Loads the package XML from the underlying workspace. /// </summary> /// <returns> /// Returns a <see cref="string" /> representing the design XML; otherwise <c>null</c> /// </returns> /// <exception cref="NullReferenceException">The process framework workspace is null.</exception> public string GetDesignXml() { IWorkspace workspace = ((IMMPxApplicationEx2)base.PxApplication).Workspace; if (workspace == null) { throw new NullReferenceException("The process framework workspace is null."); } string name = this.ID.ToString(CultureInfo.InvariantCulture); IMMPackageName packageName = new MMPackageNameClass(); packageName.Category = mmPackageCategory.mmPCDesignXML; packageName.Type = mmPackageType.mmPTHidden; packageName.Name = name; IMMPackageByWS packageByWs = new MMPackageManagerClass(); IMMPackage package = packageByWs.GetPackageByWS(packageName, workspace, name); if (package != null) { IStream stream = new XMLStreamClass(); package.Contents.SaveToStream(stream); string xml = ((IXMLStream)stream).SaveToString(); return(xml); } return(null); }