Ejemplo n.º 1
0
        private async void EditPhotoExecute(StorageFile file)
        {
            var fileLocation = new TLFileLocation
            {
                VolumeId = TLLong.Random(),
                LocalId  = TLInt.Random(),
                Secret   = TLLong.Random(),
                DCId     = 0
            };

            var fileName  = string.Format("{0}_{1}_{2}.jpg", fileLocation.VolumeId, fileLocation.LocalId, fileLocation.Secret);
            var fileCache = await FileUtils.CreateTempFileAsync(fileName);

            await file.CopyAndReplaceAsync(fileCache);

            var fileScale = fileCache;

            var basicProps = await fileScale.GetBasicPropertiesAsync();

            var imageProps = await fileScale.Properties.GetImagePropertiesAsync();

            var fileId = TLLong.Random();
            var upload = await _uploadFileManager.UploadFileAsync(fileId, fileCache.Name, false);

            if (upload != null)
            {
                var response = await ProtoService.EditPhotoAsync(_item, new TLInputChatUploadedPhoto { File = upload.ToInputFile() });

                if (response.IsSucceeded)
                {
                }
            }
        }
        private async void ContinueUploadingPhoto(TLChannel channel)
        {
            var response = await ProtoService.EditPhotoAsync(channel, new TLInputChatUploadedPhoto { File = _photo });

            if (response.IsSucceeded)
            {
                NavigationService.Navigate(typeof(ChannelCreateStep2Page), channel.ToPeer());
            }
            else
            {
                // TODO: ...
            }
        }