Exemple #1
0
        private async void SendReportAsync()
        {
            IsBusy = true;

            // The report must have at least either the message or the exception object
            if (Message.IsBlank() && Exception == null)
            {
                await _windowService.ShowErrorWindowAsync(Localization.BugReport_NoMessageSpecified);

                IsBusy = false;
                return;
            }

            // Check if mailback is set
            if (MailBack.IsBlank())
            {
                bool shouldContinue = await _windowService.ShowPromptWindowAsync(Localization.BugReport_NoMailBackSpecified);

                if (!shouldContinue)
                {
                    IsBusy = false;
                    return;
                }
            }

            // Get system info
            string systemInfo = GetSystemInfo();

            // Get the log file
            string logDump      = IncludeLogs ? Logger.GetLogDump() : null;
            string databaseDump = IncludeDB ? _databaseService.GetDatabaseDump() : null;

            // Send
            await _taskFactory.StartNew(
                () => _apiService.ReportException(Settings.Stager.Current.UserID, Message, systemInfo, Exception, logDump, databaseDump, MailBack));

            // Report completion
            await _windowService.ShowNotificationWindowAsync(Localization.BugReport_ReportSent);

            IsBusy = false;

            // Close window
            _window?.Close();
        }
Exemple #2
0
        private async void SendReportAsync()
        {
            IsBusy = true;

            // The report must have at least either the message or the exception object
            if (Message.IsBlank() && Exception == null)
            {
                await _windowService.ShowErrorWindowAsync(Localization.BugReport_NoMessageSpecified);

                IsBusy = false;
                return;
            }

            // Check if mailback is set
            if (MailBack.IsBlank())
            {
                bool shouldContinue = await _windowService.ShowPromptWindowAsync(Localization.BugReport_NoMailBackSpecified);

                if (!shouldContinue)
                {
                    IsBusy = false;
                    return;
                }
            }

            // Get system info
            string systemInfo = GetSystemInfo();

            // Get the log file
            string logDump      = IncludeLogs ? Logger.GetLogDump() : null;
            string databaseDump = IncludeDB ? _databaseService.GetDatabaseDump() : null;

            // TODO: re-enable once external service established
            // Send
            //await _taskFactory.StartNew(() => _apiService.ReportException(Message, systemInfo, Exception, logDump, databaseDump, MailBack));


            // Report completion
            //await _windowService.ShowNotificationWindowAsync(Localization.BugReport_ReportSent);

            {
                string serializedData = JsonConvert.SerializeObject(new BugReportInfo
                {
                    Message    = Message,
                    SystemInfo = systemInfo,
                    Exception  = Exception,
                    Log        = logDump,
                    Database   = databaseDump,
                    MailBack   = MailBack
                });

                Clipboard.SetText(serializedData);

                await _windowService.ShowNotificationWindowAsync(Localization.BugReport_CopiedToClipboard);

                Process.Start(Constants.URLSubmitBugReport);
            }

            IsBusy = false;

            // Close window
            _window?.Close();
        }