Exemple #1
0
        private async void InitApp()
        {
            /* JS websites/webapps do not update when run through webview which is currently an issue - you just get a static page */
            UIwebview.Navigate(new Uri("http://beats.azurewebsites.net/"));
            
            bpm = await GetHeartRate();

            TileService.SetBadgeCountOnTile(bpm);
            UpdatePrimaryTile(new PrimaryTile());

            while (true)
            {
                bpm = await GetHeartRate();

                // Fire notification on heart rate threshold exceeded
                if (bpm > 80)
                {
                    sendToastNotification("Woahh steady on horsey... you feeling ok?");
                    PrimaryTile tile = new PrimaryTile();
                    tile.message = "You're pumped!";
                    UpdatePrimaryTile(tile);
                }
                else if (bpm < 50)
                {
                    sendToastNotification("Wakey Wakey you Sloth!");
                    PrimaryTile tile = new PrimaryTile();
                    tile.message = "You may be dying?!";
                    UpdatePrimaryTile(tile);

                    TileService.SetBadgeCountOnTile(bpm);
                }
            }
           
        }
Exemple #2
0
        public static Windows.Data.Xml.Dom.XmlDocument CreateTiles(PrimaryTile primaryTile)
        {
            XDocument xDoc = new XDocument(
                new XElement("tile", new XAttribute("version", 3),
                    new XElement("visual",
                        // Small Tile
                        new XElement("binding", new XAttribute("branding", primaryTile.branding), new XAttribute("displayName", primaryTile.appName), new XAttribute("template", "TileSmall"),
                            new XElement("group",
                                new XElement("subgroup",
                                    new XElement("text", primaryTile.message, new XAttribute("hint-style", "captionsubtle"), new XAttribute("hint-wrap", true), new XAttribute("hint-maxLines", 3))
                                )
                            )
                        ),

                        // Medium Tile
                        new XElement("binding", new XAttribute("branding", primaryTile.branding), new XAttribute("displayName", primaryTile.appName), new XAttribute("template", "TileMedium"),
                            new XElement("group",
                                new XElement("subgroup",
                                    new XElement("text", primaryTile.message, new XAttribute("hint-style", "captionsubtle"), new XAttribute("hint-wrap", true), new XAttribute("hint-maxLines", 3))
                            )
                            )
                        ),

                        // Wide Tile
                        new XElement("binding", new XAttribute("branding", primaryTile.branding), new XAttribute("displayName", primaryTile.appName), new XAttribute("template", "TileWide"),
                            new XElement("group",
                                new XElement("subgroup",
                                    new XElement("text", primaryTile.message, new XAttribute("hint-style", "captionsubtle"), new XAttribute("hint-wrap", true), new XAttribute("hint-maxLines", 3))
                                    ),
                                new XElement("subgroup", new XAttribute("hint-weight", 15),
                                    new XElement("image", new XAttribute("placement", "inline"), new XAttribute("src", "Assets/StoreLogo.png"))
                                )
                            )
                        ),

                        //Large Tile
                        new XElement("binding", new XAttribute("branding", primaryTile.branding), new XAttribute("displayName", primaryTile.appName), new XAttribute("template", "TileLarge"),
                            new XElement("group",
                                new XElement("subgroup",
                                    new XElement("text", primaryTile.message, new XAttribute("hint-style", "captionsubtle"), new XAttribute("hint-wrap", true), new XAttribute("hint-maxLines", 3))                                    ),
                                new XElement("subgroup", new XAttribute("hint-weight", 15),
                                    new XElement("image", new XAttribute("placement", "inline"), new XAttribute("src", "Assets/StoreLogo.png"))
                                )
                            )
                        )
                    )
                )
            );

            Windows.Data.Xml.Dom.XmlDocument xmlDoc = new Windows.Data.Xml.Dom.XmlDocument();
            xmlDoc.LoadXml(xDoc.ToString());
            //Debug.WriteLine(xDoc);
            return xmlDoc;
        }
Exemple #3
0
        private void UpdatePrimaryTile(PrimaryTile tile)
        {
            var xmlDoc = TileService.CreateTiles(tile);

            var updater = TileUpdateManager.CreateTileUpdaterForApplication();
            var notification = new TileNotification(xmlDoc);
            updater.Update(notification);
        }