private void Button_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; //OpenFile Dialog OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = false; dlg.Filter = "All files|*.*"; if ((bool)dlg.ShowDialog()) { var bi1 = new BitmapImage(); bi1.SetSource(dlg.File.OpenRead()); PageService.PageSupport vmb = btn.DataContext as PageService.PageSupport; Stream s = dlg.File.OpenRead(); byte[]filebytes = new byte[s.Length]; s.Write(filebytes, 0, filebytes.Length); //Save to DB //vmb.image = PageService.PageServiceClient psc = new PageService.PageServiceClient(); psc.UpdatePageSupportByIDAsync(vmb); UploadFile(dlg.File.Name, dlg.File.OpenRead()); } else //cancel { //StatusText.Text = "No file selected..."; } }
public void UpdatePageSupport(PageService.PageSupport ps) { PageService.PageServiceClient psc = new PageService.PageServiceClient(); psc.UpdatePageSupportByIDAsync(ps); }