public static WpfHostingWinForm CreateVerificationProgressForm( [NotNull] IQualityVerificationProgressTracker progressTracker, [NotNull] Func <Task <ServiceCallStatus> > verificationAction, [CanBeNull] Action <QualityVerification> showReportAction, [CanBeNull] Action <IQualityVerificationResult> saveAction, [CanBeNull] string title) { var qaProgressViewmodel = new VerificationProgressViewModel { ProgressTracker = progressTracker, VerificationAction = verificationAction, ShowReportAction = showReportAction, SaveAction = saveAction }; VerificationProgressWpfControl progressControl = new VerificationProgressWpfControl(); progressControl.SetDataSource(qaProgressViewmodel); var progressForm = new WpfHostingWinForm(progressControl); progressForm.FixedHeight = true; progressForm.Text = title; return(progressForm); }
public static WpfHostingWinForm CreateVerificationProgressForm( [NotNull] IQualityVerificationProgressTracker progressTracker, [NotNull] Func <Task <ServiceCallStatus> > verificationAction, [CanBeNull] Action <QualityVerification> showReportAction, [CanBeNull] Action <IQualityVerificationResult, ErrorDeletionInPerimeter, bool> saveAction, [CanBeNull] ICommand openErrorWorklist, [CanBeNull] ICommand zoomToPerimeter, [CanBeNull] Action <IList <EnvelopeXY> > flashTileProgressAction, [CanBeNull] string title) { var qaProgressViewmodel = new VerificationProgressViewModel { ProgressTracker = progressTracker, VerificationAction = verificationAction, ShowReportAction = showReportAction, SaveAction = saveAction, OpenWorkListCommand = openErrorWorklist, ZoomToPerimeterCommand = zoomToPerimeter, FlashProgressAction = flashTileProgressAction }; VerificationProgressWpfControl progressControl = new VerificationProgressWpfControl(); progressControl.SetDataSource(qaProgressViewmodel); var progressForm = new WpfHostingWinForm(progressControl); progressForm.FixedHeight = true; progressForm.Text = title; return(progressForm); }
private async void Window_Loaded(object sender, RoutedEventArgs e) { VerificationProgressViewModel vm = (VerificationProgressViewModel)DataContext; // This is too early for the host win form (must be wired separately in the setter): WireClosingEvent(vm); await Assert.NotNull(vm).RunBackgroundVerificationAsync(); }
private void WireClosingEvent(VerificationProgressViewModel vm) { if (_hostWinForm != null) { _hostWinForm.Closing += vm.Closing; } else { var wpfWindow = Window.GetWindow(this); if (wpfWindow != null) { wpfWindow.Closing += vm.Closing; } } }
public void SetDataSource(VerificationProgressViewModel viewModel) { if (viewModel.CloseAction == null) { viewModel.CloseAction = () => { if (_hostWinForm != null) { _hostWinForm.Close(); } else { var wpfWindow = Window.GetWindow(this); Assert.NotNull(wpfWindow).Close(); } }; } DataContext = viewModel; }