Example #1
0
 public override string ToString()
 {
     try {
         return(base.ToString() + "\n" +
                "Surface Position:\n" +
                "\tSpeed:\t\t" + (HasGroundSpeed ? GroundSpeed.ToString("F8") : "unkown") +
                "\n\tSpeed Resolution:\t\t" + (HasGroundSpeed ? GroundSpeedResolution.ToString("F8") : "unkown") +
                "\n\tHeading:\t\t" + (HasValidHeading ? Heading.ToString("F8") : "unkown") +
                "\n\tFormat:\t\t" + (IsOddFormat?"odd":"even") +
                "\n\tHas position:\t" + (HasValidPosition?"yes":"no"));
     } catch (Exception ex)
     {
         // should never happen
         return("An exception " + ex.Message + " was thrown.");
     }
 }
Example #2
0
        private void RedrawOthersInfoText()
        {
            BorderTextLabel airspeedlabel = new BorderTextLabel();

            airspeedlabel.Stroke     = Brushes.DimGray;
            airspeedlabel.Foreground = Brushes.White;
            airspeedlabel.FontSize   = 14;
            airspeedlabel.FontWeight = FontWeights.Bold;
            airspeedlabel.Text       = "空速  " + AirSpeed.ToString("0.0");
            Canvas.SetLeft(airspeedlabel, 4);
            Canvas.SetTop(airspeedlabel, 80);
            Canvas_ViewPortLeft.Children.Add(airspeedlabel);

            BorderTextLabel groundspeedlabel = new BorderTextLabel();

            groundspeedlabel.Stroke     = Brushes.DimGray;
            groundspeedlabel.Foreground = Brushes.White;
            groundspeedlabel.FontSize   = 14;
            groundspeedlabel.FontWeight = FontWeights.Bold;
            groundspeedlabel.Text       = "地速  " + GroundSpeed.ToString("0.0");
            Canvas.SetLeft(groundspeedlabel, 4);
            Canvas.SetTop(groundspeedlabel, 100);
            Canvas_ViewPortLeft.Children.Add(groundspeedlabel);

            BorderTextLabel batteryabel = new BorderTextLabel();

            batteryabel.Stroke     = Brushes.DimGray;
            batteryabel.Foreground = Brushes.White;
            batteryabel.FontSize   = 14;
            batteryabel.FontWeight = FontWeights.Bold;
            batteryabel.Text       = string.Format("电池  {0} v  {1} A  {2}%", Voltage.ToString("0.00"), Galvanic.ToString("0.0"), BatteryPercent * 100);
            Canvas.SetLeft(batteryabel, 10);
            Canvas.SetTop(batteryabel, 130);
            Canvas_ViewPortLeft.Children.Add(batteryabel);

            if (HasEKF)
            {
                BorderTextLabel ekflabel = new BorderTextLabel();
                ekflabel.Stroke     = Brushes.DimGray;
                ekflabel.Foreground = Brushes.White;
                ekflabel.FontSize   = 14;
                ekflabel.FontWeight = FontWeights.Bold;
                ekflabel.Text       = "EKF";
                Canvas.SetLeft(ekflabel, 200);
                Canvas.SetTop(ekflabel, 130);
                Canvas_ViewPortLeft.Children.Add(ekflabel);
            }
            if (HasVibe)
            {
                BorderTextLabel vibelabel = new BorderTextLabel();
                vibelabel.Stroke     = Brushes.DimGray;
                vibelabel.Foreground = Brushes.Red;
                vibelabel.FontSize   = 14;
                vibelabel.FontWeight = FontWeights.Bold;
                vibelabel.Text       = "Vibe";
                Canvas.SetLeft(vibelabel, 250);
                Canvas.SetTop(vibelabel, 130);
                Canvas_ViewPortLeft.Children.Add(vibelabel);
            }

            BorderTextLabel gpslabel = new BorderTextLabel();

            gpslabel.Stroke     = Brushes.DimGray;
            gpslabel.Foreground = Brushes.Red;
            gpslabel.FontSize   = 14;
            gpslabel.FontWeight = FontWeights.Bold;
            string s = HasGPS ? "有GPS" : "无GPS";

            gpslabel.Text = "GPS: " + s;
            Canvas.SetLeft(gpslabel, 300);
            Canvas.SetTop(gpslabel, 130);
            Canvas_ViewPortLeft.Children.Add(gpslabel);

            BorderTextLabel flytimelabel = new BorderTextLabel();

            flytimelabel.Stroke     = Brushes.DimGray;
            flytimelabel.Foreground = Brushes.White;
            flytimelabel.FontSize   = 14;
            flytimelabel.FontWeight = FontWeights.Bold;
            flytimelabel.Text       = new TimeSpan(FlyTime).ToString(@"hh\:mm\:ss");
            Canvas.SetLeft(flytimelabel, -80);
            Canvas.SetTop(flytimelabel, -110);
            Canvas_ViewPortRight.Children.Add(flytimelabel);
        }