private async void callAzureFunction2CommandExecute() { Windows.Storage.Pickers.FileOpenPicker picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.CommitButtonText = "OK"; picker.FileTypeFilter.Add(".jpg"); picker.FileTypeFilter.Add(".jpeg"); picker.FileTypeFilter.Add(".png"); picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary; var file = await picker.PickSingleFileAsync(); if (file != null) { this.Wait = true; this.ImageFile = file.Path; var buffer = await FileIO.ReadBufferAsync(file); byte[] bytes = buffer.ToArray(); string code = "f3RuUGE2BM8UjjA0XJ8g6br/eDP9L3NsG1n3MR8ZYfbipRiHQ0XiJg=="; string url = "https://visualstudiotips.azurewebsites.net/api/GetImageColors?code=" + code; var response = await client.PostAsync(url, new ByteArrayContent(bytes)); if (response.IsSuccessStatusCode) { var json = await response.Content.ReadAsAsync <string>(); imageColors = JsonConvert.DeserializeObject <ImageColors>(json); base.RaisePropertyChanged(nameof(RedPercentage)); base.RaisePropertyChanged(nameof(GreenPercentage)); base.RaisePropertyChanged(nameof(BluePercentage)); } this.Wait = false; } }
/// <summary> /// process update image to grayscale request /// </summary> private string updateGrayscale(string imageFile) { ImageColors updateImageColor = new ImageColors(); return(updateImageColor.UpdateImagetoGrayscale(imageFile)); }