Share via


InPlaceHostingManager Constructors

Definition

Creates a new instance of InPlaceHostingManager to download and install the specified application.

Overloads

InPlaceHostingManager(Uri)

Creates a new instance of InPlaceHostingManager to download and install the specified browser-hosted application.

InPlaceHostingManager(Uri, Boolean)

Creates a new instance of InPlaceHostingManager to download and install the specified application, which can be either a stand-alone Windows Forms-based application or an application hosted in a Web browser.

InPlaceHostingManager(Uri)

Creates a new instance of InPlaceHostingManager to download and install the specified browser-hosted application.

public:
 InPlaceHostingManager(Uri ^ deploymentManifest);
public InPlaceHostingManager (Uri deploymentManifest);
new System.Deployment.Application.InPlaceHostingManager : Uri -> System.Deployment.Application.InPlaceHostingManager
Public Sub New (deploymentManifest As Uri)

Parameters

deploymentManifest
Uri

A Uniform Resource Identifier (Uri) to a ClickOnce application's deployment manifest.

Exceptions

InPlaceHostingManager can be used only in Windows XP or in later versions of the Windows operating system.

Cannot pass null for the deploymentManifest argument.

deploymentManifest uses a URI scheme that is not supported by ClickOnce.

Remarks

This constructor is used when you want to download a Windows Presentation Foundation-based application that is hosted in a Web browser. To download Windows Forms-based applications that are deployed using ClickOnce, use the InPlaceHostingManager constructor with the launchInHostProcess parameter set to false.

Applies to

InPlaceHostingManager(Uri, Boolean)

Creates a new instance of InPlaceHostingManager to download and install the specified application, which can be either a stand-alone Windows Forms-based application or an application hosted in a Web browser.

public:
 InPlaceHostingManager(Uri ^ deploymentManifest, bool launchInHostProcess);
public InPlaceHostingManager (Uri deploymentManifest, bool launchInHostProcess);
new System.Deployment.Application.InPlaceHostingManager : Uri * bool -> System.Deployment.Application.InPlaceHostingManager
Public Sub New (deploymentManifest As Uri, launchInHostProcess As Boolean)

Parameters

deploymentManifest
Uri

The Uniform Resource Identifier (URI) to the deployment manifest of the application that will be installed.

launchInHostProcess
Boolean

Whether this application will be run in a host, such as a Web browser. For a stand-alone application, set this value to false.

Exceptions

InPlaceHostingManager can be used only in Windows XP or in later versions of the Windows operating system.

Cannot pass null for the deploymentManifest argument.

deploymentManifest uses a URI scheme that is not supported by ClickOnce.

Examples

The following code example demonstrates how to create an instance of InPlaceHostingManager that allows you to download Windows Forms-based applications deployed using ClickOnce.

InPlaceHostingManager iphm = null;

public void InstallApplication(string deployManifestUriStr)
{
    try
    {
        Uri deploymentUri = new Uri(deployManifestUriStr);
        iphm = new InPlaceHostingManager(deploymentUri, false);
    }
    catch (UriFormatException uriEx)
    {
        MessageBox.Show("Cannot install the application: " + 
            "The deployment manifest URL supplied is not a valid URL. " +
            "Error: " + uriEx.Message);
        return;
    }
    catch (PlatformNotSupportedException platformEx)
    {
        MessageBox.Show("Cannot install the application: " + 
            "This program requires Windows XP or higher. " +
            "Error: " + platformEx.Message);
        return;
    }
    catch (ArgumentException argumentEx)
    {
        MessageBox.Show("Cannot install the application: " + 
            "The deployment manifest URL supplied is not a valid URL. " +
            "Error: " + argumentEx.Message);
        return;
    }

    iphm.GetManifestCompleted += new EventHandler<GetManifestCompletedEventArgs>(iphm_GetManifestCompleted);
    iphm.GetManifestAsync();
}
Dim WithEvents iphm As InPlaceHostingManager = Nothing

Public Sub InstallApplication(ByVal deployManifestUriStr As String)
    Try
        Dim deploymentUri As New Uri(deployManifestUriStr)
        iphm = New InPlaceHostingManager(deploymentUri, False)
        MessageBox.Show("Created the object.")
    Catch uriEx As UriFormatException
        MessageBox.Show("Cannot install the application: " & _
                        "The deployment manifest URL supplied is not a valid URL." & _
                        "Error: " & uriEx.Message)
        Return
    Catch platformEx As PlatformNotSupportedException
        MessageBox.Show("Cannot install the application: " & _
                        "This program requires Windows XP or higher. " & _
                        "Error: " & platformEx.Message)
        Return
    Catch argumentEx As ArgumentException
        MessageBox.Show("Cannot install the application: " & _
                        "The deployment manifest URL supplied is not a valid URL." & _
                        "Error: " & argumentEx.Message)
        Return
    End Try

    iphm.GetManifestAsync()
End Sub

Applies to