Пример #1
0
        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception exception = e.ExceptionObject as Exception;

            if (exception != null)
            {
                Microsoft.NetEnterpriseServers.ExceptionMessageBox emb = new Microsoft.NetEnterpriseServers.ExceptionMessageBox(
                    exception,
                    Microsoft.NetEnterpriseServers.ExceptionMessageBoxButtons.OK,
                    Microsoft.NetEnterpriseServers.ExceptionMessageBoxSymbol.Error);

                emb.Caption = "Internal application error. Sorry for the inconvenience.";

                emb.Show(MainClass.MainWindow);
            }
            else
            {
                Microsoft.NetEnterpriseServers.ExceptionMessageBox emb = new Microsoft.NetEnterpriseServers.ExceptionMessageBox(
                    "Unknown application error. Sorry for the inconvenience.",
                    "Unknown object was thrown.",
                    Microsoft.NetEnterpriseServers.ExceptionMessageBoxButtons.OK);

                emb.Show(MainClass.MainWindow);
            }
        }
Пример #2
0
        public static void DisplayException(IWin32Window owner, Exception exception)
        {
            Microsoft.NetEnterpriseServers.ExceptionMessageBox emb = new Microsoft.NetEnterpriseServers.ExceptionMessageBox(
                exception,
                Microsoft.NetEnterpriseServers.ExceptionMessageBoxButtons.OK,
                Microsoft.NetEnterpriseServers.ExceptionMessageBoxSymbol.Error);

            emb.Caption = exception.TargetSite.DeclaringType.FullName + " has thrown an exception:";

            emb.Show(owner);
        }