public void RaiseCurrentDialogChanged(IManagedDialog newDialog) { if (OnCurrentDialogChanged != null) { OnCurrentDialogChanged(newDialog); } }
static void ManagedUIShell_OnCurrentDialogChanged(IManagedDialog obj) { if (obj.GetType() == Dialogs.Licence) { // Simulate analyzing the runtime conditions with the message box. // Make a decision to jump over the dialog in the sequence if (MessageBox.Show("Do you want to skip 'Licence Dialog'?", "Wix#", MessageBoxButtons.YesNo) == DialogResult.Yes) { obj.Shell.GoNext(); } } }
private static void ManagedUI_OnCurrentDialogChanged(IManagedDialog obj) { if (obj.GetType() == Dialogs.InstallScope) { //Somehow the layout if InstallScope is really different from the rest //This mess is an attempt to fix the mess temporarily obj._Control("tableLayoutPanel1").Size = new System.Drawing.Size(491, 43); obj._Control("back").SetBounds(222, 10, 77, 23); obj._Control("next").SetBounds(305, 10, 77, 23); obj._Control("cancel").SetBounds(402, 86, 77, 23); var upShift = (int)(obj._Control("next").Height * 2.3) - obj._Control("bottomPanel").Height; obj._Control("bottomPanel").Top -= upShift; obj._Control("bottomPanel").Height += upShift; obj._Control("middlePanel").Top = obj._Control("topBorder").Bottom + 5; obj._Control("middlePanel").Height = (obj._Control("bottomPanel").Top - 5) - obj._Control("middlePanel").Top; } else if (obj.GetType() == Dialogs.MaintenanceType) { obj._Control("change").Enabled = false; } }
/// <summary> /// Processes information and progress messages sent to the user interface. /// <para> This method directly mapped to the /// <see cref="T:Microsoft.Deployment.WindowsInstaller.IEmbeddedUI.ProcessMessage" />.</para> /// </summary> /// <param name="messageType">Type of the message.</param> /// <param name="messageRecord">The message record.</param> /// <param name="buttons">The buttons.</param> /// <param name="icon">The icon.</param> /// <param name="defaultButton">The default button.</param> /// <returns></returns> public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { var result = MessageResult.OK; try { UACRevealer.Exit(); this.progressCounter.ProcessMessage(messageType, messageRecord); OnProgress((int)Math.Round(100 * this.progressCounter.Progress)); switch (messageType) { case InstallMessage.Progress: break; case InstallMessage.Error: case InstallMessage.Warning: case InstallMessage.User: case InstallMessage.Info: default: { if (messageType.IsOneOf(InstallMessage.Error, InstallMessage.Warning, InstallMessage.User)) { InUIThread(() => { if (MessageDialog == null) { MessageDialog = new DefaultErrorDialog(this); } result = MessageDialog.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton); }); return(result); } if (messageType == InstallMessage.Info) { string msg_data = messageRecord.ToString(); if (msg_data.Contains("User canceled installation") || msg_data.Contains("User cancelled installation")) //there is no other way { UserInterrupted = true; } } if (messageType == InstallMessage.Error) { ErrorDetected = true; Errors.Add(messageRecord.ToString()); } if (messageType == InstallMessage.InstallEnd) { try { string lastValue = messageRecord[messageRecord.FieldCount].ToString(); //MSI record is actually 1-based ErrorDetected = (lastValue == "3"); UserInterrupted = (lastValue == "2"); } catch { } //nothing we can do really finished = true; } this.LogMessage("{0}: {1}", messageType, messageRecord); break; } } if (this.canceled) { return(MessageResult.Cancel); } } catch (Exception ex) { this.LogMessage(ex.ToString()); this.LogMessage(ex.StackTrace); } InUIThread(() => { if (CurrentDialog != null) { result = CurrentDialog.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton); } }); return(result); }
/// <summary> /// MsiRuntime object associated with the ManagedUI dialog. /// </summary> /// <param name="dialog">The dialog.</param> /// <returns></returns> public static MsiRuntime MsiRuntime(this IManagedDialog dialog) { return(dialog.Shell.RuntimeContext as MsiRuntime); }
/// <summary> /// Session object associated with the ManagedUI dialog. /// </summary> /// <param name="dialog">The dialog.</param> /// <returns></returns> public static Session Session(this IManagedDialog dialog) { return(dialog.Shell.MsiRuntime().MsiSession); }
static Control _Control(this IManagedDialog obj, string name) => (obj as ManagedForm).Controls.Find(name, true)[0];