31
31
using MonoMac.ObjCRuntime;
34
using MonoDevelop.Monitoring;
35
using MonoDevelop.CrashReporting;
36
using MonoDevelop.CrashLog;
34
using MonoDevelop.Core.LogReporting;
38
36
namespace MacCrashLogger
40
38
public partial class AppDelegate : NSApplicationDelegate
42
ICrashMonitor Monitor {
46
bool ProcessingCrashLog {
50
CrashReporter Reporter {
60
Reporter = new CrashReporter (CrashLogOptions.LogPath, CrashLogOptions.Email);
62
Monitor = CrashMonitor.Create (CrashLogOptions.Pid);
63
Monitor.ApplicationExited += HandleMonitorApplicationExited;
64
Monitor.CrashDetected += HandleMonitorCrashDetected;
67
public override void FinishedLaunching (NSObject notification)
70
Reporter.ProcessCache ();
73
void HandleMonitorCrashDetected (object sender, CrashEventArgs e)
75
InvokeOnMainThread (() => {
77
ProcessingCrashLog = true;
78
Reporter.UploadOrCache (e.CrashLogPath);
81
NSApplication.SharedApplication.Terminate (this);
83
ProcessingCrashLog = false;
88
void HandleMonitorApplicationExited (object sender, EventArgs e)
90
InvokeOnMainThread (() => {
92
if (!ProcessingCrashLog) {
93
NSApplication.SharedApplication.Terminate (null);
40
// ICrashMonitor Monitor {
44
// bool ProcessingCrashLog {
48
// CrashReporter Reporter {
56
// public AppDelegate ()
58
// Reporter = new CrashReporter (CrashLogOptions.LogPath, CrashLogOptions.Email);
60
// Monitor = CrashMonitor.Create (CrashLogOptions.Pid);
61
// Monitor.ApplicationExited += HandleMonitorApplicationExited;
62
// Monitor.CrashDetected += HandleMonitorCrashDetected;
65
// public override void FinishedLaunching (NSObject notification)
68
// Reporter.ProcessCache ();
71
// void HandleMonitorCrashDetected (object sender, CrashEventArgs e)
73
// InvokeOnMainThread (() => {
75
// ProcessingCrashLog = true;
76
// Reporter.UploadOrCache (e.CrashLogPath);
79
// NSApplication.SharedApplication.Terminate (this);
81
// ProcessingCrashLog = false;
86
// void HandleMonitorApplicationExited (object sender, EventArgs e)
88
// InvokeOnMainThread (() => {
90
// if (!ProcessingCrashLog) {
91
// NSApplication.SharedApplication.Terminate (null);
b'\\ No newline at end of file'