private void ProcessingMethod() { F4SharedMem.FalconDataFormats dataFormat = _configuration.DataFormat; int interval = _configuration.Interval; try { using (F4SharedMem.Reader reader = new F4SharedMem.Reader(dataFormat)) { // pierwsze odczytanie danych z wymuszeniem przesłania F4SharedMem.FlightData data = reader.GetCurrentData(); if (_registeredVariable.Contains(_runningFalconVariable)) { _runningFalconVariable.SetValue(reader.IsFalconRunning); } if (data != null) { Type t = data.GetType(); foreach (Variable v in _registeredVariable) { if (v == _runningFalconVariable) { continue; } if (v.Index > -1) { continue; } FieldInfo fi = t.GetField(v.ID); if (fi != null) { object value = fi.GetValue(data); v.SetValue(value); continue; } } } while (_working) { if (interval > 0) { Thread.Sleep(interval); } data = reader.GetCurrentData(); if (data != null) { Type t = data.GetType(); foreach (Variable v in _registeredVariable) { if (v == _runningFalconVariable) { v.SetValueIfChanged(reader.IsFalconRunning); continue; } if (v.Index > -1) { continue; } FieldInfo fi = t.GetField(v.ID); if (fi != null) { v.SetValueIfChanged(fi.GetValue(data)); continue; } } } } } } catch (ThreadAbortException) { } catch (Exception ex) { _log.Log(this, ex.ToString()); } }
void _client_Disconnected(object sender, DisconnectedEventArgs e) { _log.Log(this, "Rozłączono z serwerem JH."); }
void _simClient_ConnectionDisconnected(object sender, EventArgs e) { _log.Log(this, "Zamknięto połączenie z serwerem SimAdapter."); }