private void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == System.Windows.Input.Key.F5) { try { if (Global_Object.ServerAlive()) { BackgroundWorker workerRedrawStation = new BackgroundWorker(); workerRedrawStation.DoWork += WorkerRedrawStation_DoWork; workerRedrawStation.RunWorkerAsync(); } } catch (Exception ex) { logFile.Error(ex.Message); } finally { Dispatcher.BeginInvoke(new ThreadStart(() => { lb_timerStatus.Content = "Manual Refresh"; })); } } }
private void Btn_manualRefresh_Click(object sender, RoutedEventArgs e) { try { if (Global_Object.ServerAlive()) { BackgroundWorker workerRedrawStation = new BackgroundWorker(); workerRedrawStation.DoWork += WorkerRedrawStation_DoWork; workerRedrawStation.RunWorkerAsync(); } } catch (Exception ex) { logFile.Error(ex.Message); } finally { Dispatcher.BeginInvoke(new ThreadStart(() => { lb_timerStatus.Content = "Manual Refresh"; })); } }
private void OnTimedRedrawStationEvent(object sender, ElapsedEventArgs e) { try { if (Global_Object.ServerAlive()) { BackgroundWorker workerRedrawStation = new BackgroundWorker(); workerRedrawStation.DoWork += WorkerRedrawStation_DoWork; workerRedrawStation.RunWorkerAsync(); } } catch (Exception ex) { logFile.Error(ex.Message); } finally { Dispatcher.BeginInvoke(new ThreadStart(() => { lb_timerStatus.Content = "Timer is running"; })); } }