コード例 #1
0
        private void UpdateLargeTile(DeliciousDrink drink)
        {
            // get the XML...
            var xml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImageAndText01);

            // replace the contents of 'text'...
            var tile = xml.SelectSingleNode("//tile");
            var text = tile.SelectSingleNode("//text");

            text.InnerText = drink.ToString();

            // put an image in...
            var image = tile.SelectSingleNode("//image");

            ImageIndex++;
            if (ImageIndex == 3)
            {
                ImageIndex = 0;
            }
            var url = string.Format("ms-appx:///Assets/Latte{0}.jpg", ImageIndex + 1);

            image.Attributes.GetNamedItem("src").NodeValue = url;

            // ask the OS to show it...
            var notification = new TileNotification(xml);

            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }
コード例 #2
0
        private void UpdateSmallTile(DeliciousDrink drink)
        {
            // get the XML...
            var xml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquareText04);

            // replace the contents of 'text'...
            var tile = xml.SelectSingleNode("//tile");
            var text = tile.SelectSingleNode("//text");

            text.InnerText = drink.ToString();

            // ask the OS to show it...
            var notification = new TileNotification(xml);

            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }
コード例 #3
0
        internal DeliciousDrink BrewMeAnything()
        {
            var rand = new Random();

            // create...
            var drink = new DeliciousDrink();
            drink.NumShots = rand.Next(1, 4);
            drink.Decaf = PickBool(rand);
            drink.Wet = PickBool(rand);
            drink.ToGo = PickBool(rand);
            drink.Size = (DrinkSize)PickEnum(typeof(DrinkSize), rand);
            drink.Type = (DrinkType)PickEnum(typeof(DrinkType), rand);
            drink.Milk = (MilkType)PickEnum(typeof(MilkType), rand);
            drink.Sprinkles = (SprinkleType)PickEnum(typeof(SprinkleType), rand);

            // return...
            return drink;
        }
コード例 #4
0
        internal DeliciousDrink BrewMeAnything()
        {
            var rand = new Random();

            // create...
            var drink = new DeliciousDrink();

            drink.NumShots  = rand.Next(1, 4);
            drink.Decaf     = PickBool(rand);
            drink.Wet       = PickBool(rand);
            drink.ToGo      = PickBool(rand);
            drink.Size      = (DrinkSize)PickEnum(typeof(DrinkSize), rand);
            drink.Type      = (DrinkType)PickEnum(typeof(DrinkType), rand);
            drink.Milk      = (MilkType)PickEnum(typeof(MilkType), rand);
            drink.Sprinkles = (SprinkleType)PickEnum(typeof(SprinkleType), rand);

            // return...
            return(drink);
        }
コード例 #5
0
        private void UpdateLargeTile(DeliciousDrink drink)
        {
            // get the XML...
            var xml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImageAndText01);

            // replace the contents of 'text'...
            var tile = xml.SelectSingleNode("//tile");
            var text = tile.SelectSingleNode("//text");
            text.InnerText = drink.ToString();

            // put an image in...
            var image = tile.SelectSingleNode("//image");
            ImageIndex++;
            if (ImageIndex == 3)
                ImageIndex = 0;
            var url = string.Format("ms-appx:///Assets/Latte{0}.jpg", ImageIndex + 1);
            image.Attributes.GetNamedItem("src").NodeValue = url;

            // ask the OS to show it...
            var notification = new TileNotification(xml);
            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }
コード例 #6
0
        private void UpdateSmallTile(DeliciousDrink drink)
        {
            // get the XML...
            var xml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquareText04);

            // replace the contents of 'text'...
            var tile = xml.SelectSingleNode("//tile");
            var text = tile.SelectSingleNode("//text");
            text.InnerText = drink.ToString();

            // ask the OS to show it...
            var notification = new TileNotification(xml);
            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }