Exemplo n.º 1
0
        }         // proc TransformPoint

        #endregion

        #region -- Dialogs ------------------------------------------------------------

        public static void ShowException(this IWin32Window owner, ExceptionShowFlags flags, Exception exception, string alternativeMessage = null)
        {
            var unpackedException = exception.UnpackException();

            if ((flags & ExceptionShowFlags.Warning) != 0)
            {
                MessageBox.Show(owner, alternativeMessage ?? unpackedException.Message, "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (unpackedException is ExcelException excelException)
            {
                MessageBox.Show(owner, alternativeMessage ?? excelException.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                using (var exceptionDialog = new ExceptionDialog())
                {
                    exceptionDialog.SetData(alternativeMessage, unpackedException, false);
                    exceptionDialog.ShowDialog(owner);
                }
            }
        }         // proc ShowException