Skip to content

Trying to understand what drives a refresh; timer versus Application.AddTimeout approach. #4064

Answered by BDisp
dandole asked this question in Q&A
Discussion options

You must be logged in to vote

Because Application.AddTimeout force an iteration which will redraw again. For the timer work as well you have to call Application.Invoke inside the Elapsed event.

        _timer.Elapsed += (s, e) => 
        { 
            Application.Invoke(() => {
                UpdateLabel(); 
                _labelView.SetNeedsDraw(); 
            });
        };

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dandole
Comment options

@tznind
Comment options

tznind Apr 29, 2025
Collaborator

Answer selected by dandole
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants