private void DeployManager_DownloadApplicationCompleted(object sender, DownloadApplicationCompletedEventArgs e) { try { if (e.Error != null) { ((System.Deployment.Application.InPlaceHostingManager)sender).CancelAsync(); this.LastError = e.Error; } else { if (this.Manifest != null) { this.Manifest.LogFilePath = e.LogFilePath; } } _appId = e.ShortcutAppId; } catch (Exception ex) { ((System.Deployment.Application.InPlaceHostingManager)sender).CancelAsync(); this.LastError = (ex.InnerException == null) ? ex : ex.InnerException; } finally { this.DeploymentManager.DownloadApplicationCompleted -= DeployManager_DownloadApplicationCompleted; _appDownloadedSignal.Set(); } }
/* * //<SNIPPET5> * 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; * } * //</SNIPPET5> */ //</SNIPPET3> //<SNIPPET7> 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."); }
private static void OnDownloadApplicationCompleted(object sender, DownloadApplicationCompletedEventArgs args) { // Console.WriteLine("OnDownloadApplicationCompleted called"); _event.Set(); }