void OnSendClick(object sender, RoutedEventArgs e) { try { if (Model == null) { return; } Model.Comments = txtComments.Text; BackgroundSendModel sendModel = BackgroundSendModelAccessor.SendReportInBackgroundThread(Model.SendReport); ReportSendProgressForm progressForm = new ReportSendProgressForm(sendModel); progressForm.Owner = this; progressForm.ShowDialog(); ReportSendProgressDialogResult result = progressForm.Result; if (result == ReportSendProgressDialogResult.OK) { this.DialogResult = true; } else if (result == ReportSendProgressDialogResult.Retry) { MessageBox.Show(this, "Unable to send, please try again", this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } } catch { } }
void OnTimerTick(object sender, EventArgs e) { if (Model == null) { return; } try { if (Model.SendComplete || (Model.Thread != null && (Model.Thread.ThreadState == ThreadState.AbortRequested || Model.Thread.ThreadState == ThreadState.Aborted))) { timer.Stop(); if (Model.SendResult) { this.Result = ReportSendProgressDialogResult.OK; this.DialogResult = true; } else { this.Result = ReportSendProgressDialogResult.Retry; this.DialogResult = false; } } } catch { } }
void OnCancelClick(object sender, RoutedEventArgs e) { if (Model == null) { return; } try { if (Model.Thread != null) { Model.Thread.Abort(); } } catch { } this.Result = ReportSendProgressDialogResult.Cancel; this.DialogResult = false; }