private void AddDayElement(List <ScrollViewer> allViews, CalendarEvent e, bool prependTime = false) { var parsedEmoji = EmojiParser.GetCodepoints(e.Name); var strippedName = string.Join("", parsedEmoji.SourceSplit); if (!_dateAndListViewNumbers.Contains(e.StartDate.Date)) { return; } var list = allViews[_dateAndListViewNumbers.IndexOf(e.StartDate.Date)]?.Content as ListView; list?.Items?.Add(new CalendarListItemViewModel { EventId = e.Id, Name = prependTime ? $"{e.StartDate:hh:mm} - {strippedName}" : strippedName, IconUrl = parsedEmoji.Codepoints.Any() ? $"Assets\\{parsedEmoji.Codepoints.First()}.png" : "Assets\\1f4c5.png" });
private void Page_Loaded(object sender, RoutedEventArgs e) { var _compositor = GetVisual(MainGrid).Compositor; var animation = _compositor.CreateVector3KeyFrameAnimation(); animation.InsertKeyFrame(1.0f, new Vector3(200.0f, 200.0f, 0.0f)); animation.Duration = TimeSpan.FromSeconds(1); animation.Direction = Windows.UI.Composition.AnimationDirection.Alternate; animation.IterationBehavior = AnimationIterationBehavior.Forever; //Winston.StartAnimation("Offset", animation); var winstonBrush = _compositor.CreateSurfaceBrush(); var _loadedSurface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Assets/winston.png")); winstonBrush.Surface = _loadedSurface; var visual = _compositor.CreateSpriteVisual(); //visual.Brush = winstonBrush; visual.Brush = _compositor.CreateColorBrush(Color.FromArgb(255, 255, 0, 0)); visual.Size = new Vector2(200, 200); //Compositor _compositor; ContainerVisual _container; SpriteVisual _colorVisual1, _colorVisual2; CompositionColorBrush _blackBrush, _greenBrush; //_compositor = Window.Current.Compositor; _container = _compositor.CreateContainerVisual(); _blackBrush = _compositor.CreateColorBrush(Colors.Black); _colorVisual1 = _compositor.CreateSpriteVisual(); _colorVisual1.Brush = _blackBrush; _colorVisual1.Size = new Vector2(156, 156); _colorVisual1.Offset = new Vector3(0, 0, 0); _container.Children.InsertAtBottom(_colorVisual1); _greenBrush = _compositor.CreateColorBrush(Color.FromArgb(0xff, 0x9A, 0xCD, 0x32)); _colorVisual2 = _compositor.CreateSpriteVisual(); _colorVisual2.Brush = _greenBrush; _colorVisual2.Size = new Vector2(150, 150); _colorVisual2.Offset = new Vector3(3, 3, 0); _container.Children.InsertAtBottom(_colorVisual2); GetVisual(MainGrid).Clip = _compositor.CreateInsetClip(0, 0, 0, 0); //visual.StartAnimation("Offset", animation); // -------------------- // add all of the items... //var input = "Holy 🎈 if these are proper emojis, I'll be a curious 🦊!"; var input = "WE HAVE 🎨🖼 COOL 😍🥰😎💩🦊🦊🦊🦊💕❤💋😘😚 emojis!"; var result = EmojiParser.GetCodepoints(input); var titleElements = new List <UIElement>(); var a = result.Codepoints.ToList(); var b = result.SourceSplit.ToList(); while (a.Any() || b.Any()) { if (b.Any()) { titleElements.Add(new TextBlock { Text = b.First(), VerticalAlignment = VerticalAlignment.Center }); b.RemoveAt(0); } if (a.Any()) { Uri uri = new Uri($"ms-appx:///Assets/{a.First()}.png"); BitmapImage imgSource = new BitmapImage(uri); titleElements.Add(new Image { Source = imgSource, Width = 20, Height = 20, VerticalAlignment = VerticalAlignment.Center }); a.RemoveAt(0); } } //Uri uri = new Uri("ms-appx:///Assets/1f98a.png"); //BitmapImage imgSource = new BitmapImage(uri); //new TextBlock { Text = "Hello world ", VerticalAlignment = VerticalAlignment.Center }, //new Image { Source = imgSource, Width = 20, Height = 20, VerticalAlignment = VerticalAlignment.Center }, //new TextBlock { Text = " eyy.", VerticalAlignment = VerticalAlignment.Center } foreach (var element in titleElements) { A.Children.Add(element); } }