Example #1
0
        private void OnSendDebugFilesExecute(object sender, ExecutedRoutedEventArgs e)
        {
            var app = (App)Application.Current;
            var dlg = new SendDebugDataWindow();

            dlg.Owner = this;
            if (dlg.ShowDialog() == true)
            {
                app.SendLogs(null, dlg.UsersEMail, dlg.UsersDescription, dlg.UserSendEmail);
            }
        }
        static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string expMsg = NNTPServer.Traces.ExceptionToString(e.ExceptionObject as Exception);

            if (string.IsNullOrEmpty(expMsg))
            {
                expMsg = "<Unknown Exception>";
            }
            Traces.Main_TraceEvent(System.Diagnostics.TraceEventType.Critical, 1, "UnhandledException: {0}",
                                   expMsg);

            var    exp = e.ExceptionObject as Exception;
            string msg = "<Unknown>";

            if (exp != null)
            {
                msg = exp.Message;
            }

            var dlg = new SendDebugDataWindow();

            dlg.UnhandledExceptionMessage = msg;
            if (dlg.ShowDialog() == true)
            //MessageBoxResult res = MessageBox.Show(
            //  string.Format("UnhandledException occured: {0}\r\n\r\nDo you want to send debug data to the developer?", msg),
            //  "Error", MessageBoxButton.YesNo, MessageBoxImage.Stop);
            //if (res == MessageBoxResult.Yes)
            {
                try
                {
                    var app = (App)Current;
                    app.SendLogs(expMsg, dlg.UsersEMail, dlg.UsersDescription, dlg.UserSendEmail);
                }
                catch { }
                // Terminate...
                //Current.Shutdown(-1);
                Environment.Exit(-1);
            }
        }