public SketchModellingViewModel(
            UiState uiState,
            SessionData sessionData,
            DisplayOptions displayOptions,
            IPrimitivesConverter primitivesConverter,
            IEventAggregator eventAggregator,
            IUnityContainer container,
            ISketchCatalog sketchCatalog)
            : this()
        {
            this.uiState             = uiState;
            this.sessionData         = sessionData;
            this.primitivesConverter = primitivesConverter;
            this.DisplayOptions      = displayOptions;
            this.container           = container;
            this.sketchCatalog       = sketchCatalog;
            this.eventAggregator     = eventAggregator;

            uiState.AddListener(this, () => uiState.SketchPlane);
            eventAggregator.GetEvent <SnapCompleteEvent>().Subscribe(OnSnapComplete);

            sketchPlane = uiState.SketchPlane;

            viewModelGenerator = new ViewModelCollectionGenerator <NewPrimitiveViewModel, NewPrimitive>(
                NewPrimitiveViewModels,
                sessionData.NewPrimitives,
                NewPrimitiveDataToNewPrimitiveViewModel);

            SnappedPrimitives = new SnappedPrimitivesCollection(sessionData.SnappedPrimitives);
        }
Esempio n. 2
0
        public SketchViewModel(
            IUnityContainer container,
            IEventAggregator eventAggregator,
            UiState uiState,
            SessionData sessionData,
            ISnapper snapper,
            IClassificationInference classificationInference,
            IUndoHistory undoHistory)
        {
            this.uiState                 = uiState;
            this.sessionData             = sessionData;
            this.eventAggregator         = eventAggregator;
            this.snapper                 = snapper;
            this.classificationInference = classificationInference;
            this.undoHistory             = undoHistory;

            uiState.AddListener(this, () => uiState.SketchPlane);
            sessionData.AddListener(this, () => sessionData.SketchName);

            NewPrimitives = sessionData.NewPrimitives;

            SketchModellingViewModel = container.Resolve <SketchModellingViewModel>();
            SketchImageViewModel     = container.Resolve <SketchImageViewModel>();

            eventAggregator.GetEvent <MarkFeatureEvent>().Subscribe(MarkFeatureHandler);
            eventAggregator.GetEvent <MarkSilhouetteEvent>().Subscribe(MarkSilhouetteHandler);
        }