Esempio n. 1
0
        private async void AddExecute()
        {
            var chat = _chat;

            if (chat == null)
            {
                return;
            }

            var selected = await SharePopup.PickChatAsync(Strings.Resources.SelectContact);

            var user = CacheService.GetUser(selected);

            if (user == null)
            {
                return;
            }

            var confirm = await MessagePopup.ShowAsync(string.Format(Strings.Resources.AddToTheGroup, user.GetFullName()), Strings.Resources.AppName, Strings.Resources.OK, Strings.Resources.Cancel);

            if (confirm != ContentDialogResult.Primary)
            {
                return;
            }

            var response = await ProtoService.SendAsync(new AddChatMember(chat.Id, user.Id, CacheService.Options.ForwardedMessageCountMax));

            if (response is Error error)
            {
            }
        }
 private async void ShareExecute()
 {
     if (ShareLink != null)
     {
         await SharePopup.GetForCurrentView().ShowAsync(ShareLink, ShareTitle);
     }
 }
        private async void ShareExecute(ProxyViewModel proxy)
        {
            var response = await ProtoService.SendAsync(new GetProxyLink(proxy.Id));

            if (response is Text text && Uri.TryCreate(text.TextValue, UriKind.Absolute, out Uri uri))
            {
                await SharePopup.GetForCurrentView().ShowAsync(uri, Strings.Resources.Proxy);
            }
        }
Esempio n. 4
0
        private async void LogOld_Click(object sender, RoutedEventArgs e)
        {
            var log = await ApplicationData.Current.LocalFolder.TryGetItemAsync("tdlib_log.txt.old") as StorageFile;

            if (log != null)
            {
                await SharePopup.GetForCurrentView().ShowAsync(new InputMessageDocument(new InputFileLocal(log.Path), null, true, null));
            }
        }
        private async void MessagesForwardExecute()
        {
            var messages = SelectedItems.Where(x => x.CanBeForwarded).OrderBy(x => x.Id).ToList();

            if (messages.Count > 0)
            {
                SelectionMode = ListViewSelectionMode.None;
                await SharePopup.GetForCurrentView().ShowAsync(messages);
            }
        }
Esempio n. 6
0
 private void View_NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
 {
     sender.AddWebAllowedObject("TelegramWebviewProxy", new TelegramGameProxy(withMyScore =>
     {
         this.BeginOnUIThread(async() =>
         {
             await SharePopup.GetForCurrentView().ShowAsync(_shareMessage, withMyScore);
         });
     }));
 }
Esempio n. 7
0
        private async void AddExecute()
        {
            var chats = await SharePopup.PickChatsAsync(Strings.Resources.SelectContacts, Items.Select(x => x.Id).ToArray());

            if (chats != null)
            {
                Items.ReplaceWith(chats);
            }

            SendCommand.RaiseCanExecuteChanged();
        }
Esempio n. 8
0
        private async void ShareExecute()
        {
            var link = ShareLink;

            if (link == null)
            {
                return;
            }

            await SharePopup.GetForCurrentView().ShowAsync(link, ShareTitle);
        }
        private async void BlockExecute()
        {
            var selected = await SharePopup.PickChatAsync(Strings.Resources.BlockUser);

            var user = CacheService.GetUser(selected);

            if (user == null)
            {
                return;
            }

            ProtoService.Send(new BlockUser(user.Id));
        }
Esempio n. 10
0
        private async void BlockExecute()
        {
            var selected = await SharePopup.PickChatAsync(Strings.Resources.BlockUser);

            if (selected == null)
            {
                return;
            }

            if (selected.Type is ChatTypePrivate privata)
            {
                Items.Insert(0, new MessageSenderUser(privata.UserId));
                ProtoService.Send(new ToggleMessageSenderIsBlocked(new MessageSenderUser(privata.UserId), true));
            }
            else
            {
                Items.Insert(0, new MessageSenderChat(selected.Id));
                ProtoService.Send(new ToggleMessageSenderIsBlocked(new MessageSenderChat(selected.Id), true));
            }
        }
 private async void MessageForwardExecute(Message message)
 {
     SelectionMode = ListViewSelectionMode.None;
     await SharePopup.GetForCurrentView().ShowAsync(message);
 }
Esempio n. 12
0
 private async void ThemeShareExecute(ThemeCustomInfo theme)
 {
     await SharePopup.GetForCurrentView().ShowAsync(new InputMessageDocument(new InputFileLocal(theme.Path), null, false, null));
 }
Esempio n. 13
0
 private async void Share_Click(object sender, RoutedEventArgs e)
 {
     await SharePopup.GetForCurrentView().ShowAsync(_shareMessage);
 }
Esempio n. 14
0
 private async void Close_Clicked(object sender, EventArgs e)
 {
     await SharePopup.TranslateTo(0, 170, 250);
 }