Exemple #1
0
        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);
        }
Exemple #2
0
        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;
 }