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
        }
Esempio n. 2
0
        private void test(object sender, EventArgs e)
        {
            CultureInfo culture = new CultureInfo("en-US");

            WeatherData  = BQ.getWeatherData(fromDate: DateTime.Now.ToString("d", culture));
            PressureData = BQ.getPressureData(fromDate: DateTime.Now.ToString("d", culture));
            fillTextboxes();
            Toast toast = Toast.MakeText(this, "Successfully updated", ToastLength.Short);

            toast.Show();
        }
        public Lnadscape()
        {
            this.InitializeComponent();
            DisplayProperties.OrientationChanged += Orientation;
            this.NavigationCacheMode              = NavigationCacheMode.Required;
            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));
            TempChart();
        }
Esempio n. 4
0
        public RemoteViews buildUpdate(Context context)
        {
            var         BQ          = new BlueQueenCore(@"http://usafeapi.bluequeen.tk", "v1", "token");
            CultureInfo culture     = new CultureInfo("en-US");
            var         WeatherData = BQ.getWeatherData(fromDate: DateTime.Now.ToString("d", culture));
            var         entry       = WeatherData.FindLast(x => x.ID > 0);

            var PressureData = BQ.getPressureData(fromDate: DateTime.Now.ToString("d", culture));
            var entry2       = PressureData.FindLast(x => x.ID > 0);

            // Build an update that holds the updated widget contents
            var updateViews = new RemoteViews(context.PackageName, Resource.Layout.widget_word);

            updateViews.SetTextViewText(Resource.Id.blog_title, entry.Date.ToLongDateString() + " " + entry.Date.ToLongTimeString());
            updateViews.SetTextViewText(Resource.Id.creator, "Wejherowo | " + entry.Value.ToString() + "°C | " + entry2.Pressure.ToString() + " hPa");

            return(updateViews);
        }