private async void EditPhotoExecute(StorageFile file) { _uploadingPhoto = true; 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; Preview = new BitmapImage(FileUtils.GetTempFileUri(fileName)); var fileId = TLLong.Random(); var upload = await _uploadFileManager.UploadFileAsync(fileId, fileCache.Name); if (upload != null) { _photo = upload.ToInputFile(); _uploadingPhoto = false; _uploadingCallback?.Invoke(); } }
public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { var buffer = parameter as byte[]; if (buffer == null) { return(Task.CompletedTask); } using (var from = TLObjectSerializer.CreateReader(buffer.AsBuffer())) { var tuple = new ChatCreateStep2Tuple(from); _title = tuple.Item1; _photo = tuple.Item2; } RaisePropertyChanged(() => Title); return(base.OnNavigatedToAsync(parameter, mode, state)); }