/// <summary> /// Add file object to the database and Files collection. /// </summary> /// <param name="newToDoItem">File object</param> public void AddFile(File file) { // Add the file object to the data context. appDB.Files.InsertOnSubmit(file); // Save changes to the database. appDB.SubmitChanges(); }
private void Camera_CaptureImageAvailable(object sender, ContentReadyEventArgs e) { Deployment.Current.Dispatcher.BeginInvoke(() => { // Save file. string filename = string.Format("{0:yyyyMMdd-HHmmss}.jpg", DateTime.Now); int reducingRate = Int32.Parse(AppResources.ReducingRate); int photoQuality = Int32.Parse(AppResources.PhotoQuality); FileStorage.SaveToIsolatedStorage(e.ImageStream, filename, reducingRate, photoQuality); Model.File file = new Model.File(); file.FileName = filename; file.FileSize = FileStorage.FileSize(filename); file.Uid = 0; RESTService service = new RESTService(AppResources.RESTServiceUri); service.CreateFile(file, onFileCreatedRemotely, onError); }); }