예제 #1
0
 public void ReplacePhoto()
 {
     if (CurrentItem is TLChat || CurrentItem is TLChannel)
     {
         EditChatActions.EditPhoto(photo =>
         {
             var fileId = TLLong.Random();
             IsWorking  = true;
             _uploadManager.UploadFile(fileId, CurrentItem, photo);
         });
     }
 }
예제 #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);
                    });
                }
            }
        }