In my application, I use a timer to check for updates in the RSS feed if new items are detected. I bring up a user dialog to inform the user. When I run the scan manually, everything works fine, but when the automatic scan runs in the Elapsed Event timer, the user dialog is not displayed.
First of all, is this a thread issue? (I assume this is due to the fact that both manual and automatic validation use the same code).
When I run automatic validation, should I call a method that starts validation from an event handler with an expired timer?
Is there something I need to do in my dialog class?
Edit: this is a winforms application.
Here is an example of what the code looks like. (Please do not point out syntax errors in this code example, this is just a simple example, not real code).
public class MainForm : System.Windows.Forms.Form {
After reading some comments and answers, I think my problem is that I am using System.Timers.Timer not a System.Windows.Forms.Timer .
EDIT:
After switching to the initial testing, Forms.Timer looks good (but there are no new elements, so the user dialog has not been seen). I added some code to output the stream identifier to the file when calling the update method. Using Timers.Timer the thread id was not a GUI thread, but using Forms.Timer the thread id is the same as the GUI.
multithreading c # timer
Tester101
source share