private void SearchDevices() { //set _DecompressieKamer if found to != null Searcher searcher = new Searcher(this); if (_DecompressieKamer != null) { _DecompressieKamer.Dispose(); _DecompressieKamer = null; searcher.Text = "Connection lost, reconnecting..."; //reset all local stats here and wait for remote stats then update here } searcher.ShowDialog(); if (_DecompressieKamer == null) { Application.Exit(); } else { //success, connected with Decompression chamber _DecompressieKamer.OnEvent += _DecompressieKamer_OnEvent; _DecompressieKamer.StartProcessing(); } }
private void _SearchThread_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (_SearchThread.Interval == 10) { _SearchThread.Interval = 600000; try { //search for an available decompression chamber, if not found exception is thrown because the class cannot do it's work then.. ask user what to do _DecompressieKamer = new DecompressieKamer(15000); } catch (NoDeviceFoundException) { } _SearchThread.Stop(); } }
public Searcher(MainWindow main) { InitializeComponent(); _MainWindow = main; _DecompressieKamer = null; _SearchThread = new System.Timers.Timer(); _SearchThread.Interval = 10; _SearchThread.Elapsed += _SearchThread_Elapsed; _SearchThread.Start(); _RefreshTimer = new Timer(); _RefreshTimer.Interval = 50; _RefreshTimer.Tick += _RefreshTimer_Tick; _RefreshTimer.Start(); }
public MainWindow() { InitializeComponent(); _DecompressieKamer = null; }