public JoinChatPopup(IProtoService protoService, ChatInviteLinkInfo info) { InitializeComponent(); _protoService = protoService; Photo.Source = PlaceholderHelper.GetChat(protoService, info, 72); Title.Text = info.Title; Subtitle.Text = ConvertCount(info.MemberCount, info.MemberUserIds.Count == 0); PrimaryButtonText = Strings.Resources.ChannelJoin; SecondaryButtonText = Strings.Resources.Cancel; if (info.MemberUserIds.Count > 0) { FooterPanel.Visibility = ConvertMoreVisibility(info.MemberCount, info.MemberUserIds.Count); Footer.Text = ConvertMore(info.MemberCount, info.MemberUserIds.Count); Members.Visibility = Visibility.Visible; Members.ItemsSource = protoService.GetUsers(info.MemberUserIds); } else { Members.Visibility = Visibility.Collapsed; } }
public static ImageSource GetChat(IProtoService protoService, ChatInviteLinkInfo chat, int width, int height) { var file = chat.Photo?.Small; if (file != null) { if (file.Local.IsDownloadingCompleted) { return(new BitmapImage(new Uri("file:///" + file.Local.Path)) { DecodePixelWidth = width, DecodePixelHeight = height, DecodePixelType = DecodePixelType.Logical }); } else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive) { protoService?.Send(new DownloadFile(file.Id, 1)); } } else { return(GetChat(chat, width, height)); } return(null); }
public static ImageSource GetChat(ChatInviteLinkInfo chat, int width, int height) { var bitmap = new BitmapImage { DecodePixelWidth = width, DecodePixelHeight = height, DecodePixelType = DecodePixelType.Logical }; using (var stream = new InMemoryRandomAccessStream()) { PlaceholderImageHelper.GetForCurrentView().DrawProfilePlaceholder(_colors[0], InitialNameStringConverter.Convert(chat), stream); try { bitmap.SetSource(stream); } catch { } } return(bitmap); }
public static ImageSource GetChat(ChatInviteLinkInfo chat, int side) { var bitmap = new BitmapImage { DecodePixelWidth = side, DecodePixelHeight = side, DecodePixelType = DecodePixelType.Logical }; using (var stream = new InMemoryRandomAccessStream()) { try { PlaceholderImageHelper.Current.DrawProfilePlaceholder(InitialNameStringConverter.Convert(chat), _colorsTop[5], _colorsBottom[5], stream); bitmap.SetSource(stream); } catch { } } return(bitmap); }
public ChatInviteParameters(IProtoService protoService, ChatInviteLinkInfo chat, int side) { ProtoService = protoService; Chat = chat; Side = side; }