/// <summary> /// Constructor for MainWindow class /// </summary> public MainWindow() { InitializeComponent(); _psEngine = new PSEngine(); secs = 0; mins = 0; hrs = 0; this.TasksProgressBar.DataContext = this; this.Main_ProgressBar.DataContext = this; MainProgress = 0; Progress = 0; Maximum = 100.0; Minimum = 0.0; dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += dispatcherTimer_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 1); }
/// <summary> /// Constructor for MainWindow class /// </summary> public MainWindow() { InitializeComponent(); _psEngine = new PSEngine(); secs = 0; mins = 0; hrs = 0; // set datacontext property for progressbars to this class. This is necessary for setting up binding. this.TasksProgressBar.DataContext = this; this.Main_ProgressBar.DataContext = this; // set initial values for Progress/Min/Max MainProgress = 0; Progress = 0; Maximum = 100.0; Minimum = 0.0; // initialize DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); // subscribe to the dispatcherTimer_Tick event. Documentation on event subscription: https://msdn.microsoft.com/en-us/library/ms366768.aspx dispatcherTimer.Tick += dispatcherTimer_Tick; // set interval for firing the dispatcherTimer_Tick event. Uses TimeSpan(hrs, mins, secs) dispatcherTimer.Interval = new TimeSpan(0, 0, 1); }