Пример #1
0
        /// <summary>
        /// The handling.
        /// </summary>
        /// <param name="exception">
        /// The exception.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Handling(Exception exception)
        {
            if (exception is COMException)
            {
                messenger.Add(new UiMessage(WiaError.GetErrorMessage((COMException)exception), TypeOfMessage.Error));
                return(true);
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        /// Ermittelt für eine (WIA-)COM-Ausnahme die zugehörige Fehlermeldung
        /// </summary>
        /// <param name="ex">die (WIA-)COM-Ausnahme</param>
        /// <returns>die zur (WIA-)COM-Ausnahme gehörende Fehlermeldung</returns>
        public static string GetMessageFromComException(COMException ex)
        {
            WiaError wiaError = (WiaError)ex.ErrorCode;
            int      errorCode;

            if (!Int32.TryParse(wiaError.ToString(), out errorCode))
            {
                string message = wiaError.ToString();
                WiaException.messageMappings.TryGetValue(wiaError, out message);
                return(message);
            }
            else
            {
                return(ex.Message);
            }
        }