private void OnSynchronizeCompleted(object sender, SynchronizeCompletedEventArgs e)
 {
     lock (this._lock)
     {
         try
         {
             this.AssertState(State.DownloadingApplication, State.VerifyRequirementsSucceeded, State.Done);
             if (this._state != State.Done)
             {
                 if (e.Cancelled || (e.Error != null))
                 {
                     this.ChangeState(State.Done);
                 }
                 else
                 {
                     this.ChangeState(State.DownloadApplicationSucceeded, e);
                 }
             }
             if ((!this._isLaunchInHostProcess || (this._appType == AppType.CustomHostSpecified)) && (this._appType != AppType.CustomUX))
             {
                 this.ChangeState(State.Done);
             }
             if (this.DownloadApplicationCompleted != null)
             {
                 DownloadApplicationCompletedEventArgs args = new DownloadApplicationCompletedEventArgs(e, this._deploymentManager.LogFilePath, this._deploymentManager.ShortcutAppId);
                 this.DownloadApplicationCompleted(this, args);
             }
         }
         catch (Exception exception)
         {
             Logger.AddInternalState(this._log, "Exception thrown:" + exception.GetType().ToString() + " : " + exception.Message);
             throw;
         }
     }
 }
Пример #2
0
        /*
        private bool CheckForFullTrust(XmlReader appManifest)
        {
            if (appManifest == null)
            {
                throw (new ArgumentNullException("appManifest cannot be null."));
            }

            XAttribute xaUnrestricted =
                XDocument.Load(appManifest)
                    .Element("{urn:schemas-microsoft-com:asm.v1}assembly")
                    .Element("{urn:schemas-microsoft-com:asm.v2}trustInfo")
                    .Element("{urn:schemas-microsoft-com:asm.v2}security")
                    .Element("{urn:schemas-microsoft-com:asm.v2}applicationRequestMinimum")
                    .Element("{urn:schemas-microsoft-com:asm.v2}PermissionSet")
                    .Attribute("Unrestricted"); // Attributes never have a namespace

            if (xaUnrestricted != null)
                if (xaUnrestricted.Value == "true")
                    return true;

            return false;
        }
        */
        void iphm_DownloadApplicationCompleted(object sender, DownloadApplicationCompletedEventArgs e)
        {
            // Check for an error.
            if (e.Error != null)
            {
                // Cancel download and install.
                MessageBox.Show("Could not download and install application. Error: " + e.Error.Message);
                return;
            }

            // Inform the user that their application is ready for use.
            MessageBox.Show("Application installed! You may now run it from the Start menu.");
        }
Пример #3
0
 private static void OnDownloadApplicationCompleted(object sender, DownloadApplicationCompletedEventArgs args)
 {
     // Console.WriteLine("OnDownloadApplicationCompleted called");
     _event.Set();
 }
Пример #4
0
        void DownloadApplicationCompleted(object sender, DownloadApplicationCompletedEventArgs e)
        {
            _hostingManager.DownloadProgressChanged -= new EventHandler<DownloadProgressChangedEventArgs>(DownloadProgressChanged);

            // UPDATE: The explanation below is from the time when IPHM was created on the GUI (main) thread.
            // Now BeginInvoke() is needed merely to switch to that thread from whatever worker thread IPHM is 
            // raising this event on.
            // 
            // Using BeginInvoke() to avoid a deadlock. InPlaceHostingManager allows only one thread to run
            // any one of its methods at a time. The DownloadApplicationCompleted event is raised on the main
            // thread but under IPHM's internal lock. Our handler (DoDownloadApplicationCompleted) needs to
            // synchronize with the thread that calls IPHM.AssertApplicationRequirements(). That thread may
            // be trying to call AAR(), which needs to take IPHM's internal lock. But it's already taken by the
            // code that raises the DownloadApplicationCompleted event, and in our handler we wait on AAR() to
            // complete. => deadlock
            //
            Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback(DoDownloadApplicationCompleted), e);
        }
 private void OnSynchronizeCompleted(object sender, SynchronizeCompletedEventArgs e)
 {
     lock (this._lock)
     {
         try
         {
             this.AssertState(State.DownloadingApplication, State.VerifyRequirementsSucceeded, State.Done);
             if (this._state != State.Done)
             {
                 if (e.Cancelled || (e.Error != null))
                 {
                     this.ChangeState(State.Done);
                 }
                 else
                 {
                     this.ChangeState(State.DownloadApplicationSucceeded, e);
                 }
             }
             if ((!this._isLaunchInHostProcess || (this._appType == AppType.CustomHostSpecified)) && (this._appType != AppType.CustomUX))
             {
                 this.ChangeState(State.Done);
             }
             if (this.DownloadApplicationCompleted != null)
             {
                 DownloadApplicationCompletedEventArgs args = new DownloadApplicationCompletedEventArgs(e, this._deploymentManager.LogFilePath, this._deploymentManager.ShortcutAppId);
                 this.DownloadApplicationCompleted(this, args);
             }
         }
         catch (Exception exception)
         {
             Logger.AddInternalState(this._log, "Exception thrown:" + exception.GetType().ToString() + " : " + exception.Message);
             throw;
         }
     }
 }