/// <summary> /// Shows the modal window of the MSI UI. This method is called by the <see cref="T:Microsoft.Deployment.WindowsInstaller.IEmbeddedUI" /> /// when it is initialized at runtime. /// </summary> /// <param name="msiRuntime">The MSI runtime.</param> /// <param name="ui">The MSI external/embedded UI.</param> public void ShowModal(MsiRuntime msiRuntime, IManagedUI ui) { //Debug.Assert(false); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); UI = ui; MsiRuntime = msiRuntime; ActionResult result = ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UIInitialized"); MsiRuntime.Data.MergeReplace(MsiRuntime.Session["WIXSHARP_RUNTIME_DATA"]); //data may be changed in the client handler if (result == ActionResult.Success) { if (MsiRuntime.Session.IsInstalling()) { Dialogs = ui.InstallDialogs; } else if (MsiRuntime.Session.IsRepairing()) { Dialogs = ui.ModifyDialogs; } if (Dialogs.Any()) { shellView = new ShellView(); shellView.Load += (s, e) => { MsiRuntime.Session["WIXSHARP_MANAGED_UI_HANDLE"] = MsiRuntime.Data["WIXSHARP_MANAGED_UI_HANDLE"] = shellView.Handle.ToString(); try { var data = MsiRuntime.Session.GetEmbeddedData("ui_shell_icon"); using (var stream = new System.IO.MemoryStream(data)) shellView.Icon = new Icon(stream); } catch { } ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UILoaded", (IShellView)shellView); MsiRuntime.Data.MergeReplace(MsiRuntime.Session["WIXSHARP_RUNTIME_DATA"]);; //data may be changed in the client handler }; GoNext(); shellView.ShowDialog(); } else { this.StartExecute(); while (!finished) { Thread.Sleep(1000); } } } else { MsiRuntime.Session.Log("UIInitialized returned " + result); } }
/// <summary> /// Starts the execution of the MSI installation. /// </summary> public void StartExecute() { //Debug.Assert(false); started = true; if (!IsDemoMode) { MsiRuntime.StartExecute(); } }
/// <summary> /// Called when MSI execute started. /// </summary> public void OnExecuteStarted() { //Debugger.Break(); MsiRuntime.FetchInstallDir(); //user may have updated it if (CurrentDialog != null) { InUIThread(CurrentDialog.OnExecuteStarted); } }
/// <summary> /// Starts the execution of the MSI installation. /// </summary> public void StartExecute() { //Debug.Assert(false); started = true; if (!IsDemoMode) { UACRevealer.Enter(); MsiRuntime.StartExecute(); } }
/// <summary> /// Shows the modal window of the MSI UI. This method is called by the <see cref="T:Microsoft.Deployment.WindowsInstaller.IEmbeddedUI" /> /// when it is initialized at runtime. /// </summary> /// <param name="msiRuntime">The MSI runtime.</param> /// <param name="ui">The MSI external/embedded UI.</param> public void ShowModal(MsiRuntime msiRuntime, IManagedUI ui) { //Debug.Assert(false); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); UI = ui; MsiRuntime = msiRuntime; ActionResult result = ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UIInitialized"); if (result == ActionResult.Success) { if (MsiRuntime.Session.IsInstalling()) { Dialogs = ui.InstallDialogs; } else if (MsiRuntime.Session.IsRepairing()) { Dialogs = ui.ModifyDialogs; } if (Dialogs.Any()) { shellView = new ShellView(); shellView.Load += (s, e) => { ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UILoaded", (IShellView)shellView); }; GoNext(); shellView.ShowDialog(); } else { this.StartExecute(); while (!finished) { Thread.Sleep(1000); } } } else { MsiRuntime.Session.Log("UIInitialized returned " + result); } }
void DemoPlay(ManagedDialogs dialogs) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); IsDemoMode = true; var resourcesMsi = BuildUiPlayerResources(); var dummySession = Installer.OpenPackage(resourcesMsi, true); MsiRuntime = new MsiRuntime(dummySession); Dialogs = dialogs; shellView = new ShellView(); GoNext(); shellView.ShowDialog(); }
void DemoPlay(ManagedDialogs dialogs, string demoProperties = "") { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); IsDemoMode = true; var resourcesMsi = BuildUiPlayerResources(); var dummySession = Installer.OpenPackage(resourcesMsi, true); foreach (var pair in demoProperties.ToDictionary()) { dummySession[pair.Key] = pair.Value; } Runtime = new MsiRuntime(dummySession); Dialogs = dialogs; shellView = new ShellView(); GoNext(); shellView.ShowDialog(); }
/// <summary> /// Shows the modal window of the MSI UI. This method is called by the <see cref="T:Microsoft.Deployment.WindowsInstaller.IEmbeddedUI" /> /// when it is initialized at runtime. /// </summary> /// <param name="msiRuntime">The MSI runtime.</param> /// <param name="ui">The MSI external/embedded UI.</param> public void ShowModal(MsiRuntime msiRuntime, IManagedUI ui) { // Debug.Assert(false); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); UI = ui; MsiRuntime = msiRuntime; Tasks.UILocalize = text => text.LocalizeWith(msiRuntime.Localize); UACRevealer.Enabled = !MsiRuntime.Session.Property("UAC_REVEALER_ENABLED").IsEmpty(); if (MsiRuntime.Session.IsInstalling()) { Dialogs = ui.InstallDialogs; } else if (MsiRuntime.Session.IsRepairing()) { Dialogs = ui.ModifyDialogs; } if (Dialogs.Any()) { shellView = new ShellView { Shell = this } } ; try { int culture = msiRuntime.Session.Property("ProductLanguage").ToInt(); if (culture != 0) { Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture); } } catch { } ActionResult result = ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UIInitialized", shellView as IShellView); MsiRuntime.Data.MergeReplace(MsiRuntime.Session["WIXSHARP_RUNTIME_DATA"]); //data may be changed in the client handler if (result != ActionResult.Failure) { if (shellView != null) { shellView.Load += (s, e) => { MsiRuntime.Session["WIXSHARP_MANAGED_UI_HANDLE"] = MsiRuntime.Data["WIXSHARP_MANAGED_UI_HANDLE"] = shellView.Handle.ToString(); try { var data = MsiRuntime.Session.GetEmbeddedData("ui_shell_icon"); using (var stream = new System.IO.MemoryStream(data)) shellView.Icon = new Icon(stream); } catch { } result = ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UILoaded", (IShellView)shellView); if (result != ActionResult.Success) { // aborting UI dialogs sequence from here is not possible as this event is // simply called when Shell is loaded but not when dialogs are progressing in the sequence. MsiRuntime.Session.Log("UILoaded returned " + result); } MsiRuntime.Data.MergeReplace(MsiRuntime.Session["WIXSHARP_RUNTIME_DATA"]);; //data may be changed in the client handler }; if (result == ActionResult.SkipRemainingActions) { result = ActionResult.Success; if (Dialogs.Contains(typeof(UI.Forms.ProgressDialog))) { GoTo <UI.Forms.ProgressDialog>(); } else { GoToLast(); } } else if (result == ActionResult.UserExit) { GoToLast(); } else { GoNext(); } shellView.ShowDialog(); } else { this.StartExecute(); while (!finished) { Thread.Sleep(1000); } } } else { MsiRuntime.Session.Log("UIInitialized returned " + result); } }
/// <summary> /// Starts the execution of the MSI installation. /// </summary> public void StartExecute() { started = true; MsiRuntime.StartExecute(); }