示例#1
0
        public void OpenPhoto()
        {
            var user = CurrentItem;

            if (user != null)
            {
                var photo = user.Photo as TLUserProfilePhoto;
                if (photo != null)
                {
                    StateService.CurrentPhoto   = photo;
                    StateService.CurrentContact = CurrentItem;

                    if (ProfilePhotoViewer == null)
                    {
                        ProfilePhotoViewer = new ProfilePhotoViewerViewModel(StateService, MTProtoService);
                        NotifyOfPropertyChange(() => ProfilePhotoViewer);
                    }

                    BeginOnUIThread(() => ProfilePhotoViewer.OpenViewer());
                }

                var photoEmpty = user.Photo as TLUserProfilePhotoEmpty;
                if (photoEmpty != null)
                {
                    EditCurrentUserActions.EditPhoto(result =>
                    {
                        var fileId = TLLong.Random();
                        IsWorking  = true;
                        UploadManager.UploadFile(fileId, new TLUser66 {
                            IsSelf = true
                        }, result);
                    });
                }
            }
        }
示例#2
0
        public void OpenPhoto()
        {
            var chat    = CurrentItem as TLChat;
            var channel = CurrentItem as TLChannel;

            if (chat == null && channel == null)
            {
                return;
            }

            var photoBase = GetPhoto();

            var photo = photoBase as TLChatPhoto;

            if (photo != null)
            {
                StateService.CurrentPhoto = photo;

                if (ProfilePhotoViewer == null)
                {
                    ProfilePhotoViewer = new ProfilePhotoViewerViewModel(StateService, MTProtoService, EventAggregator, NavigationService);
                    NotifyOfPropertyChange(() => ProfilePhotoViewer);
                }

                BeginOnUIThread(() => ProfilePhotoViewer.OpenViewer());
                return;
            }

            var photoEmpty = photoBase as TLChatPhotoEmpty;

            if (photoEmpty != null)
            {
                if ((chat != null && !chat.Left.Value) ||
                    (channel != null && channel.Creator))
                {
                    EditChatActions.EditPhoto(result =>
                    {
                        var fileId = TLLong.Random();
                        IsWorking  = true;
                        _uploadManager.UploadFile(fileId, CurrentItem, result);
                    });
                }
            }
        }
示例#3
0
        public void OpenPhoto()
        {
            if (CurrentContact == null)
            {
                return;
            }

            var photo = CurrentContact.Photo as TLUserProfilePhoto;

            if (photo != null)
            {
                StateService.CurrentPhoto   = photo;
                StateService.CurrentContact = CurrentContact;

                if (ProfilePhotoViewer == null)
                {
                    ProfilePhotoViewer = new ProfilePhotoViewerViewModel(StateService, MTProtoService);
                    NotifyOfPropertyChange(() => ProfilePhotoViewer);
                }

                BeginOnUIThread(() => ProfilePhotoViewer.OpenViewer());
            }
        }