IMobileApplication.CreatePublicator

Fore Syntax

CreatePublicator: IMobileApplicationPublicator;

Fore.NET Syntax

CreatePublicator: Prognoz.Platform.Interop.Mobile.IMobileApplicationPublicator;

Description

The CreatePublicator method creates an object that publishes a mobile application.

Comments

To publish, use the IMobileApplicationPublicator.Execute method.

Fore Example

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 published mobile application (MA)
    Mobile := mb.ItemById("MA_PUB").Bind As IMobileApplication;
    // Create a mobile application publisher 
    Publicator := Mobile.CreatePublicator;
    // Specify web server and virtual directory for publishing mobile application
    Publicator.WebApplication := "http://prognoz/PPMobile_App_v7";
    // If mobile application is not published, start publishing  
    If Not (Publicator.IsPublished = MobilePublishResult.Ok) Then
        // Create a handler of events occurring on mobile application publication
        callBack := New MobileAppCallback.Create;
        // Start publishing mobile application
        res := Publicator.Execute(callBack);
        // Handle results of mobile application publication
        If res = MobilePublishResult.Ok Then
            Debug.WriteLine("Publishing was successful").
        Else
            Debug.WriteLine("Error occurred during publishing");
        End If;
        // Save parameters of mobile application publishing to 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 publishing parameters are loaded to the C:\Publicator.xml file.

Fore.NET Example

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 published mobile application (MA)
    Mobile := mb.ItemById["MA_PUB"].Bind() As IMobileApplication;
    // Create a mobile application publisher 
    Publicator := Mobile.CreatePublicator();
    // Specify web server and virtual directory for publishing mobile application
    Publicator.WebApplication := "http://prognoz/PPMobile_App_v7";
    // If mobile application is not published, start publishing  
    If Not (Publicator.IsPublished = MobilePublishResult.mprOk) Then
        // Create a handler of events occurring on mobile application publication
        callBack := New MobileAppCallback.Create();
        // Publish mobile application
        res := Publicator.Execute(callBack);
        // Handle results of mobile application publication
        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 mobile application publication to 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 publishing parameters are loaded to the C:\Publicator.xml file.

See also:

IMobileApplication