private async void ButtonBase_OnClick(object sender, RoutedEventArgs e) { CameraCaptureUI captureUI = new CameraCaptureUI(); captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg; captureUI.PhotoSettings.CroppedSizeInPixels = new Size(200, 200); StorageFile photo = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo); if (photo == null) { // User cancelled photo capture return; } FileServiceImp fileServiceImp = new FileServiceImp(); string UploadURL = fileServiceImp.GetUploadURL(apiForUploadURL); fileServiceImp.UploadFile(UploadURL, "myFile", "image/png", photo, Avatar, AvatarUrl); }
private async void Button_Photo(object sender, RoutedEventArgs e) { //Get upload url: FileServiceImp fileService = new FileServiceImp(); var uploadUrl = fileService.GetUploadUrl(ApiUrl.GET_UPLOAD_TOKEN); CameraCaptureUI captureUI = new CameraCaptureUI(); captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg; captureUI.PhotoSettings.CroppedSizeInPixels = new Size(200, 200); this.photo = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo); if (photo == null) { // User cancelled photo capture return; } HttpUploadFile(uploadUrl, "myFile", "image/png"); }