Issue With Dispatch Timer
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Issue With Dispatch Timer

  1. #1
    Join Date
    Jun 2009

    Issue With Dispatch Timer

    I have a WPF application. I have a panel that I want to repopulate every 1 minute getting data from the network. I know that I can use the DispatcherTimer class to set the timespan for ticks and make my code execute in every 1 minute.
    The problem here is the my GUI freezes and becomes unresponsive as my code is busy fetching data from the network. I would like to know that is there any way in WPF to get rid of it as this is a new World for me.

    I am doing it like this:

    DispatcherTimer timer = new DispatcherTimer();



    timer.Interval = TimeSpan.FromMilliseconds(1000);

    timer.Tick += new EventHandler(timer_Tick);



    private void timer_Tick(object sender, EventArgs e)




    This code freezes my GUI. Please help.


  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Issue With Dispatch Timer

    Start a new thread (or use the BackgroundWorker class) and put the retrieval code there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center