コード例 #1
0
        private static void Form1_UIThreadException(object sender, ThreadExceptionEventArgs t)
        {
            Exception ex       = (Exception)t.Exception;
            string    errorMsg = "An application error occurred. Please contact the adminstrator " +
                                 "with the following information:/n/n";

            errorMsg += ex.Message + "/n/nStack Trace:/n" + ex.StackTrace + "//" + ex.Source;
            BeautyService.BeautyServiceClient client = new BeautyService.BeautyServiceClient();
            client.Log(errorMsg);
            MessageBox.Show("程序发生异常,请重新运行");
        }
コード例 #2
0
        // Handle the UI exceptions by showing a dialog box, and asking the user whether
        // or not they wish to abort execution.
        // NOTE: This exception cannot be kept from terminating the application - it can only
        // log the event, and inform the user about it.
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception ex       = (Exception)e.ExceptionObject;
            string    errorMsg = "An application error occurred. Please contact the adminstrator " +
                                 "with the following information:/n/n";

            errorMsg += ex.Message + "/n/nStack Trace:/n" + ex.StackTrace + "//" + ex.Source;

            //MessageBox.Show("2:" + errorMsg);

            BeautyService.BeautyServiceClient client = new BeautyService.BeautyServiceClient();
            client.Log(errorMsg);
            MessageBox.Show("程序发生异常,请重新运行");
        }