Example #1
0
        private void UpdateWizardView()
        {
            this.nextStepButton.Content = "Next";
            switch (BuilderStepType)
            {
            case VisualAlertBuilderStepType.NewSubject:
                this.stepNumber.Text          = "1";
                this.titleTextBlock.Text      = "Add images with subject";
                this.nextStepButton.IsEnabled = !string.IsNullOrEmpty(SubjectName);
                break;

            case VisualAlertBuilderStepType.AddPositiveImages:
                this.titleTextBlock.Text = $"Add images with '{SubjectName}'";

                this.nextStepButton.IsEnabled       = PositiveSubjectImageCollection.Any();
                this.imageCount.Text                = $"{PositiveSubjectImageCollection.Count}";
                this.imageCountTextBlock.Visibility = Visibility.Visible;
                break;

            case VisualAlertBuilderStepType.AddNegativeImages:
                this.stepNumber.Text     = "2";
                this.titleTextBlock.Text = "Add images without subject";

                this.nextStepButton.IsEnabled       = NegativeSubjectImageCollection.Any();
                this.imageCount.Text                = $"{NegativeSubjectImageCollection.Count}";
                this.imageCountTextBlock.Visibility = Visibility.Visible;

                if (this.positiveImagesGrid.SelectedItems != null)
                {
                    SelectedPositiveSubjectImageCollection.Clear();
                    var selectedPosImages = this.positiveImagesGrid.SelectedItems.Cast <Tuple <BitmapImage, ImageAnalyzer> >().ToArray();
                    SelectedPositiveSubjectImageCollection.AddRange(selectedPosImages);
                }
                break;

            case VisualAlertBuilderStepType.TrainModel:
                this.stepNumber.Text     = "3";
                this.titleTextBlock.Text = "Train alert model";

                this.nextStepButton.Content         = "Train model";
                this.imageCountTextBlock.Visibility = Visibility.Collapsed;

                if (this.negativeImagesGrid.SelectedItems != null)
                {
                    SelectedNegativeSubjectImageCollection.Clear();
                    var selectedNegImages = this.negativeImagesGrid.SelectedItems.Cast <Tuple <BitmapImage, ImageAnalyzer> >().ToArray();
                    SelectedNegativeSubjectImageCollection.AddRange(selectedNegImages);
                }
                break;
            }

            this.WizardStepChanged?.Invoke(this, new Tuple <VisualAlertBuilderStepType, VisualAlertModelData>(BuilderStepType,
                                                                                                              new VisualAlertModelData()
            {
                Name           = SubjectName,
                PositiveImages = SelectedPositiveSubjectImageCollection.Select(x => x.Item2).ToList(),
                NegativeImages = SelectedNegativeSubjectImageCollection.Select(x => x.Item2).ToList()
            }));
        }
Example #2
0
        public void StartWizard()
        {
            SubjectName = string.Empty;

            PositiveSubjectImageCollection.Clear();
            NegativeSubjectImageCollection.Clear();
            SelectedPositiveSubjectImageCollection.Clear();
            SelectedNegativeSubjectImageCollection.Clear();

            BuilderStepType = VisualAlertBuilderStepType.NewSubject;
        }