Inheritance: INotifyPropertyChanged
Exemplo n.º 1
0
        private async Task DoSendContact(UserModel user) {
            if (!(dialogToReturn is DialogModelPlain))
                return;

            InputPeer ip = dialogToReturn.InputPeer;
            InputMedia media = TL.inputMediaContact(user.PhoneNumber, user.FirstName, user.LastName);

            DialogModelPlain dialog = (DialogModelPlain) dialogToReturn;
            await dialog.SendMedia(media);
        }
Exemplo n.º 2
0
        protected override void OnNavigatedTo(NavigationEventArgs e) {
            base.OnNavigatedTo(e);

            string uriParam = "";

            if (NavigationContext.QueryString.TryGetValue("userId", out uriParam)) {
                model = TelegramSession.Instance.GetUser(int.Parse(uriParam));
            } else {
                logger.error("Unable to get model id from navigation");
            }

            UpdateDataContext();
        }
Exemplo n.º 3
0
        public PinchAndZoom() {
            InitializeComponent();

            media = MediaTransitionHelper.Instance.Media;
            
            if (media.Constructor == Constructor.messageMediaPhoto) {
                ImageViewportElement.Visibility = Visibility.Visible;
                PlaybackControls.Visibility = Visibility.Collapsed;

                MessageMediaPhotoConstructor cons = (MessageMediaPhotoConstructor) media;

                if (cons.photo.Constructor == Constructor.photoEmpty) {

                } else if (cons.photo.Constructor == Constructor.photo) {
                    PhotoConstructor photoConstructor = (PhotoConstructor) cons.photo;
                    author = TelegramSession.Instance.GetUser(photoConstructor.user_id);
                    MetaInfoAuthor.Text = author.FullName;
                    MetaInfoDate.Text = Formatters.FormatDialogDateTimestampUnix(photoConstructor.date);
                }

                DoLoadPhoto();
                return;
            } else if (media.Constructor == Constructor.messageMediaVideo) {
                ImageViewportElement.Visibility = Visibility.Collapsed;
                PlaybackControls.Visibility = Visibility.Visible;
                VideoPlayerElement.Visibility = Visibility.Visible;
                PlaybackButton.Visibility = Visibility.Visible;

                MessageMediaVideoConstructor cons = (MessageMediaVideoConstructor) media;

                if (cons.video.Constructor == Constructor.videoEmpty) {

                }
                else if (cons.video.Constructor == Constructor.video) {
                    VideoConstructor videoConstructor = (VideoConstructor) cons.video;
                    author = TelegramSession.Instance.GetUser(videoConstructor.user_id);

                    MetaInfoAuthor.Text = author.FullName;
                    MetaInfoDate.Text = Formatters.FormatDialogDateTimestampUnix(videoConstructor.date);
                }

                VideoPlayerElement.MediaEnded += delegate {
                    PlaybackButton.Visibility = Visibility.Visible;
                };
            }
            else {
                return;
            }

        }
Exemplo n.º 4
0
 private void OnUserSelected(object sender, UserModel usermodel) {
     NavigationService.Navigate(new Uri("/UI/Pages/UserProfile.xaml?userId=" + usermodel.Id, UriKind.Relative));
 }
Exemplo n.º 5
0
 private void ContactListOnTelegramUserSelected(object sender, UserModel user) {
     NavigationService.Navigate(new Uri("/UI/Pages/DialogPage.xaml?userId=" + user.Id, UriKind.Relative));
 }
Exemplo n.º 6
0
        public void SaveUser(User user) {
                UserModel model = new UserModel(user);
                if (users.ContainsKey(model.Id)) {
                    Deployment.Current.Dispatcher.BeginInvoke(delegate {
                        users[model.Id].SetUser(user);
                    });
                }
                else {
                    users[model.Id] = model;
                }

        }
Exemplo n.º 7
0
        private async void DoUnblock(UserModel model) {
            ShowProgress();
            bool result = await TelegramSession.Instance.Api.contacts_unblock(model.InputUser);
            
            if (result) {
                blockedUsers.Remove(model);
            } else {
                Toaster.ShowNetworkError();
            }

            HideProgress();
        }
Exemplo n.º 8
0
 private void OnUserSelected(object sender, UserModel user) {
     DoSendContact(user);
     NavigationService.GoBack();
 }
Exemplo n.º 9
0
 private void OnUserSelected(object sender, UserModel user) {
     Task.Run(() => TelegramSession.Instance.EncryptedChats.CreateChatRequest(user.InputUser));
     NavigationService.Navigate(new Uri("/UI/Pages/StartPage.xaml", UriKind.Relative));
 }