private static TileBinding CreateMediumTitleBinding(string caption, string subCaption)
        {
            var bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new AdaptiveText()
                    {
                        Text      = caption.Truncate(100),
                        HintStyle = AdaptiveTextStyle.Caption
                    },
                    new AdaptiveText()
                    {
                        Text      = subCaption,
                        HintWrap  = true,
                        HintStyle = AdaptiveTextStyle.CaptionSubtle
                    }
                }
            };

            return(new TileBinding()
            {
                Branding = TileBranding.NameAndLogo,
                Content = bindingContent
            });
        }
Beispiel #2
0
        private static TileBinding CreateMediumMusicTileBinding()
        {
            var bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new TileText()
                    {
                        Text  = Strings.NowPlaying,
                        Style = TileTextStyle.Body,
                    },
                    new TileText()
                    {
                        Text  = Locator.MusicPlayerVM.CurrentTrack.Name + " - " + Locator.MusicPlayerVM.CurrentTrack.ArtistName,
                        Wrap  = true,
                        Style = TileTextStyle.CaptionSubtle
                    }
                }
            };

            if (!string.IsNullOrEmpty(Locator.MusicPlayerVM.CurrentAlbum?.AlbumCoverFullUri))
            {
                bindingContent.PeekImage = new TilePeekImage()
                {
                    Source = Locator.MusicPlayerVM.CurrentAlbum.AlbumCoverFullUri
                };
            }

            return(new TileBinding()
            {
                Branding = TileBranding.Logo,
                Content = bindingContent
            });
        }
Beispiel #3
0
        private static TileBinding CreateMediumVideoTileBinding()
        {
            var bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new TileText()
                    {
                        Text  = Strings.NowPlaying,
                        Style = TileTextStyle.Body,
                    },
                    new TileText()
                    {
                        Text  = Locator.VideoPlayerVm.CurrentVideo.Name,
                        Wrap  = true,
                        Style = TileTextStyle.CaptionSubtle
                    }
                }
            };

            if (!string.IsNullOrEmpty(Locator.VideoPlayerVm.CurrentVideo.PictureUri))
            {
                bindingContent.PeekImage = new TilePeekImage()
                {
                    Source = Locator.VideoPlayerVm.CurrentVideo.PictureUri
                };
            }

            return(new TileBinding()
            {
                Branding = TileBranding.Logo,
                Content = bindingContent
            });
        }
Beispiel #4
0
        public static void UpdateTile(TileBindingContentAdaptive tileContent, int tileStyle)
        {
            //  tileStyle == 0  ->  中磁贴
            //  tileStyle == 1  ->  宽磁贴
            TileContent content;

            if (tileStyle == 0)
            {
                content = new TileContent()
                {
                    Visual = new TileVisual()
                    {
                        TileMedium = new TileBinding()
                        {
                            Content = tileContent
                        }
                    }
                };
            }
            else
            {
                content = new TileContent()
                {
                    Visual = new TileVisual()
                    {
                        TileWide = new TileBinding()
                        {
                            Content = tileContent
                        }
                    }
                };
            }
            TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(content.GetXml()));
        }
Beispiel #5
0
        private static void ShowToast()
        {
            TileBindingContentAdaptive bindingContent = new TileBindingContentAdaptive()
            {
                PeekImage = new TilePeekImage()
                {
                    Source = "Assets/PeekImage.jpg"
                },

                Children =
                {
                    new AdaptiveText()
                    {
                        Text      = "Notifications library",
                        HintStyle = AdaptiveTextStyle.Body
                    },

                    new AdaptiveText()
                    {
                        Text      = "Generate notifications easily!",
                        HintWrap  = true,
                        HintStyle = AdaptiveTextStyle.CaptionSubtle
                    }
                }
            };
        }
Beispiel #6
0
        private static TileBinding GetBindingLargeContent(string income, string spending, string earnings)
        {
            var content = new TileBindingContentAdaptive {
                PeekImage = new TilePeekImage {
                    Source = "Assets/Square310x310Logo.scale-400.png"
                },
                Children =
                {
                    new AdaptiveText {
                        Text      = income,
                        HintStyle = AdaptiveTextStyle.CaptionSubtle
                    },
                    new AdaptiveText {
                        Text      = spending,
                        HintStyle = AdaptiveTextStyle.CaptionSubtle
                    },
                    new AdaptiveText {
                        Text      = earnings,
                        HintWrap  = true,
                        HintStyle = AdaptiveTextStyle.Body
                    }
                }
            };

            return(new TileBinding {
                Branding = TileBranding.NameAndLogo,
                DisplayName = Strings.ApplicationTitle,
                Content = content
            });
        }
Beispiel #7
0
        private static TileBinding GenerateImageTileBinding(Uri imageUrl, string text = default, bool isLarge = false, string desc = default)
        {
            var ctx = new TileBindingContentAdaptive()
            {
                PeekImage = new TilePeekImage()
                {
                    Source = imageUrl != null ? imageUrl.OriginalString : ""
                },
                TextStacking = (isLarge && desc.IsValid()) ? TileTextStacking.Top : TileTextStacking.Bottom
            };
            AdaptiveTextStyle ats = isLarge ? AdaptiveTextStyle.Caption : AdaptiveTextStyle.CaptionSubtle;

            ctx.Children.Add(new AdaptiveText()
            {
                Text = text.Trim(), HintMaxLines = 2, HintStyle = ats
            });
            if (isLarge && desc.IsValid())
            {
                ctx.Children.Add(new AdaptiveText()
                {
                    Text = desc.Trim().FromHtmlToText(), HintMaxLines = 5, HintWrap = true, HintStyle = AdaptiveTextStyle.CaptionSubtle
                });
            }
            return(new TileBinding()
            {
                Content = ctx
            });
        }
        private async void UpdateMedium(TileBindingContentAdaptive mediumContent)
        {
            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Content = mediumContent
                    }
                }
            };

            try
            {
                TileUpdateManager.CreateTileUpdaterForSecondaryTile("SecondaryTile").Update(new TileNotification(content.GetXml()));
            }

            catch
            {
                SecondaryTile tile = new SecondaryTile("SecondaryTile", "Example", "args", new Uri("ms-appx:///Assets/Logo.png"), TileSize.Default);
                tile.VisualElements.ShowNameOnSquare150x150Logo = true;
                tile.VisualElements.ShowNameOnSquare310x310Logo = true;
                tile.VisualElements.ShowNameOnWide310x150Logo   = true;
                tile.VisualElements.BackgroundColor             = Colors.Transparent;
                await tile.RequestCreateAsync();

                TileUpdateManager.CreateTileUpdaterForSecondaryTile("SecondaryTile").Update(new TileNotification(content.GetXml()));
            }
        }
        public static void CreateRecentActvityLiveTile(Feed feed)
        {
            TileBindingContentAdaptive bindingContent;

            if (feed.SmallImageUrl != null)
            {
                bindingContent = new TileBindingContentAdaptive()
                {
                    PeekImage = new TilePeekImage()
                    {
                        Crop    = TileImageCrop.None,
                        Overlay = 0,
                        Source  =
                            new TileImageSource(feed.SmallImageUrl)
                    },
                    Children =
                    {
                        new TileText()
                        {
                            Text  = feed.Caption,
                            Wrap  = true,
                            Style = TileTextStyle.Body
                        }
                    }
                };
            }
            else
            {
                bindingContent = new TileBindingContentAdaptive()
                {
                    Children =
                    {
                        new TileText()
                        {
                            Text  = feed.Caption,
                            Wrap  = true,
                            Style = TileTextStyle.Body
                        }
                    }
                };
            }
            var binding = new TileBinding()
            {
                Branding = TileBranding.NameAndLogo,
                Content  = bindingContent
            };
            var content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = binding,
                    TileWide   = binding,
                    TileLarge  = binding
                }
            };
            var tileXml          = content.GetXml();
            var tileNotification = new TileNotification(tileXml);

            TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
        }
Beispiel #10
0
        private TileContent BuildLiveTile(List <ResponsiveNotificationText> messages)
        {
            var results  = messages.ElementAt(0);
            var fixtures = messages.ElementAt(1);

            if (!results.Matches.Any() && !fixtures.Matches.Any())
            {
                return(null);
            }

            TileVisual root = new TileVisual();

            TileBinding wideBinding = new TileBinding();
            TileBindingContentAdaptive wideBindingContent = new TileBindingContentAdaptive();

            wideBinding.Content = wideBindingContent;

            TileBinding largeBinding = new TileBinding();
            TileBindingContentAdaptive largeBindingContent = new TileBindingContentAdaptive();

            largeBinding.Content = largeBindingContent;

            foreach (var notificationGroup in messages)
            {
                if (notificationGroup.Matches.Any())
                {
                    var group    = new AdaptiveGroup();
                    var subgroup = new AdaptiveSubgroup()
                    {
                        HintTextStacking = AdaptiveSubgroupTextStacking.Center
                    };
                    subgroup.Children.Add(new AdaptiveText()
                    {
                        Text      = notificationGroup.MatchType,
                        HintStyle = AdaptiveTextStyle.Body
                    });
                    foreach (var match in notificationGroup.Matches)
                    {
                        subgroup.Children.Add(new AdaptiveText()
                        {
                            Text      = match,
                            HintStyle = AdaptiveTextStyle.Caption
                        });
                    }
                    group.Children.Add(subgroup);
                    wideBindingContent.Children.Add(group);
                    largeBindingContent.Children.Add(group);
                }
            }
            root.TileLarge = largeBinding;
            root.TileWide  = wideBinding;

            return(new TileContent()
            {
                Visual = root
            });
        }
Beispiel #11
0
        private async void HomeView_Loaded(object sender, RoutedEventArgs e)
        {
            // Get the card information from the website frontend
            var    response = await new System.Net.Http.HttpClient().GetAsync("https://raw.githubusercontent.com/UWPCommunity/uwpcommunity.github.io/master/assets/views/home.json");
            string json     = await response.Content.ReadAsStringAsync();

            var card = Newtonsoft.Json.JsonConvert.DeserializeObject <CardInfoResponse>(json).Main;

            CardSubtitle.Text = card.Subtitle;
            CardDetails.Text  = String.Join(" ", card.Details);

            // Update live tile
            TileBindingContentAdaptive text = new TileBindingContentAdaptive
            {
                Children =
                {
                    new AdaptiveText()
                    {
                        Text     = CardSubtitle.Text,
                        HintWrap = true,
                    },
                    new AdaptiveText()
                    {
                        Text      = CardDetails.Text,
                        HintStyle = AdaptiveTextStyle.CaptionSubtle,
                        HintWrap  = true
                    }
                }
            };
            var tileContent = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Branding = TileBranding.Logo,
                        Content  = text
                    },
                    TileWide = new TileBinding()
                    {
                        Branding = TileBranding.NameAndLogo,
                        Content  = text
                    },
                    TileLarge = new TileBinding()
                    {
                        Branding = TileBranding.NameAndLogo,
                        Content  = text
                    }
                }
            };
            var notification = new TileNotification(tileContent.GetXml());

            TileUpdateManager.CreateTileUpdaterForApplication().Clear();
            TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }
Beispiel #12
0
        private static TileBinding CreateLargeVideoTileBinding()
        {
            var bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new TileGroup()
                    {
                        Children =
                        {
                            new TileSubgroup()
                            {
                                Weight = 1
                            },
                            new TileSubgroup()
                            {
                                Weight = 2,
                            },
                            new TileSubgroup()
                            {
                                Weight = 1
                            }
                        }
                    },
                    new TileText()
                    {
                        Text  = Strings.NowPlaying,
                        Style = TileTextStyle.Title,
                        Align = TileTextAlign.Center
                    },
                    new TileText()
                    {
                        Text  = Locator.VideoPlayerVm.CurrentVideo.Name,
                        Wrap  = true,
                        Style = TileTextStyle.SubtitleSubtle,
                        Align = TileTextAlign.Center
                    }
                }
            };

            if (!string.IsNullOrEmpty(Locator.VideoPlayerVm.CurrentVideo.PictureUri))
            {
                bindingContent.PeekImage = new TilePeekImage()
                {
                    Source = Locator.VideoPlayerVm.CurrentVideo.PictureUri
                };
            }

            return(new TileBinding()
            {
                Branding = TileBranding.NameAndLogo,
                Content = bindingContent
            });
        }
        private static TileBinding CreateTileNotificationMediumBinding(DataItemTask[] tasks, DateTimeOffset now)
        {
            var content = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new AdaptiveGroup()
                    {
                        Children =
                        {
                            new AdaptiveSubgroup()
                            {
                                HintWeight = 22,
                                Children   =
                                {
                                    new AdaptiveText()
                                    {
                                        Text      = tasks.Length.ToString(),
                                        HintStyle = AdaptiveTextStyle.SubheaderNumeral
                                    }
                                }
                            },

                            new AdaptiveSubgroup()
                            {
                                HintWeight = 78,
                                Children   =
                                {
                                    new AdaptiveText()
                                    {
                                        Text     = RelativeTimeFromNow(tasks[0].StartTime, now),
                                        HintWrap = true
                                    }
                                }
                            }
                        }
                    }
                }
            };

            foreach (var t in tasks)
            {
                content.Children.Add(new AdaptiveText()
                {
                    Text      = t.Title,
                    HintStyle = AdaptiveTextStyle.CaptionSubtle
                });
            }

            return(new TileBinding()
            {
                Content = content
            });
        }
Beispiel #14
0
        private async void Pin()
        {
            if (this.Group == null)
            {
                return;
            }

            string tileID   = $"Tile_Group_{this.GroupID}";
            string argument = $"GroupDetail-{this.GroupID}";

            SecondaryTile tile = new SecondaryTile(tileID, this.Group.Name, argument, new Uri("ms-appx:///Assets/logo-50.png"), TileSize.Square150x150);
            await tile.RequestCreateAsync();

            TileBindingContentAdaptive bindingContent = new TileBindingContentAdaptive()
            {
                PeekImage = new TilePeekImage()
                {
                    Source = new TileImageSource(this.Group.LargeAvatar)
                }
            };

            bindingContent.Children.Add(new TileText
            {
                Text  = this.Group.Name,
                Wrap  = true,
                Style = TileTextStyle.Body
            });

            TileBinding binding = new TileBinding()
            {
                Branding    = TileBranding.NameAndLogo,
                DisplayName = this.Group.Name,
                Content     = bindingContent
            };

            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = binding,
                    TileWide   = binding,
                    TileLarge  = binding
                }
            };

            var notification = new TileNotification(content.GetXml());

            var updater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileID);

            updater.Update(notification);

            bool result = await tile.UpdateAsync();
        }
Beispiel #15
0
        internal async void CreateTileAsync()
        {
            secondaryTile = new SecondaryTile(
                "tilePage",
                main.Files.Last().Name,
                "displayname",
                new Uri("ms-appx:///Assets/StoreLogo.png", UriKind.Absolute),
                TileSize.Default);
            var success = await secondaryTile.RequestCreateAsync();

            if (success)
            {
                var tileBindingContentAdaptive = new TileBindingContentAdaptive
                {
                    Children =
                    {
                        new AdaptiveText()
                        {
                            Text      = main.Files.Last().Name,
                            HintStyle = AdaptiveTextStyle.Base,
                            HintWrap  = true
                        },

                        new AdaptiveText()
                        {
                            Text      = main.Files.Last().FileSize,
                            HintStyle = AdaptiveTextStyle.CaptionSubtle
                        }
                    }
                };
                var tileBinding = new TileBinding
                {
                    Branding    = TileBranding.Name,
                    Content     = tileBindingContentAdaptive,
                    DisplayName = main.Files.Last().FileSize
                };

                var tileContent = new TileContent
                {
                    Visual = new TileVisual
                    {
                        TileMedium = tileBinding,
                        TileWide   = tileBinding,
                        TileLarge  = tileBinding
                    }
                };

                var xmlDoc = tileContent.GetXml();
                tileNotification = new TileNotification(xmlDoc);
                var tileUpdaterForSecondaryTile = TileUpdateManager.CreateTileUpdaterForSecondaryTile("tilePage");
                tileUpdaterForSecondaryTile.Update(tileNotification);
            }
        }
Beispiel #16
0
        private static TileBinding CreateLargeTitleBinding(string imageUrl, string caption, string subCaption)
        {
            var bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new AdaptiveGroup()
                    {
                        Children =
                        {
                            new AdaptiveSubgroup()
                            {
                                HintWeight = 33,
                                Children   =
                                {
                                    new AdaptiveImage()
                                    {
                                        Source   = imageUrl,
                                        HintCrop = AdaptiveImageCrop.Circle
                                    }
                                }
                            },
                            new AdaptiveSubgroup()
                            {
                                Children =
                                {
                                    new AdaptiveText()
                                    {
                                        Text      = caption.Truncate(100),
                                        HintStyle = AdaptiveTextStyle.Caption
                                    },
                                    new AdaptiveText()
                                    {
                                        Text      = subCaption,
                                        HintWrap  = true,
                                        HintStyle = AdaptiveTextStyle.CaptionSubtle
                                    }
                                }
                            }
                        }
                    }
                }
            };

            return(new TileBinding()
            {
                Branding = TileBranding.NameAndLogo,
                Content = bindingContent
            });
        }
Beispiel #17
0
        private TileBinding GetTile(List <ScheduleEntryViewModel> schedule, TileSize size)
        {
            var content = new TileBindingContentAdaptive();

            content.Children.Add(GetAdaptiveGroup(schedule.First(), size, false, true));
            foreach (ScheduleEntryViewModel entry in schedule.Skip(1))
            {
                content.Children.Add(GetAdaptiveGroup(entry, size, true, false));
            }
            return(new TileBinding()
            {
                Content = content
            });
        }
Beispiel #18
0
        public void UpdateLiveTileForText(string title, string subtitle, string body)
        {
            var bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new TileText()
                    {
                        Text  = title,
                        Style = TileTextStyle.Body
                    },

                    new TileText()
                    {
                        Text  = subtitle,
                        Style = TileTextStyle.BodySubtle
                    },

                    new TileText()
                    {
                        Text  = body,
                        Style = TileTextStyle.Caption
                    }
                }
            };
            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Content = bindingContent
                    },

                    TileWide = new TileBinding()
                    {
                        Content = bindingContent
                    },

                    TileLarge = new TileBinding()
                    {
                        Content = bindingContent
                    },
                    Branding = TileBranding.NameAndLogo
                },
            };
            var xml = content.GetXml();

            TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(xml));
        }
Beispiel #19
0
        private void Button_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var dining         = App.MainViewModel.HfsData.resident_dining;
            var term           = App.MainViewModel.TermInfo;
            var bindingContent = new TileBindingContentAdaptive();
            var items          = bindingContent.Children;

            items.Add(new TileText()
            {
                Text  = $"Balance: ${dining.balance:0.00}",
                Style = TileTextStyle.Body
            });

            items.Add(new TileText()
            {
                Text  = $"Days: {term.FullDaysRemaining}",
                Style = TileTextStyle.Caption
            });

            items.Add(new TileText()
            {
                Text  = $"Avg/Day: ${dining.balance/term.FullDaysRemaining:0.00}",
                Style = TileTextStyle.Caption
            });

            var tileBinding = new TileBinding();

            tileBinding.Content     = bindingContent;
            tileBinding.DisplayName = "FoodTile";
            tileBinding.Branding    = TileBranding.NameAndLogo;

            var content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileSmall  = tileBinding,
                    TileMedium = tileBinding,
                    TileWide   = tileBinding,
                    TileLarge  = tileBinding
                }
            };

            XmlDocument doc = content.GetXml();

            var note    = new TileNotification(doc);
            var updater = TileUpdateManager.CreateTileUpdaterForApplication();

            updater.Update(note);
        }
        private static TileBindingContentAdaptive GenerateGenericHolidayContent(IEnumerable <ViewItemHoliday> holidays, DateTime date)
        {
            var answer = new TileBindingContentAdaptive();

            foreach (var h in holidays.Take(3))
            {
                answer.Children.Add(new AdaptiveText()
                {
                    Text     = TrimString(h.Name, 180),
                    HintWrap = true
                });
            }

            return(answer);
        }
Beispiel #21
0
        /// <summary>
        /// Generates a <see cref="TileBindingContentAdaptive"/> for the wide size of image inside a local folder.
        /// </summary>
        /// <returns></returns>
        private static TileBinding GetImageBindingWide(string imageSet)
        {
            var content = new TileBindingContentAdaptive()
            {
                BackgroundImage = new TileBackgroundImage()
                {
                    Source = imageSet + "/Wide310x150Logo.png"
                }
            };

            return(new TileBinding()
            {
                Content = content
            });
        }
Beispiel #22
0
        /// <summary>
        /// Generates a <see cref="TileBindingContentAdaptive"/> for the small size of image inside a local folder.
        /// </summary>
        /// <returns></returns>
        private static TileBinding GetImageBindingSmall(string imageSet)
        {
            var content = new TileBindingContentAdaptive()
            {
                BackgroundImage = new TileBackgroundImage()
                {
                    Source = imageSet + "/Square71x71Logo.png"
                }
            };

            return(new TileBinding()
            {
                Content = content
            });
        }
Beispiel #23
0
        private void ButtonSendTileNotification_Click(object sender, RoutedEventArgs e)
        {
            TileBindingContentAdaptive bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    GenerateEmailGroup("Jennifer Parker", "Photos from our trip"),
                    GenerateEmailGroup("Steve Bosniak",   "Want to go out for dinner after Build tonight?")
                }
            };

            TileBinding binding = new TileBinding()
            {
                Content = bindingContent
            };


            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = binding
                }
            };


            DataPackage dp = new DataPackage();

            dp.SetText(content.GetContent());
            Clipboard.SetContent(dp);
            return;


            string           xmlAsString  = content.GetContent();
            TileNotification notification = new TileNotification(content.GetXml());

            content.Visual.TileMedium = new TileBinding()
            {
                Branding = TileBranding.Logo,

                Content = new TileBindingContentAdaptive()
            };

            ComboBox comboBox = new ComboBox();
            //var tileContent = NotificationsExtensions.GenerateTileContent();
            //TileNotification notif = new TileNotification(null);
            //ITileSquareText01 tileContent = TileContentFactory.CreateTileSquareText01();
        }
        public HomeView()
        {
            this.InitializeComponent();

            TileBindingContentAdaptive text = new TileBindingContentAdaptive
            {
                Children =
                {
                    new AdaptiveText()
                    {
                        Text     = "Launch 2020",
                        HintWrap = true,
                    },
                    new AdaptiveText()
                    {
                        Text      = "The UWP Community is nearing its annual Launch event",
                        HintStyle = AdaptiveTextStyle.CaptionSubtle,
                        HintWrap  = true
                    }
                }
            };
            var tileContent = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Branding = TileBranding.Logo,
                        Content  = text
                    },
                    TileWide = new TileBinding()
                    {
                        Branding = TileBranding.NameAndLogo,
                        Content  = text
                    },
                    TileLarge = new TileBinding()
                    {
                        Branding = TileBranding.NameAndLogo,
                        Content  = text
                    }
                }
            };
            var notification = new TileNotification(tileContent.GetXml());

            TileUpdateManager.CreateTileUpdaterForApplication().Clear();
            TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }
        private static TileBindingContentAdaptive GenerateTileNotificationMediumContent(IEnumerable <ViewItemSchedule> schedules)
        {
            TileBindingContentAdaptive content = new TileBindingContentAdaptive();

            for (int i = 0; i < schedules.Count() && i < 2; i++)
            {
                if (i != 0)
                {
                    // Incorporate spacing between items
                    content.Children.Add(new AdaptiveText());
                }

                content.Children.Add(GenerateTileNotificationMediumGroupContent(schedules.ElementAt(i)));
            }

            return(content);
        }
Beispiel #26
0
        public static void CreateBookmarkLiveTile(ForumThreadEntity forumThread)
        {
            var bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new TileText()
                    {
                        Text  = forumThread.Name,
                        Style = TileTextStyle.Body
                    },
                    new TileText()
                    {
                        Text  = string.Format("Unread Posts: {0}", forumThread.RepliesSinceLastOpened),
                        Wrap  = true,
                        Style = TileTextStyle.CaptionSubtle
                    },
                    new TileText()
                    {
                        Text  = string.Format("Killed By: {0}", forumThread.KilledBy),
                        Wrap  = true,
                        Style = TileTextStyle.CaptionSubtle
                    }
                }
            };
            var binding = new TileBinding()
            {
                Branding = TileBranding.NameAndLogo,
                Content  = bindingContent
            };
            var content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = binding,
                    TileWide   = binding,
                    TileLarge  = binding
                }
            };
            var tileXml          = content.GetXml();
            var tileNotification = new TileNotification(tileXml);

            TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
        }
        private static TileBindingContentAdaptive CreateTileContent(string prefix, string leftTitle, string leftValue, string rightTitle, string rightValuevalue, string dateTitle, string dateContent)
        {
            //Create a TileContent
            var tileContent = new TileBindingContentAdaptive();

            tileContent.TextStacking = TileTextStacking.Center;
            //Create a groups and subgroups
            var tileGroup = new AdaptiveGroup();

            AdaptiveSubgroup columnGroupLeft   = CreateAdaptiveGroupColumn(prefix + " " + leftTitle, leftValue, dateTitle);
            AdaptiveSubgroup CoulumnGroupRight = CreateAdaptiveGroupColumn(prefix + " " + rightTitle, rightValuevalue, dateContent);

            tileGroup.Children.Add(columnGroupLeft);
            tileGroup.Children.Add(CoulumnGroupRight);


            tileContent.Children.Add(tileGroup);
            return(tileContent);
        }
        private static TileBindingContentAdaptive CreateLargeAdaptiveTextContent(string text)
        {
            TileBindingContentAdaptive bindingContent = new TileBindingContentAdaptive()
            {
                Children =
                {
                    new TileText()
                    {
                        Text  = text,
                        Style = TileTextStyle.Subheader,
                        Wrap  = true,
                        Align = TileTextAlign.Center,
                    },
                },
                TextStacking = TileTextStacking.Center,
            };

            return(bindingContent);
        }
        private static TileBindingContentAdaptive GenerateTileNotificationLargeContent(IEnumerable <ViewItemSchedule> schedules)
        {
            const int max = 4;

            TileBindingContentAdaptive content = new TileBindingContentAdaptive();

            for (int i = 0; i < schedules.Count() && i < max; i++)
            {
                // Add spacer
                if (content.Children.Count > 0)
                {
                    content.Children.Add(new AdaptiveText());
                }

                content.Children.Add(GenerateTileNotificationWideAndLargeGroupContent(schedules.ElementAt(i)));
            }

            return(content);
        }
Beispiel #30
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            var bindingContent = new TileBindingContentAdaptive
            {
                PeekImage = new TilePeekImage
                {
                    Source = new TileImageSource("Assets/Square150x150Logo.png")
                },
                Children =
                {
                    new TileText {
                        Text = "Hello world", Style = TileTextStyle.Title
                    },
                    new TileText {
                        Text = "okazuki", Style = TileTextStyle.Body
                    },
                }
            };

            var tileBinding = new TileBinding
            {
                Branding    = TileBranding.NameAndLogo,
                Content     = bindingContent,
                DisplayName = "Hello display name",
            };

            var content = new TileContent
            {
                Visual = new TileVisual
                {
                    TileSmall  = tileBinding,
                    TileMedium = tileBinding,
                    TileLarge  = tileBinding,
                    TileWide   = tileBinding,
                }
            };

            var n = new TileNotification(content.GetXml());

            TileUpdateManager.CreateTileUpdaterForApplication()
            .Update(n);
        }