static void Main(string[] args) { byte[] image = File.ReadAllBytes("1.jpg"); UploadPhotosSoapClient soapClient = new UploadPhotosSoapClient(); var result = soapClient.Upload(Convert.ToBase64String(image), "c240b8f4-5598-4d60-bf67-d649b489205c"); }
private void ApplicationBarIconButton_Click_1(object sender, EventArgs e) { UploadPhotosSoapClient soapClient = new UploadPhotosSoapClient(); this.toggleButton.IsEnabled = false; this.flag = !this.flag; this.toggleButton.IconUri = this.flag ? new Uri("/Assets/AppBar/add.png", UriKind.Relative) : new Uri("/Assets/AppBar/minus.png", UriKind.Relative); soapClient.ToggleCompleted += (o, args) => { this.toggleButton.IsEnabled = true; }; soapClient.ToggleAsync(); }
void photoChooserTask_Completed(object sender, PhotoResult e) { if (e.TaskResult == TaskResult.OK) { this.progressBar.Visibility = System.Windows.Visibility.Visible; this.toggleButton.IsEnabled = true; byte[] imageBytes = new byte[e.ChosenPhoto.Length]; e.ChosenPhoto.Read(imageBytes, 0, imageBytes.Count()); string imageBase64 = Convert.ToBase64String(imageBytes); BitmapImage bmp = new BitmapImage(); bmp.SetSource(e.ChosenPhoto); selectedImage.Source = bmp; UploadPhotosSoapClient proxy = new UploadPhotosSoapClient(); proxy.UploadCompleted += proxy_UploadCompleted; proxy.UploadAsync(imageBase64, this.QrId); } }