public InkDrawViewPage()
        {
            InitializeComponent();
            Loaded += (sender, eventArgs) =>
            {
                SetCanvasSize();

                strokeService = new InkStrokesService(inkCanvas.InkPresenter);
                var selectionRectangleService = new InkSelectionRectangleService(inkCanvas, selectionCanvas, strokeService);
                lassoSelectionService = new InkLassoSelectionService(inkCanvas, selectionCanvas, strokeService, selectionRectangleService);
                pointerDeviceService  = new InkPointerDeviceService(inkCanvas);
                copyPasteService      = new InkCopyPasteService(strokeService);
                undoRedoService       = new InkUndoRedoService(inkCanvas, strokeService);
                fileService           = new InkFileService(inkCanvas, strokeService);
                zoomService           = new InkZoomService(canvasScroll);

                touchInkingButton.IsChecked = true;
                mouseInkingButton.IsChecked = true;

                strokeService.CopyStrokesEvent        += (s, e) => RefreshEnabledButtons();
                strokeService.SelectStrokesEvent      += (s, e) => RefreshEnabledButtons();
                strokeService.ClearStrokesEvent       += (s, e) => RefreshEnabledButtons();
                undoRedoService.UndoEvent             += (s, e) => RefreshEnabledButtons();
                undoRedoService.RedoEvent             += (s, e) => RefreshEnabledButtons();
                undoRedoService.AddUndoOperationEvent += (s, e) => RefreshEnabledButtons();
                pointerDeviceService.DetectPenEvent   += (s, e) => touchInkingButton.IsChecked = false;
            };
        }
        public void Initialize(
            InkStrokesService strokeService,
            InkLassoSelectionService lassoSelectionService,
            InkPointerDeviceService pointerDeviceService,
            InkCopyPasteService copyPasteService,
            InkUndoRedoService undoRedoService,
            InkFileService fileService,
            InkZoomService zoomService)
        {
            _strokeService         = strokeService;
            _lassoSelectionService = lassoSelectionService;
            _pointerDeviceService  = pointerDeviceService;
            _copyPasteService      = copyPasteService;
            _undoRedoService       = undoRedoService;
            _fileService           = fileService;
            _zoomService           = zoomService;

            _strokeService.CopyStrokesEvent        += (s, e) => RefreshCommands();
            _strokeService.SelectStrokesEvent      += (s, e) => RefreshCommands();
            _strokeService.ClearStrokesEvent       += (s, e) => RefreshCommands();
            _undoRedoService.UndoEvent             += (s, e) => RefreshCommands();
            _undoRedoService.RedoEvent             += (s, e) => RefreshCommands();
            _undoRedoService.AddUndoOperationEvent += (s, e) => RefreshCommands();
            _pointerDeviceService.DetectPenEvent   += (s, e) => EnableTouch = false;
        }
示例#3
0
        public PaintImageViewModel(
            InkStrokesService _strokesService,
            InkPointerDeviceService _pointerDeviceService,
            InkFileService _fileService,
            InkZoomService _zoomService)
        {
            strokesService       = _strokesService;
            pointerDeviceService = _pointerDeviceService;
            fileService          = _fileService;
            zoomService          = _zoomService;

            pointerDeviceService.DetectPenEvent += (s, e) => EnableTouch = false;
        }
        public void Initialize(
            InkStrokesService strokeService,
            InkPointerDeviceService pointerDeviceService,
            InkFileService fileService,
            InkZoomService zoomService)
        {
            _strokeService        = strokeService;
            _pointerDeviceService = pointerDeviceService;
            _fileService          = fileService;
            _zoomService          = zoomService;

            _strokeService.StrokesCollected      += (s, e) => RefreshCommands();
            _strokeService.StrokesErased         += (s, e) => RefreshCommands();
            _strokeService.ClearStrokesEvent     += (s, e) => RefreshCommands();
            _pointerDeviceService.DetectPenEvent += (s, e) => EnableTouch = false;
        }
        public InkDrawPictureViewPage()
        {
            InitializeComponent();

            Loaded += (sender, eventArgs) =>
            {
                SetCanvasSize();
                image.SizeChanged += Image_SizeChanged;

                strokesService                       = new InkStrokesService(inkCanvas.InkPresenter);
                pointerDeviceService                 = new InkPointerDeviceService(inkCanvas);
                fileService                          = new InkFileService(inkCanvas, strokesService);
                zoomService                          = new InkZoomService(canvasScroll);
                strokesService.StrokesCollected     += (s, e) => RefreshEnabledButtons();
                strokesService.StrokesErased        += (s, e) => RefreshEnabledButtons();
                strokesService.ClearStrokesEvent    += (s, e) => RefreshEnabledButtons();
                pointerDeviceService.DetectPenEvent += (s, e) => TouchInkingButtonIsChecked = false;
            };
        }
示例#6
0
        public DrawViewModel(
            InkStrokesService _strokeService,
            InkLassoSelectionService _lassoSelectionService,
            InkPointerDeviceService _pointerDeviceService,
            InkCopyPasteService _copyPasteService,
            InkUndoRedoService _undoRedoService,
            InkFileService _fileService,
            InkZoomService _zoomService)
        {
            strokeService         = _strokeService;
            lassoSelectionService = _lassoSelectionService;
            pointerDeviceService  = _pointerDeviceService;
            copyPasteService      = _copyPasteService;
            undoRedoService       = _undoRedoService;
            fileService           = _fileService;
            zoomService           = _zoomService;

            pointerDeviceService.DetectPenEvent += (s, e) => EnableTouch = false;
        }
示例#7
0
        public DrawPage()
        {
            InitializeComponent();
            SetNavigationViewHeaderContext();
            SetNavigationViewHeaderTemplate();

            Loaded += (_, _) =>
            {
                SetCanvasSize();
                image.SizeChanged                   += Image_SizeChanged;
                strokesService                       = new InkStrokesService(inkCanvas.InkPresenter);
                pointerDeviceService                 = new InkPointerDeviceService(inkCanvas);
                fileService                          = new InkFileService(inkCanvas, strokesService);
                zoomService                          = new InkZoomService(canvasScroll);
                strokesService.StrokesCollected     += (_, _) => RefreshEnabledButtons();
                strokesService.StrokesErased        += (_, _) => RefreshEnabledButtons();
                strokesService.ClearStrokesEvent    += (_, _) => RefreshEnabledButtons();
                pointerDeviceService.DetectPenEvent += (_, _) => TouchInkingButtonIsChecked = false;
                _ = LoadPlainAsync();
            };
        }