示例#1
0
        private void DrawCaret() {
            blinkTimer.Stop();
            checkTimer?.Dispose();

            var caret = new VisualElement();

            caret.Draw(CaretPosition);
            visuals.Clear();
            visuals.Add(caret);

            isCaretVisible = true;
        }
示例#2
0
        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);
        }