public void UpdateSupergroupPermissions(IProtoService protoService, ContainerContentChangingEventArgs args, TypedEventHandler <ListViewBase, ContainerContentChangingEventArgs> callback) { var member = args.Item as ChatMember; var user = protoService.GetMessageSender(member.MemberId) as User; if (user == null) { return; } if (args.Phase == 0) { TitleLabel.Text = user.GetFullName(); Premium.Visibility = user.IsPremium && protoService.IsPremiumAvailable ? Visibility.Visible : Visibility.Collapsed; } else if (args.Phase == 1) { SubtitleLabel.Text = ChannelParticipantToTypeConverter.Convert(protoService, member); } else if (args.Phase == 2) { Photo.SetUser(protoService, user, 36); } if (args.Phase < 2) { args.RegisterUpdateCallback(callback); } args.Handled = true; }
private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.InRecycleQueue) { return; } var content = args.ItemContainer.ContentTemplateRoot as Grid; var member = args.Item as ChatMember; if (member == null) { return; } content.Tag = args.Item; var user = ViewModel.ProtoService.GetUser(member.UserId); if (user == null) { return; } if (args.Phase == 0) { var title = content.Children[1] as TextBlock; title.Text = user.GetFullName(); } else if (args.Phase == 1) { var subtitle = content.Children[2] as TextBlock; subtitle.Text = ChannelParticipantToTypeConverter.Convert(ViewModel.ProtoService, member); } else if (args.Phase == 2) { var photo = content.Children[0] as ProfilePicture; photo.Source = PlaceholderHelper.GetUser(ViewModel.ProtoService, user, 36); } if (args.Phase < 2) { args.RegisterUpdateCallback(OnContainerContentChanging); } args.Handled = true; }