Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. DispatcherTimer Tick event not fired

DispatcherTimer Tick event not fired

Scheduled Pinned Locked Moved WPF
wpfcsharpcomdesigndebugging
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Praveen Raghuvanshi
    wrote on last edited by
    #1

    Hi, I am working on a WPF application. The application uses Infragistics controls such as Ribbon Controls and XamDockManager. It has a File Menu wherein I have provided a Save menu item to save the items on the canvas to a file. On click of Save button, Save Dialog opens to provide the File name and file is saved at the defined location. The saving process is quite time consuming and in order to show something to the user, I have used the WaitCursor. I have used a class similar to the one mentioned(UiServices.ShowWaitCursor) in the below thread. http://stackoverflow.com/questions/7346663/how-to-show-a-waitcursor-when-the-wpf-application-is-busy-databinding[^] http://stackoverflow.com/questions/3480966/display-hourglass-when-application-is-busy[^] The usage is like this public void WriteToFile(string fileName) { UiServices.SetBusyState(); _customFileWriter.WriteToFile(fileName); } This works fine, if we just save the things on the canvas into a file. However, if fails in the below scenario. The application has a canvas where I display some UI elements. On double click of the UI element, we launch a Windows form in the Infragistic ContentPane. We have a modeless dialog opened and perform File -> Save and provide a file name, the cursor stays indefinitely. It goes only once we click on the Canvas. The DispatcherTimer_Tick is fired only when we click on the Canvas which resets the cursor. The DispatcherPriority is ApplicationIdle. Another observation is, this happens only when we open the Save dialog through the File -> Save. It works fine if we open the Save dialog through Ctrl + S key combinations. Is there a way I can debug the non firing of DispatcherTimer.Tick event or any other way to handle this? I created a simple WPF application and it works fine in that. MainWindow.xaml

    P 1 Reply Last reply
    0
    • P Praveen Raghuvanshi

      Hi, I am working on a WPF application. The application uses Infragistics controls such as Ribbon Controls and XamDockManager. It has a File Menu wherein I have provided a Save menu item to save the items on the canvas to a file. On click of Save button, Save Dialog opens to provide the File name and file is saved at the defined location. The saving process is quite time consuming and in order to show something to the user, I have used the WaitCursor. I have used a class similar to the one mentioned(UiServices.ShowWaitCursor) in the below thread. http://stackoverflow.com/questions/7346663/how-to-show-a-waitcursor-when-the-wpf-application-is-busy-databinding[^] http://stackoverflow.com/questions/3480966/display-hourglass-when-application-is-busy[^] The usage is like this public void WriteToFile(string fileName) { UiServices.SetBusyState(); _customFileWriter.WriteToFile(fileName); } This works fine, if we just save the things on the canvas into a file. However, if fails in the below scenario. The application has a canvas where I display some UI elements. On double click of the UI element, we launch a Windows form in the Infragistic ContentPane. We have a modeless dialog opened and perform File -> Save and provide a file name, the cursor stays indefinitely. It goes only once we click on the Canvas. The DispatcherTimer_Tick is fired only when we click on the Canvas which resets the cursor. The DispatcherPriority is ApplicationIdle. Another observation is, this happens only when we open the Save dialog through the File -> Save. It works fine if we open the Save dialog through Ctrl + S key combinations. Is there a way I can debug the non firing of DispatcherTimer.Tick event or any other way to handle this? I created a simple WPF application and it works fine in that. MainWindow.xaml

      P Offline
      P Offline
      Paulo Zemek
      wrote on last edited by
      #2

      I can't execute your code (I don't have those libraries you use), but can you use another priority? I don't know... maybe you have an animation or similar that is never really letting the application become idle. Note: Seeing your code, you don't need to use a DispatcherTimer. It is enough to do a Dispatcher.BeginInvoke to call your delegate. This will also guarantee that it will execute only once, as soon as all the messages (including the actual one) are processed. In fact, I think your problem is that you never started your timer.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups