public SketchView(SketchViewModel viewModel, UiState uiState, IEventAggregator eventAggregator, IUnityContainer container, ISnapper snapper, ILoggerFacade logger = null)
            : this()
        {
            this.logger = logger ?? new EmptyLogger();

            DataContext = viewModel;
            viewModel.PropertyChanged  += OnViewModelPropertyChanged;
            this.viewModel              = viewModel;
            this.duplicateEditorFactory = new DuplicateEditorFactory(this);
            this.snapper = snapper;

            sketchModellingView =
                container.Resolve <SketchModellingView>(
                    new DependencyOverride <SketchModellingViewModel>(viewModel.SketchModellingViewModel));
            root3d.Children.Add(sketchModellingView);

            sketchImageView =
                container.Resolve <SketchImageView>(
                    new DependencyOverride <SketchImageViewModel>(viewModel.SketchImageViewModel));
            Grid.SetRow(sketchImageView, 2);
            sketchImageView.Margin = vpRoot.Margin;
            root.Children.Insert(2, sketchImageView);

            newPrimitiveDragStrategy = new PrimitiveDragStrategy(uiState, sketchModellingView, snapper);
            snappedDragStrategy      = new SnappedDragStrategy(uiState, duplicateEditorFactory.Create(), eventAggregator);
            curveDragStrategy        = new CurveDragStrategy(uiState, sketchImageView, selectionRectangle);
            assignDragStrategy       = new AssignDragStrategy(uiState, primitiveCurvesRoot, sketchImageView, eventAggregator);

            eventAggregator.GetEvent <PrimitiveCurvesChangedEvent>().Subscribe(OnPrimitiveCurvesChanged);
        }
 public AssignDragStrategy(UiState uiState, ItemsControl primitiveCurvesRoot, SketchImageView sketchImageView, IEventAggregator eventAggregator)
     : base(uiState)
 {
     this.primitiveCurvesRoot = primitiveCurvesRoot;
     this.sketchImageView     = sketchImageView;
     this.eventAggregator     = eventAggregator;
 }
Example #3
0
 public CurveDragStrategy(UiState uiState, SketchImageView sketchImageView, FrameworkElement selectionRectangle)
     : base(uiState)
 {
     this.sketchImageView    = sketchImageView;
     this.selectionRectangle = selectionRectangle;
 }