private void Upload_Click(object sender, RoutedEventArgs e) { Random randomName = new Random(); FileModel fileModel = new FileModel { Id = new Guid(), Name = "MyPhoto" + randomName.Next().ToString(), DateTime = DateTimeOffset.Now, Photo = Convert.ToBase64String(image) }; FileSender client = new FileSender(url); client.AddFile(fileModel); MessageBox.Show("File has been uploaded"); }
private async void Get_Click(object sender, RoutedEventArgs e) { FileSender client = new FileSender(url); string[] formats = { "N", "D", "B", "P", "X" }; Guid result; try { Guid.TryParseExact(txtId.Text, "D", out result); var files = await client.GetFileAsync(result); var buffer = Convert.FromBase64String(files.Photo); imgPhoto.Source = ByteToImage(buffer); } catch (NullReferenceException err) { MessageBox.Show(err.Message); } }