Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8529683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:05:12+00:00 2026-06-11T09:05:12+00:00

I searched a few links for Timer Control for both Windows and WPF applications

  • 0

I searched a few links for Timer Control for both Windows and WPF applications but I would appreciate some advice on my situation…

As I’m using WPF it seems initial options are either System.Windows.Threading.DispatcherTimer or System.Diagnostics.Stopwatch

What I need to achieve is for each WPF DocumentPanel to request an update from an external API at a defined interval between typically 100ms Min – anytime Max with the interval unique to each DocumentPanel. Eg DP1 could be 100ms, DP2 could be 20,000ms etc.

Normally my app would start with 1 DocumentPanel but the user can expand panels without limit so it’s the users judgement on CPU ability and speed of app.

Criteria include:

  1. Multiple DocumentPanels – Typically 1 – 20 minimum but any advice on scalability is welcome.

  2. Variable event interval (Iv) (Minimum event interval 100ms – Max < 1day)

  3. Accuracy – 1ms (cannot have interval below (Iv)ms under ANY circumstances, over is not as much concern but needs to be be within several ms) EDIT: 1ms is not strictly a requirement but average (Iv) must be maintained over a short timescale.

  4. Each DocumentPanel must display live date/time but produce events based on set interval

I’m really after help with design consideration rather than actual code at the moment as WPF is confusing matters for me.

Currently, I’m verging towards using a single instance of System.Diagnostics.Stopwatch and allow each panel to act on the stopwatch event whether the interval time has been reached.

Can anyone advise?

Thank you
O

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:05:13+00:00Added an answer on June 11, 2026 at 9:05 am

    its better to use just one System.Windows.Threading.DispatcherTimer with 100ms as ticks, then use Tags to determine its own interval, for example you can use

    struct IntervalComparer
    {
         int myinterval; //the individual update interval (300ms for example)
         int currentinterval;
         public IntervalComparer(int myinterval)
        {
                this.myinterval=myinterval;
                this.currentinterval=0;
        }
    
            public void TickMe()
            {
                currentinterval++;
            }
    
            public void ResetkMe()
            {
                currentinterval = 0;
            }
    
            public bool CanIUpdate()
            {
                return myinterval == currentinterval;
            }
    }
    

    on the creation

    .... Form_Loaded....
    {
     .....
          mypanel=new Panel();
          mypanel.Tag= new IntervalComparer(2); // 2 * 100ms
     .....
    }
    
    .... Timer_Tick....
    {
       ....
       (mypanel.Tag as IntervalComparer).TickMe();
        if((mypanel.Tag as IntervalComparer).CanIUpdate())
         {
           UpdateMyPanel();//your update method 
           (mypanel.Tag as IntervalComparer).ResetMe();
         }
    
       ....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've searched around SO for this and found a few things, but I'm still
Searched around on SO for an answer. Found some interesting stuff but I am
I've searched over this topic but found very few details which were helpful. With
Searched for a few hours, but I'm stuck in a my learning curve for
I've searched this for a few hours already, but it doesn't work. I have
I've searched quite a bit and found a few solutions that did not end
I've seen a few web searches and responses to this but it seems they
Searched a lot about this problem but never found a answer, that solved it.
I've tried a few google searches and stack over flow searches, but this is
I've been reading this site for a few months, and gotten some great answers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.