public MainPage()
        {
            this.InitializeComponent();
            DisplayProperties.OrientationChanged += Orientation;

            BQ = new BlueQueenCore(@"http://usafeapi.bluequeen.tk", "v1", "token");
            CultureInfo culture = new CultureInfo("en-US");

            WeatherData  = BQ.getWeatherData(fromDate: DateTime.Now.ToString("d", culture));
            PressureData = BQ.getPressureData(fromDate: DateTime.Now.ToString("d", culture));

            //var test = WeatherData;
            fillTextBlock();

            //tile
            var tileXml   = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150PeekImageAndText01);
            var tileImage = tileXml.GetElementsByTagName("image")[0] as XmlElement;

            tileImage.SetAttribute("src", "ms-appx:///Assets/Square71x71Logo.scale-100.png");

            var          tileText  = tileXml.GetElementsByTagName("text");
            WeatherInfo  lastTemp  = WeatherData.Last(x => x.ID > 0);
            PressureInfo lastPress = PressureData.Last(x => x.ID > 0);

            (tileText[0] as XmlElement).InnerText = "Wejherowo";
            (tileText[1] as XmlElement).InnerText = lastTemp.Date.ToString();
            (tileText[2] as XmlElement).InnerText = string.Format("{0}°C", lastTemp.Value.ToString());
            (tileText[3] as XmlElement).InnerText = string.Format("{0} hPa", lastPress.Pressure.ToString());
            var tileNotification = new TileNotification(tileXml);

            TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
            // eoTile
        }
Ejemplo n.º 2
0
        private string GetPressureUnitString(PressureInfo pressureInfo)
        {
            switch (pressureInfo.Unit)
            {
            case PressureInfo.eUnit.hPa:
                return(R.HPA);

            case PressureInfo.eUnit.mmHq:
                return(R.MMHQ);

            default:
                throw new NotSupportedException();
            }
        }
Ejemplo n.º 3
0
        private static string Get(PressureInfo pressureInfo)
        {
            StringBuilder ret = new StringBuilder();

            ret.Append(R.Pressure + R.Colon + R.Space);

            if (pressureInfo.Unit == PressureInfo.eUnit.hPa)
            {
                ret.Append(pressureInfo.QNH + R.hPa);
            }
            else
            {
                ret.Append(pressureInfo.mmHq + R.mmHq);
            }

            ret.Append(R.Dot);

            return(ret.ToString());
        }
Ejemplo n.º 4
0
 private void FileOpen_Click(object sender, RoutedEventArgs e)
 {
     WF.OpenFileDialog openFile = new WF.OpenFileDialog();
     openFile.Filter = @"CSV文件(*.csv)|*.csv";
     if (openFile.ShowDialog() == WF.DialogResult.OK)
     {
         pressureInfo = new PressureInfo(openFile.FileName);
         pressureInfo.GetPressure();
         pressureInfo.GetMaxValue(out mArea, out mPressure, out mMaxPressure);
         label1.Content = "帧数:" + pressureInfo.allFrames.Count.ToString() + ",步数:" + pressureInfo.backFrames.Count.ToString();
         canvas1.Children.Clear();
         canvas3.Children.Clear();
         canvas4.Children.Clear();
         UnFillPixelGrid();
         timer.Stop();
         currentFrame = 0;
         int frameCount = pressureInfo.allFrames.Count - 1;
         axisWidth = ((frameCount % 5 == 0) ? frameCount : ((frameCount / 5 + 1) * 5)) * 6;
         DrawAxis(axisWidth);
         //DrawPixelGrid();
         FillPixelGrid(0);
         DrawPressureCurve(type);
     }
 }
Ejemplo n.º 5
0
 private string GetPressureString(PressureInfo pressureInfo)
 {
     return(pressureInfo.QNH.ToString("0"));
 }
Ejemplo n.º 6
0
        /// <summary>
        /// The descendant's implementation of the decoding function.
        /// </summary>
        /// <param name="source">Source string to decode.</param>
        /// <returns></returns>
        protected override Metar _Decode(string source)
        {
            Metar  ret = new Metar();
            string p   = source;

            ret.Type = new MetarPrefixDecoder().Decode(ref p);

            ret.IsCorrected = new CORDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.ICAO = new ICAOWithNumbersDecoder().Decode(ref p);

            ret.Date = new DayHourMinuteDecoder().Decode(ref p);

            ret.IsMissing = new NILDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.IsAUTO = new AUTODecoder()
            {
                Required = false
            }.Decode(ref p);

            var wind = new WindWithVariabilityDecoder()
            {
                Required = false
            }.Decode(ref p);

            if (wind == null)
            {
                wind = new WindWithVariability();
            }
            ret.Wind = wind;

            var visib = new VisibilityForMetarDecoder()
            {
                Required = false
            }.Decode(ref p);

            if (visib == null)
            {
                visib = new VisibilityForMetar();
            }
            ret.Visibility         = visib;
            ret.Visibility.Runways =
                new RunwayVisibilityListDecoder()
            {
                Required = false
            }.Decode(ref p);

            var phenomens = new PhenomInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            if (phenomens == null)
            {
                phenomens = new Types.PhenomInfo();
            }
            ret.Phenomens = phenomens;

            ret.Clouds = new CloudInfoWithNCDDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.Temperature = new TemperatureDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.DewPoint = new DewPointDecoder()
            {
                Required = false
            }.Decode(ref p);

            PressureInfo pi = new PressureInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            if (pi == null)
            {
                pi = new PressureInfo()
                {
                    QNH = 1013
                }
            }
            ;
            ret.Pressure = pi;

            ret.RePhenomens = new RePhenomInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.WindShears = new WindShearInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.SeaSurfaceTemperature = new SeaSurfaceTemperatureDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.SeaState = new SeaStateDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.RunwayConditions = new RunwayConditionInfoDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.Trend = new TrendInfoForMetarDecoder()
            {
                Required = false
            }.Decode(ref p);

            ret.Remark = new RemarkDecoder()
            {
                Required = false
            }.Decode(ref p);

            return(ret);
        }
    }