public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { try { this.progressCounter.ProcessMessage(messageType, messageRecord); this.progressBar.Value = (int)(this.progressBar.Minimum + this.progressCounter.Progress * (this.progressBar.Maximum - this.progressBar.Minimum)); this.progressLabel.Text = "" + (int)Math.Round(100 * this.progressCounter.Progress) + "%"; switch (messageType) { case InstallMessage.Error: case InstallMessage.Warning: case InstallMessage.Info: string message = String.Format("{0}: {1}", messageType, messageRecord); this.LogMessage(message); break; } if (this.canceled) { this.canceled = false; return MessageResult.Cancel; } } catch (Exception ex) { this.LogMessage(ex.ToString()); this.LogMessage(ex.StackTrace); } Application.DoEvents(); return MessageResult.OK; }
public static MessageResult ExternalUILogger( InstallMessage messageType, string message, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { Console.WriteLine("{0}: {1}", messageType, message); return MessageResult.None; }
public static MessageResult ExternalUILogger( InstallMessage messageType, string message, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { Console.WriteLine("{0}: {1}", messageType, message); return(MessageResult.None); }
/// <summary> /// Handler for external UI messages. /// </summary> /// <param name="messageType">The type of message.</param> /// <param name="messageRecord">The message details.</param> /// <param name="buttons">Buttons to show (unused).</param> /// <param name="icon">The icon to show (unused).</param> /// <param name="defaultButton">The default button (unused).</param> /// <returns>How the message was handled.</returns> public MessageResult UIRecordHandler( InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { #if False Console.WriteLine("Message type {0}: {1}", messageType.ToString(), this.session.FormatRecord(messageRecord)); #endif if (!this.session.IsClosed && 1 <= messageRecord.FieldCount) { switch (messageType) { case InstallMessage.ActionStart: // only try to interpret the messages if they're coming from WixRunImmediateUnitTests string action = messageRecord.GetString(1); this.runningTests = Constants.LuxCustomActionName == action; return(MessageResult.OK); case InstallMessage.User: if (this.runningTests) { string message = messageRecord.ToString(); int id = messageRecord.GetInteger(1); if (Constants.TestIdMinimumSuccess <= id && Constants.TestIdMaximumSuccess >= id) { this.OnMessage(NitVerboses.TestPassed(message)); ++this.passes; } else if (Constants.TestIdMinimumFailure <= id && Constants.TestIdMaximumFailure >= id) { this.OnMessage(NitErrors.TestFailed(message)); ++this.failures; } } return(MessageResult.OK); case InstallMessage.Error: case InstallMessage.FatalExit: this.OnMessage(NitErrors.PackageFailed(this.session.FormatRecord(messageRecord))); return(MessageResult.Error); } } return(MessageResult.OK); }
/// <summary> /// Processes the message. /// </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 override MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { switch (messageType) { case InstallMessage.ActionStart: { try { //messageRecord[0] - is reserved for FormatString value string message = null; bool simple = true; if (simple) { for (int i = messageRecord.FieldCount - 1; i > 0; i--) { message = messageRecord[i].ToString(); } } else { message = messageRecord.FormatString; if (message.IsNotEmpty()) { for (int i = 1; i < messageRecord.FieldCount; i++) { message = message.Replace("[" + i + "]", messageRecord[i].ToString()); } } else { message = messageRecord[messageRecord.FieldCount - 1].ToString(); } } if (message.IsNotEmpty()) currentAction.Text = message; } catch { } } break; } return MessageResult.OK; }
// -------------------------------------------------- // Methods // -------------------------------------------------- public static MessageResult Show(String text, String caption = "", MessageButtons messageButtons = MessageButtons.Accept, MessageIcon messageIcon = MessageIcon.None, MessageDefaultButton messageDefaultButton = MessageDefaultButton.Button1) { MessageSceneController msc = new MessageSceneController( ResourceLoader.Load("res://Content/Scene/Message.tscn") as PackedScene, new MessageSettings { Text = text, Caption = caption, MessageButtons = messageButtons, MessageIcon = messageIcon, MessageDefaultButton = messageDefaultButton } ); msc.InitScene("root/Main"); Application.RunMessage(msc); return(msc.MessageResult); }
public override MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { switch (messageType) { case InstallMessage.ActionStart: { try { var message = messageRecord[messageRecord.FieldCount - 1].ToString(); if (message.IsNotEmpty()) currentAction.Text = message; } catch { } } break; } return MessageResult.OK; }
public static MessageResult ExternalUIRecordLogger( InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { if (messageRecord != null) { if (messageRecord.FormatString.Length == 0 && messageRecord.FieldCount > 0) { messageRecord.FormatString = "1: [1] 2: [2] 3: [3] 4: [4] 5: [5]"; } Console.WriteLine("{0}: {1}", messageType, messageRecord.ToString()); } else { Console.WriteLine("{0}: (null)", messageType); } return MessageResult.None; }
public static MessageResult ExternalUIRecordLogger( InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { if (messageRecord != null) { if (messageRecord.FormatString.Length == 0 && messageRecord.FieldCount > 0) { messageRecord.FormatString = "1: [1] 2: [2] 3: [3] 4: [4] 5: [5]"; } Console.WriteLine("{0}: {1}", messageType, messageRecord.ToString()); } else { Console.WriteLine("{0}: (null)", messageType); } return(MessageResult.None); }
/// <summary> /// silently handle the External UI for an MSI /// </summary> /// <param name="messageType"> Type of the message. </param> /// <param name="message"> The message. </param> /// <param name="buttons"> The buttons. </param> /// <param name="icon"> The icon. </param> /// <param name="defaultButton"> The default button. </param> /// <returns> </returns> /// <remarks> /// </remarks> public static MessageResult ExternalUI(InstallMessage messageType, string message, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { return(MessageResult.OK); }
public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { try { WixSharp.CommonTasks.UACRevealer.Exit(); progressCounter.ProcessMessage(messageType, messageRecord); progressBar.Value = progressBar.Minimum + progressCounter.Progress * (progressBar.Maximum - progressBar.Minimum); //this.progressLabel.Content = "" + (int)Math.Round(100 * this.progressCounter.Progress) + "%"; var message = string.Format("{0}: {1}", messageType, messageRecord); switch (messageType) { case InstallMessage.Error: case InstallMessage.Warning: LogMessage(message); break; case InstallMessage.Info: #if DEBUG LogMessage(message); #else if (messageRecord.ToString().Contains("INSTALL. Return value 1.")) { this.messagesTextBox.Text = $"winprint {productVersion} successfully installed."; } #endif break; } if (canceled) { canceled = false; return(MessageResult.Cancel); } } catch (Exception ex) { LogMessage(ex.ToString()); LogMessage(ex.StackTrace); } return(MessageResult.OK); }
public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { return((MessageResult)MessageBox.Show( _shell.shellView, messageRecord.ToString(), "[ErrorDlg_Title]".LocalizeWith(_shell.Runtime.Localize), (MessageBoxButtons)(int)buttons, (MessageBoxIcon)(int)icon, (MessageBoxDefaultButton)(int)defaultButton)); }
/// <summary> /// Handler for external UI messages. /// </summary> /// <param name="messageType">The type of message.</param> /// <param name="messageRecord">The message details.</param> /// <param name="buttons">Buttons to show (unused).</param> /// <param name="icon">The icon to show (unused).</param> /// <param name="defaultButton">The default button (unused).</param> /// <returns>How the message was handled.</returns> public MessageResult UIRecordHandler( InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { #if False Console.WriteLine("Message type {0}: {1}", messageType.ToString(), this.session.FormatRecord(messageRecord)); #endif if (!this.session.IsClosed && 1 <= messageRecord.FieldCount) { switch (messageType) { case InstallMessage.ActionStart: // only try to interpret the messages if they're coming from WixRunImmediateUnitTests string action = messageRecord.GetString(1); this.runningTests = Constants.LuxCustomActionName == action; return MessageResult.OK; case InstallMessage.User: if (this.runningTests) { string message = messageRecord.ToString(); int id = messageRecord.GetInteger(1); if (Constants.TestIdMinimumSuccess <= id && Constants.TestIdMaximumSuccess >= id) { this.OnMessage(NitVerboses.TestPassed(message)); ++this.passes; } else if (Constants.TestIdMinimumFailure <= id && Constants.TestIdMaximumFailure >= id) { this.OnMessage(NitErrors.TestFailed(message)); ++this.failures; } } return MessageResult.OK; case InstallMessage.Error: case InstallMessage.FatalExit: this.OnMessage(NitErrors.PackageFailed(this.session.FormatRecord(messageRecord))); return MessageResult.Error; } } return MessageResult.OK; }
/// <summary> /// Handles a message <see cref="Deployment.WindowsInstaller.Record"/> from Windows Installer. /// </summary> /// <param name="messageType">The <see cref="InstallMessage"/> type of the message.</param> /// <param name="messageRecord">The <see cref="Deployment.WindowsInstaller.Record"/> containing more information.</param> /// <param name="buttons">the <see cref="MessageButtons"/> to display.</param> /// <param name="icon">The <see cref="MessageIcon"/> to display.</param> /// <param name="defaultButton">The <see cref="MessageDefaultButton"/> to display.</param> /// <returns>The <see cref="MessageResult"/> that informs Windows Installer was action to take in response to the message.</returns> protected MessageResult OnMessage(InstallMessage messageType, Deployment.WindowsInstaller.Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { // Log all messages in debug mode. this.WriteMessage(messageType, messageRecord); switch (messageType) { case InstallMessage.Initialize: return(this.OnInitialize(messageRecord)); case InstallMessage.ActionStart: return(this.OnActionStart(messageRecord)); case InstallMessage.ActionData: return(this.OnActionData(messageRecord)); case InstallMessage.Error: case InstallMessage.FatalExit: case InstallMessage.OutOfDiskSpace: return(this.OnError(messageRecord)); case InstallMessage.Warning: return(this.OnWarning(messageRecord)); case InstallMessage.Info: case InstallMessage.User: return(this.OnVerbose(messageRecord)); case InstallMessage.Progress: return(this.OnProgress(messageRecord)); case InstallMessage.CommonData: return(this.OnCommonData(messageRecord)); } return(MessageResult.None); }
public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { try { this.progressCounter.ProcessMessage(messageType, messageRecord); this.progressBar.Value = this.progressBar.Minimum + this.progressCounter.Progress * (this.progressBar.Maximum - this.progressBar.Minimum); this.progressLabel.Content = "" + (int)Math.Round(100 * this.progressCounter.Progress) + "%"; switch (messageType) { case InstallMessage.Error: case InstallMessage.Warning: case InstallMessage.Info: string message = String.Format("{0}: {1}", messageType, messageRecord); this.LogMessage(message); break; } if (this.canceled) { this.canceled = false; return(MessageResult.Cancel); } } catch (Exception ex) { this.LogMessage(ex.ToString()); this.LogMessage(ex.StackTrace); } return(MessageResult.OK); }
public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { // skip showing any FilesInUse dialog, which is shown because the Windows service // is running and will be stopped/removed/started if (messageType == InstallMessage.RMFilesInUse || messageType == InstallMessage.FilesInUse) { return(MessageResult.OK); } object result = this._mainWindow.Dispatcher.Invoke( DispatcherPriority.Send, new Func <MessageResult>(() => this._mainWindow.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton))); return((MessageResult)result); }
/// <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 override MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) => model?.ProcessMessage(messageType, messageRecord, CurrentStatus.Text) ?? MessageResult.None;
/// <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> virtual public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { return(MessageResult.OK); }
private MessageResult OnMessage(InstallMessage messageType, Deployment.WindowsInstaller.Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { switch (messageType) { case InstallMessage.FatalExit: case InstallMessage.Error: return(this.OnError(messageRecord)); case InstallMessage.Warning: return(this.OnWarning(messageRecord)); case InstallMessage.User: return(this.OnInformation(messageRecord)); default: return(MessageResult.None); } }
public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { object result = this._mainWindow.Dispatcher.Invoke( DispatcherPriority.Send, new Func <MessageResult>(() => this._mainWindow.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton))); return((MessageResult)result); }
/// <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 virtual MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { return MessageResult.OK; }
/// <summary> /// Processes information and progress messages sent to the user interface. /// </summary> /// <param name="messageType">Message type.</param> /// <param name="messageRecord">Record that contains message data.</param> /// <param name="buttons">Message buttons.</param> /// <param name="icon">Message box icon.</param> /// <param name="defaultButton">Message box default button.</param> /// <returns> /// Result of processing the message. /// </returns> /// <remarks> /// <p> /// Win32 MSI API: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/embeddeduihandler.asp">EmbeddedUIHandler</a></p> /// </remarks> public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { return shell.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton); }
public static MessageResult ExternalUI(InstallMessage messageType, string message, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { return MessageResult.OK; }
MessageResult OnUIUpdate(InstallMessage messageType, string message, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { if (cancelled && installing) { installing = false; return(MessageResult.Cancel); } return(MessageResult.OK); }
/// <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) { try { this.progressCounter.ProcessMessage(messageType, messageRecord); if (currentDialog != null) { InUIThread(() => currentDialog.OnProgress((int)Math.Round(100 * this.progressCounter.Progress))); } switch (messageType) { case InstallMessage.Progress: break; case InstallMessage.Error: case InstallMessage.Warning: case InstallMessage.Info: default: { if (messageType == InstallMessage.Info) { if (messageRecord.ToString().Contains("User cancelled installation")) //there is no other way { UserInterrupted = true; } } if (messageType == InstallMessage.Error) { ErrorDetected = true; } 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); } var result = MessageResult.OK; InUIThread(() => { if (currentDialog != null) { result = currentDialog.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton); } }); return(result); }
public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { try { this.progressCounter.ProcessMessage(messageType, messageRecord); InUIThread(() => currentDialog.OnProgress((int)Math.Round(100 * this.progressCounter.Progress))); switch (messageType) { case InstallMessage.Progress: break; case InstallMessage.Error: case InstallMessage.Warning: case InstallMessage.Info: default: { if (messageType == InstallMessage.Error) ErrorDetected = true; 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 } this.LogMessage("{0}: {1}", messageType, messageRecord); break; } } if (this.canceled) { return MessageResult.Cancel; } } catch (Exception ex) { this.LogMessage(ex.ToString()); this.LogMessage(ex.StackTrace); } var result = MessageResult.OK; InUIThread(() => { result = currentDialog.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton); }); return result; }
/// <summary> /// Processes the message. /// </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 override MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { switch (messageType) { case InstallMessage.InstallStart: case InstallMessage.InstallEnd: { waitPrompt.Visible = false; showWaitPromptTimer.Stop(); } break; case InstallMessage.ActionStart: { try { //messageRecord[0] - is reserved for FormatString value string message = null; bool simple = true; if (simple) { /* * messageRecord[2] unconditionally contains the string to display * * Examples: * * messageRecord[0] "Action 23:14:50: [1]. [2]" * messageRecord[1] "InstallFiles" * messageRecord[2] "Copying new files" * messageRecord[3] "File: [1], Directory: [9], Size: [6]" * * messageRecord[0] "Action 23:15:21: [1]. [2]" * messageRecord[1] "RegisterUser" * messageRecord[2] "Registering user" * messageRecord[3] "[1]" * */ if (messageRecord.FieldCount >= 3) { message = messageRecord[2].ToString(); } } else { message = messageRecord.FormatString; if (message.IsNotEmpty()) { for (int i = 1; i < messageRecord.FieldCount; i++) { message = message.Replace("[" + i + "]", messageRecord[i].ToString()); } } else { message = messageRecord[messageRecord.FieldCount - 1].ToString(); } } if (message.IsNotEmpty()) { currentAction.Text = currentActionLabel.Text + " " + message; } } catch { } } break; } return(MessageResult.OK); }
/// <summary> /// Processes information and progress messages sent to the user interface. /// </summary> /// <param name="messageType">Message type.</param> /// <param name="messageRecord">Record that contains message data.</param> /// <param name="buttons">Message box buttons.</param> /// <param name="icon">Message box icon.</param> /// <param name="defaultButton">Message box default button.</param> /// <returns>Result of processing the message.</returns> public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { // Synchronously send the message to the setup wizard window on its thread. return(InUIThread <MessageResult>(() => { return setupWizard.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton); })); }
/// <summary> /// Processes the message. /// </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 override MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { switch (messageType) { case InstallMessage.InstallStart: case InstallMessage.InstallEnd: { showWaitPromptTimer.Stop(); waitPrompt.Visible = false; } break; case InstallMessage.ActionStart: { try { //messageRecord[0] - is reserved for FormatString value string message = null; if (messageRecord.FieldCount >= 3) { message = messageRecord[2].ToString(); } if (message.IsNotEmpty()) { currentAction.Text = "{0} {1}".FormatWith(currentActionLabel.Text, message); } } catch { //Catch all, we don't want the installer to crash in an //attempt to process message. } } break; } return(MessageResult.OK); }
/// <summary> /// Processes the message. /// </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 override MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { switch (messageType) { case InstallMessage.ActionStart: { try { //messageRecord[0] - is reserved for FormatString value string message = null; bool simple = true; if (simple) { for (int i = messageRecord.FieldCount - 1; i > 0; i--) { message = messageRecord[i].ToString(); } } else { message = messageRecord.FormatString; if (message.IsNotEmpty()) { for (int i = 1; i < messageRecord.FieldCount; i++) { message = message.Replace("[" + i + "]", messageRecord[i].ToString()); } } else { message = messageRecord[messageRecord.FieldCount - 1].ToString(); } } if (message.IsNotEmpty()) { currentAction.Text = message; } } catch { } } break; } return(MessageResult.OK); }
public DialogResult Display(string message, string caption, MessageButton msgButton, MessageDefaultButton msgDefaultButton) { if (msgButton == MessageButton.OK) { return(Display(message, caption, msgButton)); } else if (msgButton == MessageButton.OKCancle) //OKCancle { switch (msgDefaultButton) { case MessageDefaultButton.Button1: break; case MessageDefaultButton.Button2: this.btnCancel.TabIndex = 0; this.btnOk.TabIndex = 1; this.btnNo.TabIndex = 2; break; default: throw new Exception("不存在第三个按钮."); } return(Display(message, caption, msgButton)); } else if (msgButton == MessageButton.RetryCancel) //RetryCancel { switch (msgDefaultButton) { case MessageDefaultButton.Button1: break; case MessageDefaultButton.Button2: this.btnCancel.TabIndex = 0; this.btnOk.TabIndex = 1; this.btnNo.TabIndex = 2; break; default: throw new Exception("不存在第三个按钮."); } return(Display(message, caption, msgButton)); } else if (msgButton == MessageButton.YesNoCancel) //YesNoCance { switch (msgDefaultButton) { case MessageDefaultButton.Button1: break; case MessageDefaultButton.Button2: this.btnCancel.TabIndex = 2; this.btnOk.TabIndex = 1; this.btnNo.TabIndex = 0; break; case MessageDefaultButton.Button3: this.btnCancel.TabIndex = 0; this.btnOk.TabIndex = 1; this.btnNo.TabIndex = 2; break; default: break; } return(Display(message, caption, msgButton)); } else //YesNo { switch (msgDefaultButton) { case MessageDefaultButton.Button1: break; case MessageDefaultButton.Button2: this.btnNo.TabIndex = 0; this.btnOk.TabIndex = 1; this.btnCancel.TabIndex = 2; break; default: throw new Exception("不存在第三个按钮."); } return(Display(message, caption, msgButton)); } }
/// <summary> /// Processes information and progress messages sent to the user interface. /// </summary> /// <param name="messageType">Message type.</param> /// <param name="messageRecord">Record that contains message data.</param> /// <param name="buttons">Message box buttons.</param> /// <param name="icon">Message box icon.</param> /// <param name="defaultButton">Message box default button.</param> /// <returns>Result of processing the message.</returns> public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { // Synchronously send the message to the setup wizard window on its thread. object result = this.setupWizard.Dispatcher.Invoke(DispatcherPriority.Send, new Func<MessageResult>(delegate() { return this.setupWizard.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton); })); return (MessageResult) result; }
private MessageResult OnMessage(InstallMessage messageType, Deployment.WindowsInstaller.Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { switch (messageType) { case InstallMessage.FatalExit: case InstallMessage.Error: return this.OnError(messageRecord); case InstallMessage.Warning: return this.OnWarning(messageRecord); case InstallMessage.User: return this.OnInformation(messageRecord); default: return MessageResult.None; } }
/// <summary> /// Processes information and progress messages sent to the user interface. /// </summary> /// <param name="messageType">Message type.</param> /// <param name="messageRecord">Record that contains message data.</param> /// <param name="buttons">Message box buttons.</param> /// <param name="icon">Message box icon.</param> /// <param name="defaultButton">Message box default button.</param> /// <returns>Result of processing the message.</returns> public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { // Synchronously send the message to the setup wizard window on its thread. object result = this.setupWizard.Dispatcher.Invoke(DispatcherPriority.Send, new Func <MessageResult>(delegate() { return(this.setupWizard.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton)); })); return((MessageResult)result); }
/// <summary> /// Processes information and progress messages sent to the user interface. /// </summary> /// <param name="messageType">Message type.</param> /// <param name="messageRecord">Record that contains message data.</param> /// <param name="buttons">Message buttons.</param> /// <param name="icon">Message box icon.</param> /// <param name="defaultButton">Message box default button.</param> /// <returns> /// Result of processing the message. /// </returns> /// <remarks> /// <p> /// Win32 MSI API: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/embeddeduihandler.asp">EmbeddedUIHandler</a></p> /// </remarks> public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { return(shell.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton)); }
/// <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) { try { UACRevealer.Exit(); this.progressCounter.ProcessMessage(messageType, messageRecord); if (CurrentDialog != null) { InUIThread(() => CurrentDialog.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)) { MessageBox.Show( this.shellView, messageRecord.ToString(), "[ErrorDlg_Title]".LocalizeWith(MsiRuntime.Localize), (MessageBoxButtons)(int)buttons, (MessageBoxIcon)(int)icon, (MessageBoxDefaultButton)(int)defaultButton); } if (messageType == InstallMessage.Info) { if (messageRecord.ToString().Contains("User canceled 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); } var result = MessageResult.OK; InUIThread(() => { if (CurrentDialog != null) { result = CurrentDialog.ProcessMessage(messageType, messageRecord, buttons, icon, defaultButton); } }); return(result); }
public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) { if (_controller.IsCanceled) { this.ViewModel.ClosingModel.Installed = ClosingResult.Cancelled; return(MessageResult.Cancel); } var indicator = _progressCounter.ProcessMessage(messageType, messageRecord); _controller.UpdateProgress(indicator); // Have we finished? if (messageType == InstallMessage.InstallEnd) { try { var returnCode = messageRecord.GetInteger(3); this.ViewModel.ClosingModel.Installed = returnCode == 1 ? ClosingResult.Success : ClosingResult.Failed; } catch (Exception) { this.ViewModel.ClosingModel.Installed = ClosingResult.Failed; } } return(MessageResult.OK); }