public InkMirror() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Enabled; inkRecognizer = new ServiceHelpers.InkRecognizer(subscriptionKey); recoTreeNodes = new Dictionary <int, InkRecognitionUnit>(); recoTreeParentNodes = new List <InkRecognitionUnit>(); recoText = new Dictionary <int, Tuple <string, Color> >(); redoStrokes = new Stack <InkStroke>(); clearedStrokes = new List <InkStroke>(); activeTool = ballpointPen; inkCanvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Mouse; inkCanvas.InkPresenter.StrokeInput.StrokeStarted += InkPresenter_StrokeInputStarted; inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased; var languages = new List <Language> { new Language("Chinese (Simplified)", "zh-CN"), new Language("Chinese (Traditional)", "zh-TW"), new Language("English (UK)", "en-GB"), new Language("English (US)", "en-US"), new Language("French", "fr-FR"), new Language("German", "de-DE"), new Language("Italian", "it-IT"), new Language("Korean", "ko-KR"), new Language("Portuguese", "pt-PT"), new Language("Spanish", "es-ES") }; languageDropdown.ItemsSource = languages; }
public FormFiller() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Enabled; inkRecognizer = new ServiceHelpers.InkRecognizer(subscriptionKey); redoStacks = new Dictionary <string, Stack <InkStroke> >(); clearedStrokesLists = new Dictionary <string, List <InkStroke> >(); activeTool = ballpointPen; // Add event handlers and create redo stacks for each form field's ink canvases foreach (string prefix in prefixes) { var canvas = this.FindName($"{prefix}Canvas") as InkCanvas; canvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Mouse; canvas.InkPresenter.StrokeInput.StrokeStarted += InkPresenter_StrokeInputStarted; canvas.InkPresenter.StrokeInput.StrokeEnded += InkPresenter_StrokeInputEnded; canvas.InkPresenter.StrokesErased += InkPresenter_StrokeErased; redoStacks.Add(prefix, new Stack <InkStroke>()); clearedStrokesLists.Add(prefix, new List <InkStroke>()); } // Timer created for ink recognition to happen after a set time period once a stroke ends dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += DispatcherTimer_Tick; dispatcherTimer.Interval = TimeSpan.FromMilliseconds(350); }
public InkMirror() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Enabled; inkRecognizer = new ServiceHelpers.InkRecognizer(subscriptionKey); recoTreeNodes = new Dictionary <int, InkRecognitionUnit>(); recoTreeParentNodes = new List <InkRecognitionUnit>(); recoText = new Dictionary <int, Tuple <string, Color> >(); redoStrokes = new Stack <InkStroke>(); clearedStrokes = new List <InkStroke>(); activeTool = ballpointPen; inkCanvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Mouse; inkCanvas.InkPresenter.StrokeInput.StrokeStarted += InkPresenter_StrokeInputStarted; inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased; resultNav.SelectedItem = resultNav.MenuItems[0]; // Set default ink color to blue ballpointPen.SelectedBrushIndex = 16; pencil.SelectedBrushIndex = 16; }
public FormFiller() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Enabled; inkRecognizer = new ServiceHelpers.InkRecognizer(subscriptionKey); redoStacks = new Dictionary <string, Stack <InkStroke> >(); clearedStrokesLists = new Dictionary <string, List <InkStroke> >(); currentCanvas = yearCanvas; inkToolbar.TargetInkCanvas = currentCanvas; activeTool = ballpointPen; // Set default ink color to blue ballpointPen.SelectedBrushIndex = 16; pencil.SelectedBrushIndex = 16; // Add event handlers and create redo stacks for each form field's ink canvases foreach (string prefix in prefixes) { var canvas = this.FindName($"{prefix}Canvas") as InkCanvas; canvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Mouse; canvas.InkPresenter.StrokeInput.StrokeStarted += InkPresenter_StrokeInputStarted; canvas.InkPresenter.StrokeInput.StrokeEnded += InkPresenter_StrokeInputEnded; canvas.InkPresenter.StrokesErased += InkPresenter_StrokeErased; redoStacks.Add(prefix, new Stack <InkStroke>()); clearedStrokesLists.Add(prefix, new List <InkStroke>()); } // Timer created for ink recognition to happen after a set time period once a stroke ends inkRecoTimer = new DispatcherTimer(); inkRecoTimer.Tick += InkRecoTimer_Tick; inkRecoTimer.Interval = TimeSpan.FromMilliseconds(350); // Timer created to switch from ink to text when user is idle in form field after a set time textToggleTimer = new DispatcherTimer(); textToggleTimer.Tick += TextToggleTimer_Tick; textToggleTimer.Interval = TimeSpan.FromSeconds(3); }