I’m trying to understand a general flow of WPF application, it’s not everything clear for me, so, please, help me to understand the following:
If I want my database polling Timer in a WPF application was started not from a code behind file of my main window, but from another separate class, how I should implement this?
Should this class be somehow connected with a main window code behind class? What processes (apart of user actions) can instantiate this separate class and what (apart of user actions) can call the method which starts a Timer?
In the place of this Timer can be any Method, it is important to understand the general architectural principle of application flow and class objects structure.
WPF applications have by default an
Appclass that is called first. If you don’t want to connect your timer to the main window (what is your reason?) you can start your timer in the application’sStartupevent handler.and in the App.xaml file: