Пример #1
0
 private void OnBindCompleted(object sender, BindCompletedEventArgs e)
 {
     lock (this._lock)
     {
         GetManifestCompletedEventArgs local_2_1;
         try
         {
             this.AssertState(InPlaceHostingManager.State.GettingManifest, InPlaceHostingManager.State.Done);
             if (this._state != InPlaceHostingManager.State.Done)
             {
                 if (e.Cancelled || e.Error != null)
                 {
                     this.ChangeState(InPlaceHostingManager.State.Done);
                 }
                 else
                 {
                     this.ChangeState(InPlaceHostingManager.State.GetManifestSucceeded, (AsyncCompletedEventArgs)e);
                 }
             }
             // ISSUE: reference to a compiler-generated field
             if (this.GetManifestCompleted == null)
             {
                 return;
             }
             if (e.Error != null || e.Cancelled)
             {
                 if (e.Cancelled)
                 {
                     Logger.AddInternalState(this._log, "GetManifestAsync call cancelled.");
                 }
                 local_2_1 = new GetManifestCompletedEventArgs(e, this._deploymentManager.LogFilePath);
             }
             else
             {
                 this._isCached = e.IsCached;
                 bool local_3 = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.Install;
                 bool local_4 = this._deploymentManager.ActivationDescription.AppManifest.EntryPoints[0].HostInBrowser;
                 this._appType = this._deploymentManager.ActivationDescription.appType;
                 bool local_5 = this._deploymentManager.ActivationDescription.AppManifest.UseManifestForTrust;
                 Uri  local_6 = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.ProviderCodebaseUri;
                 local_2_1 = !this._isLaunchInHostProcess || this._appType == AppType.CustomHostSpecified || local_4 ? (!local_3 || !this._isLaunchInHostProcess && this._appType != AppType.CustomHostSpecified ? (!local_5 || this._appType != AppType.CustomHostSpecified ? (!(local_6 != (Uri)null) || this._appType != AppType.CustomHostSpecified ? (!local_4 || this._appType != AppType.CustomUX ? new GetManifestCompletedEventArgs(e, this._deploymentManager.ActivationDescription, this._deploymentManager.LogFilePath, this._log) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_CannotHaveCustomUXFlag")), this._deploymentManager.LogFilePath)) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_CannotHaveDeploymentProvider")), this._deploymentManager.LogFilePath)) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_CannotHaveUseManifestForTrustFlag")), this._deploymentManager.LogFilePath)) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_InstallFlagMustBeFalse")), this._deploymentManager.LogFilePath)) : new GetManifestCompletedEventArgs(e, (Exception) new InvalidOperationException(Resources.GetString("Ex_HostInBrowserFlagMustBeTrue")), this._deploymentManager.LogFilePath);
                 if (local_2_1.Error != null)
                 {
                     Logger.AddInternalState(this._log, "Exception thrown after binding: " + local_2_1.Error.GetType().ToString() + " : " + local_2_1.Error.Message + "\r\n" + local_2_1.Error.StackTrace);
                 }
             }
         }
         catch (Exception exception_0)
         {
             Logger.AddInternalState(this._log, "Exception thrown:" + exception_0.GetType().ToString() + " : " + exception_0.Message);
             this.ChangeState(InPlaceHostingManager.State.Done);
             throw;
         }
         // ISSUE: reference to a compiler-generated field
         this.GetManifestCompleted((object)this, local_2_1);
     }
 }
Пример #2
0
 public ApplicationManifest(GetManifestCompletedEventArgs args)
 {
     _identity             = args.ApplicationIdentity;
     _manifest             = XDocument.Load(args.ApplicationManifest);
     _deploymentManifest   = XDocument.Load(args.DeploymentManifest);
     _isCached             = args.IsCached;
     _logFilePath          = args.LogFilePath;
     _productName          = args.ProductName;
     _subscriptionIdentity = args.SubscriptionIdentity;
     _version = args.Version;
 }
Пример #3
0
 private static void OnGetManifestCompleted(object sender, GetManifestCompletedEventArgs args)
 {
     // Console.WriteLine("OnGetManifestCompleted called");
     _event.Set();
 }
Пример #4
0
 void GetManifestCompleted(object sender, GetManifestCompletedEventArgs e)
 {
     // Continue through a Background priority work item to ensure that the progress page has loaded--
     // we need at least the javascript functions to be available to call. Trident uses a sequence of 
     // message-based callbacks to do its work. Once we ensure the first callback is enqueued before 
     // the main thread starts pumping messages again, the sequence will complete before the Background
     // priority operation is dispatched. DoDownloadUI() is called right after DoGetManifestAsync(), so
     // the HTML loading will start before we return to the message loop.
     Dispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(DoGetManifestCompleted), e);
 }
        void iphm_GetManifestCompleted(object sender, GetManifestCompletedEventArgs e)
        {
            // Check for an error. 
            if (e.Error != null)
            {
                // Cancel download and install.
                MessageBox.Show("Could not download manifest. Error: " + e.Error.Message);
                return;
            }

            // bool isFullTrust = CheckForFullTrust(e.ApplicationManifest); 

            // Verify this application can be installed. 
            try
            {
                // the true parameter allows InPlaceHostingManager 
                // to grant the permissions requested in the applicaiton manifest.
                iphm.AssertApplicationRequirements(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred while verifying the application. " +
                    "Error: " + ex.Message);
                return;
            }

            // Use the information from GetManifestCompleted() to confirm  
            // that the user wants to proceed. 
            string appInfo = "Application Name: " + e.ProductName;
            appInfo += "\nVersion: " + e.Version;
            appInfo += "\nSupport/Help Requests: " + (e.SupportUri != null ?
                e.SupportUri.ToString() : "N/A");
            appInfo += "\n\nConfirmed that this application can run with its requested permissions.";
            // if (isFullTrust) 
            // appInfo += "\n\nThis application requires full trust in order to run.";
            appInfo += "\n\nProceed with installation?";

            DialogResult dr = MessageBox.Show(appInfo, "Confirm Application Install",
                MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (dr != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            // Download the deployment manifest. 
            iphm.DownloadProgressChanged += new EventHandler<DownloadProgressChangedEventArgs>(iphm_DownloadProgressChanged);
            iphm.DownloadApplicationCompleted += new EventHandler<DownloadApplicationCompletedEventArgs>(iphm_DownloadApplicationCompleted);

            try
            {
                // Usually this shouldn't throw an exception unless AssertApplicationRequirements() failed,  
                // or you did not call that method before calling this one.
                iphm.DownloadApplicationAsync();
            }
            catch (Exception downloadEx)
            {
                MessageBox.Show("Cannot initiate download of application. Error: " +
                    downloadEx.Message);
                return;
            }
        }
 private void OnBindCompleted(object sender, BindCompletedEventArgs e)
 {
     lock (this._lock)
     {
         GetManifestCompletedEventArgs args = null;
         try
         {
             this.AssertState(State.GettingManifest, State.Done);
             if (this._state != State.Done)
             {
                 if (e.Cancelled || (e.Error != null))
                 {
                     this.ChangeState(State.Done);
                 }
                 else
                 {
                     this.ChangeState(State.GetManifestSucceeded, e);
                 }
             }
             if (this.GetManifestCompleted == null)
             {
                 goto Label_0311;
             }
             if ((e.Error != null) || e.Cancelled)
             {
                 if (e.Cancelled)
                 {
                     Logger.AddInternalState(this._log, "GetManifestAsync call cancelled.");
                 }
                 args = new GetManifestCompletedEventArgs(e, this._deploymentManager.LogFilePath);
             }
             else
             {
                 this._isCached = e.IsCached;
                 bool install = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.Install;
                 bool hostInBrowser = this._deploymentManager.ActivationDescription.AppManifest.EntryPoints[0].HostInBrowser;
                 this._appType = this._deploymentManager.ActivationDescription.appType;
                 bool useManifestForTrust = this._deploymentManager.ActivationDescription.AppManifest.UseManifestForTrust;
                 Uri providerCodebaseUri = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.ProviderCodebaseUri;
                 if ((this._isLaunchInHostProcess && (this._appType != AppType.CustomHostSpecified)) && !hostInBrowser)
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_HostInBrowserFlagMustBeTrue")), this._deploymentManager.LogFilePath);
                 }
                 else if (install && (this._isLaunchInHostProcess || (this._appType == AppType.CustomHostSpecified)))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_InstallFlagMustBeFalse")), this._deploymentManager.LogFilePath);
                 }
                 else if (useManifestForTrust && (this._appType == AppType.CustomHostSpecified))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveUseManifestForTrustFlag")), this._deploymentManager.LogFilePath);
                 }
                 else if ((providerCodebaseUri != null) && (this._appType == AppType.CustomHostSpecified))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveDeploymentProvider")), this._deploymentManager.LogFilePath);
                 }
                 else if (hostInBrowser && (this._appType == AppType.CustomUX))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveCustomUXFlag")), this._deploymentManager.LogFilePath);
                 }
                 else
                 {
                     args = new GetManifestCompletedEventArgs(e, this._deploymentManager.ActivationDescription, this._deploymentManager.LogFilePath, this._log);
                 }
                 if (args.Error != null)
                 {
                     Logger.AddInternalState(this._log, "Exception thrown after binding: " + args.Error.GetType().ToString() + " : " + args.Error.Message + "\r\n" + args.Error.StackTrace);
                 }
             }
         }
         catch (Exception exception)
         {
             Logger.AddInternalState(this._log, "Exception thrown:" + exception.GetType().ToString() + " : " + exception.Message);
             this.ChangeState(State.Done);
             throw;
         }
         this.GetManifestCompleted(this, args);
     Label_0311:;
     }
 }
 private void OnBindCompleted(object sender, BindCompletedEventArgs e)
 {
     lock (this._lock)
     {
         GetManifestCompletedEventArgs args = null;
         try
         {
             this.AssertState(State.GettingManifest, State.Done);
             if (this._state != State.Done)
             {
                 if (e.Cancelled || (e.Error != null))
                 {
                     this.ChangeState(State.Done);
                 }
                 else
                 {
                     this.ChangeState(State.GetManifestSucceeded, e);
                 }
             }
             if (this.GetManifestCompleted == null)
             {
                 goto Label_0311;
             }
             if ((e.Error != null) || e.Cancelled)
             {
                 if (e.Cancelled)
                 {
                     Logger.AddInternalState(this._log, "GetManifestAsync call cancelled.");
                 }
                 args = new GetManifestCompletedEventArgs(e, this._deploymentManager.LogFilePath);
             }
             else
             {
                 this._isCached = e.IsCached;
                 bool install       = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.Install;
                 bool hostInBrowser = this._deploymentManager.ActivationDescription.AppManifest.EntryPoints[0].HostInBrowser;
                 this._appType = this._deploymentManager.ActivationDescription.appType;
                 bool useManifestForTrust = this._deploymentManager.ActivationDescription.AppManifest.UseManifestForTrust;
                 Uri  providerCodebaseUri = this._deploymentManager.ActivationDescription.DeployManifest.Deployment.ProviderCodebaseUri;
                 if ((this._isLaunchInHostProcess && (this._appType != AppType.CustomHostSpecified)) && !hostInBrowser)
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_HostInBrowserFlagMustBeTrue")), this._deploymentManager.LogFilePath);
                 }
                 else if (install && (this._isLaunchInHostProcess || (this._appType == AppType.CustomHostSpecified)))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_InstallFlagMustBeFalse")), this._deploymentManager.LogFilePath);
                 }
                 else if (useManifestForTrust && (this._appType == AppType.CustomHostSpecified))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveUseManifestForTrustFlag")), this._deploymentManager.LogFilePath);
                 }
                 else if ((providerCodebaseUri != null) && (this._appType == AppType.CustomHostSpecified))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveDeploymentProvider")), this._deploymentManager.LogFilePath);
                 }
                 else if (hostInBrowser && (this._appType == AppType.CustomUX))
                 {
                     args = new GetManifestCompletedEventArgs(e, new InvalidOperationException(Resources.GetString("Ex_CannotHaveCustomUXFlag")), this._deploymentManager.LogFilePath);
                 }
                 else
                 {
                     args = new GetManifestCompletedEventArgs(e, this._deploymentManager.ActivationDescription, this._deploymentManager.LogFilePath, this._log);
                 }
                 if (args.Error != null)
                 {
                     Logger.AddInternalState(this._log, "Exception thrown after binding: " + args.Error.GetType().ToString() + " : " + args.Error.Message + "\r\n" + args.Error.StackTrace);
                 }
             }
         }
         catch (Exception exception)
         {
             Logger.AddInternalState(this._log, "Exception thrown:" + exception.GetType().ToString() + " : " + exception.Message);
             this.ChangeState(State.Done);
             throw;
         }
         this.GetManifestCompleted(this, args);
         Label_0311 :;
     }
 }