CreatePublicator: IMobileApplicationPublicator;
CreatePublicator: Prognoz.Platform.Interop.Mobile.IMobileApplicationPublicator;
The CreatePublicator method creates an object that publishes the mobile application.
To publish, use the IMobileApplicationPublicator.Execute method.
Executing the example requires that the repository contains a mobile application with the MA_PUB identifier. Add links to the Metabase, Mobile, Xml system assemblies.
The example also uses the MobileAppCallback class described in the Fore Example for IMobileApplicationPublishCallBack.OnStartPublish.
Sub UserProc;
Var
mb: IMetabase;
Mobile: IMobileApplication;
Publicator: IMobileApplicationPublicator;
callBack: MobileAppCallback;
res: MobilePublishResult;
XmlDoc: IXmlDomDocument3;
el: IXmlDomElement;
Begin
mb := MetabaseClass.Active;
// Get the published mobile application (MA)
Mobile := mb.ItemById("MA_PUB").Bind As IMobileApplication;
// Create a mobile application publicator
Publicator := Mobile.CreatePublicator;
// Specify a Web server and a virtual directory for publishing the mobile application
Publicator.WebApplication := "http://prognoz/PPMobile_App_v7";
// If the mobile application is not published, start publishing
If Not (Publicator.IsPublished = MobilePublishResult.Ok) Then
// Create an handler of events fired on publishing the mobile application
callBack := New MobileAppCallback.Create;
// Start publishing the mobile application
res := Publicator.Execute(callBack);
// Handle the results of publishing the mobile application
If res = MobilePublishResult.Ok Then
Debug.WriteLine("Publishing was successful").
Else
Debug.WriteLine("Error occurred during publishing");
End If;
// Save parameters of the mobile application publishing to the XML file
XmlDoc := New DOMDocument60.Create;
el := XmlDoc.createElement("Root");
XmlDoc.appendChild(el);
Publicator.SaveToXml(el);
XmlDoc.save("C:\Publicator.xml");
End If;
End Sub UserProc;
Example execution result: an attempt made to publish the mobile application, the result is displayed in the console window and the publishing parameters are loaded to the C:\Publicator.xml file.
Executing the example requires that the repository contains a mobile application with the MA_PUB identifier.
The example also uses the MobileAppCallback class described in the Fore Example for IMobileApplicationPublishCallBack.OnStartPublish.
Imports Prognoz.Platform.Interop.Mobile;
Imports Prognoz.Platform.Interop.MsXml2;
…
[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Mobile: IMobileApplication;
Publicator: IMobileApplicationPublicator;
callBack: MobileAppCallback;
res: MobilePublishResult;
XmlDoc: IXmlDomDocument3;
el: IXmlDomElement;
Begin
mb := Params.Metabase;
// Get the published mobile application (MA)
Mobile := mb.ItemById["MA_PUB"].Bind() As IMobileApplication;
// Create a mobile application publicator
Publicator := Mobile.CreatePublicator();
// Specify a Web server and a virtual directory for publishing the mobile application
Publicator.WebApplication := "http://prognoz/PPMobile_App_v7";
// If the mobile application is not published, start publishing
If Not (Publicator.IsPublished = MobilePublishResult.mprOk) Then
// Create a handler of events fired on publishing the mobile application
callBack := New MobileAppCallback.Create();
// Publish the mobile application
res := Publicator.Execute(callBack);
// Handle the results of publishing the mobile application
If res = MobilePublishResult.mprOk Then
System.Diagnostics.Debug.WriteLine("Publishing was successful").
Else
System.Diagnostics.Debug.WriteLine("Error occurred during publishing").
End If;
// Save parameters of publishing the mobile application to the XML file
XmlDoc := New DOMDocument60.Create();
el := XmlDoc.createElement("Root");
XmlDoc.appendChild(el);
Publicator.SaveToXml(el);
XmlDoc.save("C:\Publicator.xml");
End If;
End Sub;
Example execution result: an attempt made to publish the mobile application, the result is displayed in the console window and the publishing parameters are loaded to the C:\Publicator.xml file.
See also: