private void SetupApplication_Error(object sender, Microsoft.Tools.WindowsInstallerXml.Bootstrapper.ErrorEventArgs e)
        {
            string logName = "Engine hook SetupApplication_Error: ";

            try
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("ERROR DURING INSTALL EXECUTION!");
                sb.Append(" Message: ");
                sb.Append("\"" + e.ErrorMessage + "\"");
                sb.Append(", Type: ");
                sb.Append(e.ErrorType.ToString());
                sb.Append(", Error Code: ");
                sb.Append(e.ErrorCode.ToString());
                sb.Append(", Package ID: ");
                sb.Append(e.PackageId);

                IList <string> data = e.Data;

                if (data != null && data.Count > 0)
                {
                    for (int i = 0; i < data.Count; i++)
                    {
                        sb.Append(", Data [" + i.ToString() + "]: ");
                        sb.Append(data[i]);
                    }
                }

                this.Log(sb.ToString());
            }
            catch (Exception ex)
            {
                this.Log(logName + "Exception occured!" + Environment.NewLine + ex.ToString());
            }
        }
Example #2
0
 private void Error(object sender, Microsoft.Tools.WindowsInstallerXml.Bootstrapper.ErrorEventArgs e)
 {
     this._model.LogMessage("Error event has fired");
     this._model.LogMessage(string.Format("ErrorMessage:{0}", e.ErrorMessage));
     this._model.LogMessage(string.Format("ErrorType:{0}", e.ErrorType));
     this._model.LogMessage(string.Format("PackageId:{0}", e.PackageId));
 }
Example #3
0
        private void App_Error(object sender, Microsoft.Tools.WindowsInstallerXml.Bootstrapper.ErrorEventArgs e)
        {
            MessageBox.Show(e.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);

            Result = ActionResult.Failure;

            Dispatcher.InvokeShutdown();
        }
Example #4
0
        private void Error(object sender, ErrorEventArgs e)
        {
            lock (_lock)
            {
                if (!Canceled)
                {
                    if (State == InstallationState.Applying && e.ErrorCode == (int)SystemErrorCodes.ERROR_CANCELLED)
                    {
                        State = PreApplyState;
                    }
                    else
                    {
                        Message = e.ErrorMessage;

                        if (App.Current.Command.Display == Display.Full)
                        {
                            var buttons = System.Windows.Forms.MessageBoxButtons.OK;
                            switch (e.UIHint & 0xF)
                            {
                            case 0:
                                buttons = System.Windows.Forms.MessageBoxButtons.OK;
                                break;

                            case 1:
                                buttons = System.Windows.Forms.MessageBoxButtons.OKCancel;
                                break;

                            case 2:
                                buttons = System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore;
                                break;

                            case 3:
                                buttons = System.Windows.Forms.MessageBoxButtons.YesNoCancel;
                                break;

                            case 4:
                                buttons = System.Windows.Forms.MessageBoxButtons.YesNo;
                                break;
                            }

                            var result = System.Windows.Forms.MessageBox.Show(e.ErrorMessage, string.Format("{0} for {1}", Resources.SDKName, Resources.NETFrameworkName),
                                                                              buttons, System.Windows.Forms.MessageBoxIcon.Error);

                            if ((int)buttons == (e.UIHint & 0xF))
                            {
                                e.Result = (Result)result;
                            }
                        }
                    }
                }
                else
                {
                    e.Result = Result.Cancel;
                }
            }
        }
Example #5
0
        /// <summary>Called when the engine has encountered an error.</summary>
        /// <param name="args">The arguments of the event.</param>
        protected override void OnError(Wix.ErrorEventArgs args)
        {
            LogVerbose("Enter Method: OnError");
            WPFBootstrapperEventArgs <Wix.ErrorEventArgs> cancelArgs = new WPFBootstrapperEventArgs <Wix.ErrorEventArgs>(args);

            TryInvoke(new Action(() => { _mainWindow.OnError(cancelArgs); }));
            if (!cancelArgs.Cancel)
            {
                base.OnError(cancelArgs.Arguments);
            }
            LogVerbose("Leaving Method: OnError");
        }
        /// <summary>Called when the engine has encountered an error.</summary>
        /// <param name="args">The arguments of the event.</param>
        protected override void OnError(Wix.ErrorEventArgs args)
        {
            this.LogError("Bootstrapper.OnError [ErrorType={0}|ErrorCode={1}|ErrorMessage={2}]", args.ErrorType, args.ErrorCode, args.ErrorMessage);
            this.LogBootstrapperEnterEvent(args, "Error");
            WPFBootstrapperEventArgs <Wix.ErrorEventArgs> cancelArgs = new WPFBootstrapperEventArgs <Wix.ErrorEventArgs>(args);

            this.TryInvoke(new Action(() => { this.model.OnError(cancelArgs); }));
            if (!cancelArgs.Cancel)
            {
                base.OnError(cancelArgs.Arguments);
            }
            this.LogBootstrapperLeaveEvent(null, "Error");
        }
        private void ExecuteError(object sender, ErrorEventArgs e)
        {
            lock (this)
            {
                if (!this.Cancelled)
                {
                    // If the error is a cancel coming from the engine during apply we want to go back to the preapply state.
                    if (this.State == InstallationState.Applying && e.ErrorCode == ERROR_UserCancelled)
                    {
                        this.State = this.PreApplyState;
                    }
                    else
                    {
                        this.Message = e.ErrorMessage;
                        Execute.OnUIThread(() =>
                        {
                            MessageBox.Show(Application.Current.MainWindow, e.ErrorMessage, "WiX Toolset", MessageBoxButton.OK, MessageBoxImage.Error);
                        });
                    }
                }

                e.Result = this.Cancelled ? Result.Cancel : Result.Ok;
            }
        }
Example #8
0
		void ExecuteError(object sender, ErrorEventArgs e)
		{
			lock (this)
			{
				if (!_root.Canceled)
				{
					// If the error is a cancel coming from the engine during apply we want to go back to the preapply state.
					if (InstallationState.Applying == _root.State && (int)Error.UserCancelled == e.ErrorCode)
					{
						_root.State = _root.PreApplyState;
					}
					else
					{
						this.Message = e.ErrorMessage;

						FiresecUX.View.Dispatcher.Invoke((Action)delegate()
						{
							MessageBox.Show(FiresecUX.View, e.ErrorMessage, "WiX Toolset", MessageBoxButton.OK, MessageBoxImage.Error);
						}
							);
					}
				}

				e.Result = _root.Canceled ? Result.Cancel : Result.Ok;
			}
		}
Example #9
0
        private void ExecuteError(object sender, ErrorEventArgs e)
        {
            lock (this)
            {
                try
                {
                    ErrorCode = e.ErrorCode;
                    ErrorMessage = e.ErrorMessage;

                    // if user cancelled error, return that
                    if (Cancelled)
                    {
                        e.Result = Result.Cancel;
                        ErrorCode = 1602;
                        ErrorMessage = "User cancelled operation";
                        return;
                    }

                    // If the error is a cancel coming from the engine during apply we want to go back to the preapply state.
                    if (InstallationState.Applying == InstallationState && (int)EngineErrors.UserCancelled == e.ErrorCode)
                    {
                        InstallationState = PreApplyState;
                        return;
                    }

                    // if we're not in full display mode, just return
                    if (Display.Full != BaseModel.Command.Display) return;

                    // On HTTP authentication errors, have the engine try to do authentication for us.
                    if (ErrorType.HttpServerAuthentication == e.ErrorType || ErrorType.HttpProxyAuthentication == e.ErrorType)
                    {
                        e.Result = Result.TryAgain;
                        return;
                    }

                    // otherwise, raise an error dialog
                    var msgbox = MessageBoxButton.OK;
                    switch (e.UIHint & 0xF)
                    {
                        case 0:
                            msgbox = MessageBoxButton.OK;
                            break;
                        case 1:
                            msgbox = MessageBoxButton.OKCancel;
                            break;
                        // There is no 2! That would have been MB_ABORTRETRYIGNORE.
                        case 3:
                            msgbox = MessageBoxButton.YesNoCancel;
                            break;
                        case 4:
                            msgbox = MessageBoxButton.YesNo;
                            break;
                        // default: stay with MBOK since an exact match is not available.
                    }

                    var result = MessageBoxResult.None;
                    Dispatcher.Invoke((Action)delegate
                    {
                        result = MessageBox.Show(View, e.ErrorMessage, WindowTitle, msgbox, MessageBoxImage.Error);
                    });

                    // If there was a match from the UI hint to the msgbox value, use the result from the
                    // message box. Otherwise, we'll ignore it and return the default to Burn.
                    if ((e.UIHint & 0xF) == (int)msgbox)
                    {
                        e.Result = (Result)result;
                    }
                }
                finally
                {
                    BaseModel.UploadLogEntry("InstallError", "{0} {1}", ErrorCode, ErrorMessage);
                }

            }
        }
Example #10
0
        Result IBootstrapperApplication.OnError(ErrorType errorType, string wzPackageId, int dwCode, string wzError, int dwUIHint, int cData, string[] rgwzData, int nRecommendation)
        {
            ErrorEventArgs args = new ErrorEventArgs(errorType, wzPackageId, dwCode, wzError, dwUIHint, rgwzData, nRecommendation);
            this.OnError(args);

            return args.Result;
        }
Example #11
0
 /// <summary>
 /// Called when the engine has encountered an error.
 /// </summary>
 /// <param name="args">Additional arguments for this event.</param>
 protected virtual void OnError(ErrorEventArgs args)
 {
     EventHandler<ErrorEventArgs> handler = this.Error;
     if (null != handler)
     {
         handler(this, args);
     }
 }
		private void OnError(object sender, ErrorEventArgs e)
		{
			lock (_lock)
			{
				if (!Cancelled)
				{
					if (e.ErrorCode == (int)SystemErrorCodes.ERROR_CANCELLED)
					{
						_completedStepVmFactory.GetViewModelInstance().Result = OperationResult.Cancelled;
					}
					else
					{
						_progressStepVmFactory.GetViewModelInstance().Message = e.ErrorMessage;
						_completedStepVmFactory.GetViewModelInstance().Message = e.ErrorMessage;
						_completedStepVmFactory.GetViewModelInstance().Result = OperationResult.Failed;

						if (_installer.Command.Display == Display.Full)
						{
							var code = e.UIHint & 0xF;
							switch (code)
							{
								case 0:
									{
										var notification = new Notification { Title = Resources.SDKTitle, Content = e.ErrorMessage };
										OKDialogRequest.Raise(notification);
										e.Result = Result.Ok;
									}
									break;
								case 1:
								case 4:
									{
										var confirmation = new Confirmation { Title = Resources.SDKTitle, Content = e.ErrorMessage };
										switch (e.UIHint & 0xF)
										{
											case 1:
												OKCancelDialogRequest.Raise(confirmation);
												e.Result = confirmation.Confirmed ? Result.Ok : Result.Cancel;
												break;
											case 4:
												YesNoDialogRequest.Raise(confirmation);
												e.Result = confirmation.Confirmed ? Result.Ok : Result.Cancel;
												break;
										}
									}
									break;
								case 2:
								case 3:
									{
										var refusedConfirmation = new RefusedConfirmation();
										switch (e.UIHint & 0xF)
										{
											case 2:
												AbortRetryIgnoreDialogRequest.Raise(refusedConfirmation);
												e.Result = refusedConfirmation.Refused ? Result.Abort : (refusedConfirmation.Confirmed ? Result.Retry : Result.Ignore);
												if (!refusedConfirmation.Refused)
												{
													_completedStepVmFactory.GetViewModelInstance().Result = OperationResult.Successful;
												}
												break;
											case 3:
												YesNoCancelDialogRequest.Raise(refusedConfirmation);
												e.Result = refusedConfirmation.Confirmed ? Result.Yes : (refusedConfirmation.Refused ? Result.No : Result.Cancel);
												break;
										}
									}
									break;
							}
						}
					}
				}
				else
				{
					e.Result = Result.Cancel;
				}
			}
		}
        private void ExecuteError(object sender, ErrorEventArgs e)
        {
            lock (this)
            {
                if (!_root.Canceled)
                {
                    // If the error is a cancel coming from the engine during apply we want to go back to the preapply state.
                    if (InstallationState.Applying == _root.State && (int)Error.UserCancelled == e.ErrorCode)
                        _root.State = _root.PreApplyState;
                    else
                    {
                        Message = e.ErrorMessage;

                        Bootstrapper.View.Dispatcher.Invoke((Action)(() => MessageBox.Show(Bootstrapper.View, e.ErrorMessage,
                                                                                               "ESME Workbench", MessageBoxButton.OK, MessageBoxImage.Error)));
                    }
                }

                e.Result = _root.Canceled ? Result.Cancel : Result.Ok;
            }
        }
 private void OnError(object sender, Microsoft.Tools.WindowsInstallerXml.Bootstrapper.ErrorEventArgs e)
 {
     this.SetupExitState = Result.Cancel;
 }
        private void ExecuteError(object sender, ErrorEventArgs e)
        {
            lock (this)
            {
                if (!this.Cancelled)
                {
                    // If the error is a cancel coming from the engine during apply we want to go back to the preapply state.
                    if (this.State == InstallationState.Applying && e.ErrorCode == ERROR_UserCancelled)
                    {
                        this.State = this.PreApplyState;
                    }
                    else
                    {
                        this.Message = e.ErrorMessage;
                        Execute.OnUIThread(() =>
                        {
                            MessageBox.Show(Application.Current.MainWindow, e.ErrorMessage, "WiX Toolset", MessageBoxButton.OK, MessageBoxImage.Error);
                        });
                    }
                }

                e.Result = this.Cancelled ? Result.Cancel : Result.Ok;
            }
        }