private void DrawCaret() { blinkTimer.Stop(); checkTimer?.Dispose(); var caret = new VisualElement(); caret.Draw(CaretPosition); visuals.Clear(); visuals.Add(caret); isCaretVisible = true; }
private void InitBlinker() { blinkTimer = new DispatcherTimer(); blinkTimer.Tick += (sender, e) => { Application.Current.Dispatcher.Invoke((Action)(() => { if (isCaretVisible) { var caret = new VisualElement(); caret.Draw(CaretPosition); visuals.Add(caret); } else { visuals.Clear(); } isCaretVisible = !isCaretVisible; })); }; blinkTimer.Interval = new TimeSpan(0, 0, 0, 0, BLINK_INTERVAL); }