Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResultsViewModel"/> class.
        /// </summary>
        /// <param name="tabName">The tab name string</param>
        /// <param name="templateId">Id of template used for recognition</param>
        /// <param name="isGenerated">Indicates if template was generated</param>
        public ResultsViewModel(string tabName, string templateId, bool isGenerated)
        {
            this.templateId = templateId;
            this.TabName    = tabName;

            this.IsGeneratedTemplate           = isGenerated;
            this.PreviewImages                 = new ObservableCollection <ImagePreviewViewModel>();
            this.InitialPreviewPanelVisibility = Visibility.Visible;
            this.PresetShown = false;

            if (PreprocessingConfigurationManager.CheckConfigExists(this.templateId))
            {
                this.SelectedPreprocessingConfiguration =
                    PreprocessingConfiguration.Deserialize(
                        PreprocessingConfigurationManager.GetConfigByKey(this.templateId));
                this.PresetShown = true;
            }

            ZoomKoefficient = 1;
            this.zoomLevel  = 1;

            this.InitCommands();

            if (this.PreviewImages.Count == 0)
            {
                this.CurrentStage = ResultProcessingStages.NoImages;
            }
        }
Exemple #2
0
        /// <summary>
        /// Display preset settings and update configuration after view closed
        /// </summary>
        private void OnShowPresets()
        {
            this.PresetShown = true;

            PreprocessingPresetsViewModel viewModel = new PreprocessingPresetsViewModel(this.IsGeneratedTemplate,
                                                                                        this.SelectedPreprocessingConfiguration);

            if (viewModel.Configuration != null)
            {
                this.SelectedPreprocessingConfiguration = viewModel.Configuration;

                PreprocessingConfigurationManager.AddConfig(this.templateId,
                                                            PreprocessingConfiguration.Serialize(this.SelectedPreprocessingConfiguration));
            }
        }