コード例 #1
0
        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;
            };
        }
コード例 #2
0
        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 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;
        }