private void Repeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { if (args.Element is TreeViewItem) { (args.Element as TreeViewItem).RepeatedIndex = args.Index; } }
private void groupRepeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { if (args.Element is GroupedRepeaterItem) { (args.Element as GroupedRepeaterItem).RepeatedIndex = args.Index; } }
private void Child_ElementPrepared(object sender, ItemsRepeaterElementPreparedEventArgs e) { Button button = e.Element as Button; TreeNode node = (currentNodeChildrenList.ToArray <object>().GetValue(e.Index) as TreeNode); button.Name = node.Name; }
private void OnElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { var button = args.Element as Button; var animation = button.DataContext as Animation; if (ApiInfo.IsFullExperience || Windows.UI.ViewManagement.UIViewSettings.GetForCurrentView().UserInteractionMode == Windows.UI.ViewManagement.UserInteractionMode.Mouse) { _zoomer.ElementPrepared(button); } button.Tag = animation; var content = button.Content as Grid; var image = content.Children[0] as Image; var file = animation.Thumbnail?.File; if (file == null) { return; } if (file.Local.IsDownloadingCompleted) { image.Source = new BitmapImage(new Uri("file:///" + file.Local.Path)); } else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive) { image.Source = null; DownloadFile(file.Id, animation); } }
private void OnElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { var button = args.Element as Button; var animation = button.DataContext as Animation; _zoomer.ElementPrepared(button); button.Tag = animation; var content = button.Content as Grid; var image = content.Children[0] as Image; var file = animation.Thumbnail?.File; if (file == null) { return; } if (file.Local.IsDownloadingCompleted) { image.Source = new BitmapImage(new Uri("file:///" + file.Local.Path)); } else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive) { image.Source = null; DownloadFile(file.Id, animation); } }
private void OnElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { var element = args.Element as FrameworkElement; if (element.Tag != null) { element.Name = "Page Button " + element.Tag; } }
private void FileItemsRepeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { if (args.Element is FrameworkElement fe && fe.DataContext is StorageItemViewModel itemVM ) { itemVM.Initialize(); } }
private void FileItemsRepeater_Large_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { this.FoldersAdaptiveGridView.ContainerContentChanging -= FoldersAdaptiveGridView_ContainerContentChanging; this.FileItemsRepeater_Small.ElementPrepared -= FileItemsRepeater_Large_ElementPrepared; this.FileItemsRepeater_Midium.ElementPrepared -= FileItemsRepeater_Large_ElementPrepared; this.FileItemsRepeater_Large.ElementPrepared -= FileItemsRepeater_Large_ElementPrepared; (args.Element as Control).Focus(FocusState.Keyboard); }
/* Events regarding the number panel display mode */ private void OnElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { if (args.Element == null || args.Element.GetType() != typeof(Button)) { return; } (args.Element as Button).Click += OnNumberPanelButtonClicked; (args.Element as FrameworkElement).Loaded += MoveIdentifierToCurrentPage; }
private void OnElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { var button = args.Element as BadgeButton; var info = sender.ItemsSourceView.GetAt(args.Index) as ShortcutInfo; //var info = button.DataContext as ShortcutInfo; button.Content = info.Command; //button.Badge = info.Shortcut; button.Command = ViewModel.EditCommand; button.CommandParameter = info; }
private async void OnRepElementPrepared(object sender, ItemsRepeaterElementPreparedEventArgs e) { if (vm.ReadingSettings.LoadAll) { try { await vm.GoPageIndexAsync(e.Index); } catch (Exception ex) { vm.ExceptionService.Exception = ex; } } }
private void OnElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { var button = args.Element as Button; var result = button.DataContext as InlineQueryResult; var content = button.Content as Grid; if (content.Children[0] is Image image) { if (result is InlineQueryResultAnimation || result is InlineQueryResultPhoto || result is InlineQueryResultVideo) { File file = null; if (result is InlineQueryResultAnimation animation) { file = animation.Animation.Thumbnail?.File; } else if (result is InlineQueryResultPhoto photo) { file = photo.Photo.GetSmall().Photo; } else if (result is InlineQueryResultVideo video) { file = video.Video.Thumbnail?.File; } if (file == null) { return; } if (file.Local.IsDownloadingCompleted) { image.Source = new BitmapImage(new Uri("file:///" + file.Local.Path)); } else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive) { image.Source = null; DownloadFile(_thumbnails, file.Id, result); } } else if (result is InlineQueryResultSticker sticker) { var file = sticker.Sticker.Thumbnail.File; if (file == null) { return; } if (file.Local.IsDownloadingCompleted) { image.Source = PlaceholderHelper.GetWebPFrame(file.Local.Path); } else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive) { image.Source = null; DownloadFile(_thumbnails, file.Id, result); } } } else if (content.Children[0] is Grid presenter) { //var presenter = content.Children[0] as Grid; var thumb = presenter.Children[0] as Image; var title = content.Children[1] as TextBlock; var description = content.Children[2] as TextBlock; File file = null; Uri uri = null; if (result is InlineQueryResultArticle article) { file = article.Thumbnail?.File; title.Text = article.Title; description.Text = article.Description; } else if (result is InlineQueryResultAudio audio) { file = audio.Audio.AlbumCoverThumbnail?.File; title.Text = audio.Audio.GetTitle(); description.Text = audio.Audio.GetDuration(); } else if (result is InlineQueryResultContact contact) { file = contact.Thumbnail?.File; title.Text = contact.Contact.GetFullName(); description.Text = PhoneNumber.Format(contact.Contact.PhoneNumber); } else if (result is InlineQueryResultDocument document) { file = document.Document.Thumbnail?.File; title.Text = document.Title; if (string.IsNullOrEmpty(document.Description)) { description.Text = FileSizeConverter.Convert(document.Document.DocumentValue.Size); } else { description.Text = document.Description; } } else if (result is InlineQueryResultGame game) { file = game.Game.Animation?.Thumbnail?.File ?? game.Game.Photo.GetSmall().Photo; title.Text = game.Game.Title; description.Text = game.Game.Description; } else if (result is InlineQueryResultLocation location) { var latitude = location.Location.Latitude.ToString(CultureInfo.InvariantCulture); var longitude = location.Location.Longitude.ToString(CultureInfo.InvariantCulture); uri = new Uri(string.Format("https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/{0},{1}/{2}?mapSize={3}&key=FgqXCsfOQmAn9NRf4YJ2~61a_LaBcS6soQpuLCjgo3g~Ah_T2wZTc8WqNe9a_yzjeoa5X00x4VJeeKH48wAO1zWJMtWg6qN-u4Zn9cmrOPcL", latitude, longitude, 15, "96,96")); file = location.Thumbnail?.File; title.Text = location.Title; description.Text = $"{location.Location.Latitude};{location.Location.Longitude}"; } else if (result is InlineQueryResultPhoto photo) { file = photo.Photo.GetSmall().Photo; title.Text = photo.Title; description.Text = photo.Description; } else if (result is InlineQueryResultVenue venue) { var latitude = venue.Venue.Location.Latitude.ToString(CultureInfo.InvariantCulture); var longitude = venue.Venue.Location.Longitude.ToString(CultureInfo.InvariantCulture); uri = new Uri(string.Format("https://dev.virtualearth.net/REST/v1/Imagery/Map/Road/{0},{1}/{2}?mapSize={3}&key=FgqXCsfOQmAn9NRf4YJ2~61a_LaBcS6soQpuLCjgo3g~Ah_T2wZTc8WqNe9a_yzjeoa5X00x4VJeeKH48wAO1zWJMtWg6qN-u4Zn9cmrOPcL", latitude, longitude, 15, "96,96")); file = venue.Thumbnail?.File; title.Text = venue.Venue.Title; description.Text = venue.Venue.Address; } else if (result is InlineQueryResultVideo video) { file = video.Video.Thumbnail?.File; title.Text = video.Title; description.Text = video.Description; } else if (result is InlineQueryResultVoiceNote voiceNote) { title.Text = voiceNote.Title; description.Text = voiceNote.VoiceNote.GetDuration(); } if (file != null) { if (file.Local.IsDownloadingCompleted) { thumb.Source = new BitmapImage(new Uri("file:///" + file.Local.Path)); } else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive) { thumb.Source = null; DownloadFile(_thumbnails, file.Id, result); } } else if (uri != null) { thumb.Source = new BitmapImage(uri); } else { thumb.Source = PlaceholderHelper.GetNameForChat(title.Text, 96, title.Text.GetHashCode()); } } }
private void OnElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) { OutputText.Text += args.Index + "Prepared" + Environment.NewLine; }
private void CarouselRepeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) => HorizontalSnapPointsChanged?.Invoke(this, EventArgs.Empty);