示例#1
0
        //
        // Updates the GUI with the new data values in the struct DataPacket.
        private void UpdateGUI()
        {
            //
            // Set the update rate.
            updateRate.Text = DeltaT.ToString();
            dataStream.Text = DataStreamSize.ToString();

            //
            // Update the GUI.
            txtUTC.Text            = InputData.UTC.ToString();
            txtGPSLatitude.Text    = InputData.Latitude.ToString();
            txtGPSLongitude.Text   = InputData.Longitude.ToString();
            txtAltitudeASL.Text    = InputData.Altitude.ToString();
            txtAltitudeAGL.Text    = "0.000"; // TODO: Add a ground level feature.
            txtAccelX.Text         = InputData.AccelX.ToString();
            txtAccelY.Text         = InputData.AccelY.ToString();
            txtAccelZ.Text         = InputData.AccelZ.ToString();
            txtVelX.Text           = InputData.GyroX.ToString();
            txtVelY.Text           = InputData.GyroY.ToString();
            txtVelZ.Text           = InputData.GyroZ.ToString();
            txtPosX.Text           = InputData.MagX.ToString();
            txtPosY.Text           = InputData.MagY.ToString();
            txtPosZ.Text           = InputData.MagZ.ToString();
            txtFlyOrDrive.Text     = (InputData.Movement == 'D') ? "DRIVING" : "FLYING";
            txtRoll.Text           = InputData.Roll.ToString();
            txtPitch.Text          = InputData.Pitch.ToString();
            txtYaw.Text            = InputData.Yaw.ToString();
            txtGndMtr1.Background  = InputData.GroundMeter1 ? Brushes.GreenYellow : Brushes.Red;
            txtGndMtr2.Background  = InputData.GroundMeter2 ? Brushes.GreenYellow : Brushes.Red;
            txtAirMtr1.Background  = InputData.AirMotor1 ? Brushes.GreenYellow : Brushes.Red;
            txtAirMtr2.Background  = InputData.AirMotor2 ? Brushes.GreenYellow : Brushes.Red;
            txtAirMtr3.Background  = InputData.AirMotor3 ? Brushes.GreenYellow : Brushes.Red;
            txtAirMtr4.Background  = InputData.AirMotor4 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor1.Background = InputData.uS1 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor2.Background = InputData.uS2 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor3.Background = InputData.uS3 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor4.Background = InputData.uS4 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor5.Background = InputData.uS5 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor6.Background = InputData.uS6 ? Brushes.GreenYellow : Brushes.Red;
            if (InputData.PayloadBay)
            {
                txtPayloadDeployed.Background = Brushes.GreenYellow;
                txtPayloadDeployed.Text       = "Deployed";
            }
            else
            {
                txtPayloadDeployed.Background = Brushes.Red;
            }
        }
        //
        // Updates the GUI with the new data values in the struct DataPacket.
        private void UpdateGUI()
        {
            //
            // Set the update rate.
            updateRate.Text = DeltaT.ToString();
            dataStream.Text = DataStreamSize.ToString();

            //
            // Update the GUI.
            txtUTC.Text            = InputData.UTC.ToString();
            txtGPSLatitude.Text    = InputData.Latitude.ToString();
            txtGPSLongitude.Text   = InputData.Longitude.ToString();
            txtAltitudeASL.Text    = InputData.Altitude.ToString();
            txtAltitudeAGL.Text    = "0.000"; // TODO: Add a ground level feature.
            txtAccelX.Text         = InputData.AccelX.ToString();
            txtAccelY.Text         = InputData.AccelY.ToString();
            txtAccelZ.Text         = InputData.AccelZ.ToString();
            txtVelX.Text           = InputData.GyroX.ToString();
            txtVelY.Text           = InputData.GyroY.ToString();
            txtVelZ.Text           = InputData.GyroZ.ToString();
            txtPosX.Text           = InputData.MagX.ToString();
            txtPosY.Text           = InputData.MagY.ToString();
            txtPosZ.Text           = InputData.MagZ.ToString();
            txtFlyOrDrive.Text     = (InputData.Movement == 'D') ? "DRIVING" : "FLYING";
            txtRoll.Text           = InputData.Roll.ToString();
            txtPitch.Text          = InputData.Pitch.ToString();
            txtYaw.Text            = InputData.Yaw.ToString();
            txtGndMtr1.Background  = InputData.GroundMeter1 ? Brushes.GreenYellow : Brushes.Red;
            txtGndMtr2.Background  = InputData.GroundMeter2 ? Brushes.GreenYellow : Brushes.Red;
            txtAirMtr1.Background  = InputData.AirMotor1 ? Brushes.GreenYellow : Brushes.Red;
            txtAirMtr2.Background  = InputData.AirMotor2 ? Brushes.GreenYellow : Brushes.Red;
            txtAirMtr3.Background  = InputData.AirMotor3 ? Brushes.GreenYellow : Brushes.Red;
            txtAirMtr4.Background  = InputData.AirMotor4 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor1.Background = InputData.uS1 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor2.Background = InputData.uS2 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor3.Background = InputData.uS3 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor4.Background = InputData.uS4 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor5.Background = InputData.uS5 ? Brushes.GreenYellow : Brushes.Red;
            txtUSensor6.Background = InputData.uS6 ? Brushes.GreenYellow : Brushes.Red;
            if (InputData.PayloadBay)
            {
                txtPayloadDeployed.Background = Brushes.GreenYellow;
                txtPayloadDeployed.Text       = "Deployed";
            }
            else
            {
                txtPayloadDeployed.Background = Brushes.Red;
            }

            //
            // Check if the system is armed or disarmed.
            if (InputData.sysArmed)
            {
                //
                // System armed.
                this.ArmSystemBox.Background = Brushes.GreenYellow;
                this.ArmSystemBox.Text       = "ARMED";

                //
                // Reconfigure the GUI for user feedback.
                this.ArmSystemBtn.Content = "Disarm System";
            }
            else
            {
                //
                // System disarmed.
                ArmSystemBox.Background = Brushes.Red;
                ArmSystemBox.Text       = "DISARMED";

                //
                // Reconfigure the GUI for user feedback.
                ArmSystemBtn.Content = "Arm System";
            }
        }