Example #1
0
        private void InitSession()
        {
            CurrentGroundSpeed     = 0;
            _numberOfSpeedReadings = 0;
            _totalOfSpeedReadings  = 0;
            AverageGroundSpeed     = 0;
            MaximumGroundSpeed     = 0;
            MaximumAltitude        = 0;
            MinimumAltitude        = int.MaxValue;
            SpeedAltitudeAdjusted  = 0;
            TotalDistanceTravelled = 0;
            TotalShipRepairs       = 0;
            TotalSynthRepairs      = 0;
            _lastLocation          = null;
            SessionStartTime       = DateTime.MinValue;
            SessionStartLocation   = null;
            TotalSRVsDestroyed     = 0;

            string commanderName = "";

            if (_telemetry.ContainsKey("CommanderName"))
            {
                commanderName = _telemetry["CommanderName"];
            }

            _telemetry.Clear();
            _telemetry.Add("CommanderName", commanderName);
            _telemetry.Add("CurrentGroundSpeed", "0 m/s");
            _telemetry.Add("CurrentHeading", "Unknown");
            _telemetry.Add("HullStrength", $"{(HullHealth * 100).ToString("F1")}%");
            _telemetry.Add("Pips", String.Join(",", Pips));
            _telemetry.Add("Shield", "Unknown");
            _telemetry.Add("CargoScoop", "Unknown");
            _telemetry.Add("AverageGroundSpeed", "0 m/s");
            _telemetry.Add("MaximumGroundSpeed", "0 m/s");
            _telemetry.Add("DistanceFromStart", "0");
            _telemetry.Add("TotalDistanceTravelled", "0");
            _telemetry.Add("TotalShipRepairs", "0");
            _telemetry.Add("TotalSynthRepairs", "0");
            _telemetry.Add("TotalSRVsDestroyed", "0");
            _telemetry.Add("SessionStartTime", "");
            _telemetry.Add("SessionDate", "");
            _telemetry.Add("SessionTime", "00:00:00");
            _telemetry.Add("CurrentAltitude", "0");
            _telemetry.Add("MaximumAltitude", "NA");
            _telemetry.Add("MinimumAltitude", "NA");
            _telemetry.Add("CurrentLatitude", "NA");
            _telemetry.Add("CurrentLongitude", "NA");
            _telemetry.Add("SpeedAltitudeAdjusted", SpeedAltitudeAdjusted.ToString());
            _telemetry.Add("MaximumSpeedAltitudeAdjusted", MaximumSpeedAltitudeAdjusted.ToString());

            SessionHistory.Clear();
            _srvTelemetryDisplay?.UpdateTargetData(Telemetry());
        }
        private void InitSession()
        {
            CurrentGroundSpeed     = 0;
            _numberOfSpeedReadings = 0;
            _totalOfSpeedReadings  = 0;
            AverageGroundSpeed     = 0;
            MaximumGroundSpeed     = 0;
            MaximumAltitude        = 0;
            SpeedAltitudeAdjusted  = 0;
            TotalDistanceTravelled = 0;
            TotalShipRepairs       = 0;
            TotalSynthRepairs      = 0;
            SessionStartTime       = DateTime.Now;
            SessionStartLocation   = null;
            TotalSRVsDestroyed     = 0;

            _telemetry.Clear();
            _telemetry.Add("CurrentGroundSpeed", CurrentGroundSpeed.ToString());
            _telemetry.Add("CurrentHeading", "Unknown");
            _telemetry.Add("HullStrength", $"{(HullHealth * 100).ToString("F1")}%");
            _telemetry.Add("AverageGroundSpeed", AverageGroundSpeed.ToString());
            _telemetry.Add("MaximumGroundSpeed", MaximumGroundSpeed.ToString());
            _telemetry.Add("DistanceFromStart", "0m");
            _telemetry.Add("TotalDistanceTravelled", TotalDistanceTravelled.ToString("F1"));
            _telemetry.Add("TotalShipRepairs", TotalShipRepairs.ToString());
            _telemetry.Add("TotalSynthRepairs", TotalSynthRepairs.ToString());
            _telemetry.Add("TotalSRVsDestroyed", "0");
            _telemetry.Add("SessionStartTime", "");
            _telemetry.Add("SessionDate", "");
            _telemetry.Add("SessionTime", "00:00:00");
            _telemetry.Add("CurrentAltitude", "0");
            _telemetry.Add("MaximumAltitude", "0");
            _telemetry.Add("SpeedAltitudeAdjusted", SpeedAltitudeAdjusted.ToString());
            _telemetry.Add("MaximumSpeedAltitudeAdjusted", MaximumSpeedAltitudeAdjusted.ToString());

            SessionHistory.Clear();
            _srvTelemetryDisplay?.UpdateTargetData(Telemetry());
        }
Example #3
0
        public void DisplayTelemetry(System.Windows.Forms.IWin32Window owner = null)
        {
            if (_srvTelemetryWriter == null)
            {
                return;
            }

            if (_srvTelemetryDisplay == null || _srvTelemetryDisplay.IsDisposed)
            {
                _srvTelemetryDisplay = new FormTelemetryDisplay(_srvTelemetryWriter, "Commander Telemetry");
                //_srvTelemetryDisplay.FormClosing += _targetTelemetryDisplay_FormClosing;
                _srvTelemetryDisplay.InitialiseRows(TelemetryDescriptions);
                _srvTelemetryDisplay.UpdateTargetData(Telemetry());
                if (owner != null)
                {
                    _srvTelemetryDisplay.Show(owner);
                }
                else
                {
                    _srvTelemetryDisplay.Show();
                }
            }
            else if (!_srvTelemetryDisplay.Visible)
            {
                if (owner != null)
                {
                    _srvTelemetryDisplay.Show(owner);
                }
                else
                {
                    _srvTelemetryDisplay.Show();
                }
            }
            else
            {
                _srvTelemetryDisplay.Focus();
            }
        }