public override bool Send(string fileName, Stream file, Report report, SerializableException exception) { if (Settings.CustomSubmissionHandle == null) { return(false); } var e = new CustomSubmissionEventArgs(fileName, file, report, exception); Settings.CustomSubmissionHandle.DynamicInvoke(this, e); return(e.Result); }
private static async void OnCustomSubmissionEvent(object sender, CustomSubmissionEventArgs customSubmissionEventArgs) { customSubmissionEventArgs.Result = false; var factory = ViewModelLocator.Resolve <IGitHubClientFactory>(); var client = factory?.GetClient(); if (client == null) { return; } try { var subject = "Product environment exception"; if (!string.IsNullOrWhiteSpace(customSubmissionEventArgs.Exception.Message)) { subject = customSubmissionEventArgs.Exception.Message; } await client.Issue.Create("EbenZhang", "PReviewer", new NewIssue(subject) { Body = customSubmissionEventArgs.Report.ToString() + customSubmissionEventArgs.Exception.ToString(), Assignee = "EbenZhang", Labels = { "Production Env Error" }, }); customSubmissionEventArgs.File.Dispose(); File.Delete(Path.Combine(LogDir, customSubmissionEventArgs.FileName)); customSubmissionEventArgs.Result = true; } catch { // ignored } }
/// <summary> /// Handles CustomSubmissionEvent to submit bug /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Settings_CustomSubmissionEvent(object sender, CustomSubmissionEventArgs e) { Debug.WriteLine(string.Format("Custom submission for exception {0}", e.Exception.Message)); e.Result = true; }