public static int AddToQueue(AttendancePhoto attendancePhoto) { SyncQueue queueItem = new SyncQueue() {type = SyncQueueType.sqtAttendancePhoto}; queueItem.fileLoacation = Path.Combine(Common.DatabaseFileDir, fUserName, @"SyncQueue", String.Format("attendancePhoto_{0}.xml", Guid.NewGuid())); new FileInfo(queueItem.fileLoacation).Directory.Create(); var serializer = new XmlSerializer(typeof(AttendancePhoto)); using (var writer = new StreamWriter(queueItem.fileLoacation)) { serializer.Serialize(writer, attendancePhoto); } return SaveSyncQueue(queueItem); }
public override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult (requestCode, resultCode, data); if (resultCode == Result.Ok) { bIsPhotoMake = false; // Make it available in the gallery Intent mediaScanIntent = new Intent (Intent.ActionMediaScannerScanFile); Android.Net.Uri contentUri = Android.Net.Uri.FromFile (file); mediaScanIntent.SetData (contentUri); Activity.SendBroadcast (mediaScanIntent); ExifInterface exif = new ExifInterface (file.ToString ()); text.Text += String.Format(@"TagGpsLatitude : {0} \n", exif.GetAttribute (ExifInterface.TagGpsLatitude)); text.Text += String.Format(@"TagGpsLongitude : {0} \n", exif.GetAttribute (ExifInterface.TagGpsLongitude)); text.Text += String.Format(@"TagGpsDatestamp : {0} \n", exif.GetAttribute (ExifInterface.TagGpsDatestamp)); text.Text += String.Format(@"TagIso : {0} \n", exif.GetAttribute (ExifInterface.TagIso)); text.Text += String.Format(@"TagDatetime : {0} \n", exif.GetAttribute (ExifInterface.TagDatetime)); AttendancePhoto attPhoto = new AttendancePhoto () { id = -1, photoPath = file.ToString ()}; DateTime dtStamp; if (DateTime.TryParse (exif.GetAttribute (ExifInterface.TagDatetime), out dtStamp)){ attPhoto.stamp = dtStamp; }; float gps; if (float.TryParse (exif.GetAttribute (ExifInterface.TagGpsLatitude), out gps)){ attPhoto.latitude = gps; }; if (float.TryParse (exif.GetAttribute (ExifInterface.TagGpsLongitude), out gps)){ attPhoto.longitude = gps; }; attPhoto.latitude = convertToDegree (exif.GetAttribute (ExifInterface.TagGpsLatitude)); attPhoto.longitude = convertToDegree (exif.GetAttribute (ExifInterface.TagGpsLongitude)); newAttendancePhotos.Add (attPhoto); } // Dispose of the Java side bitmap. GC.Collect(); }
public static int AddToQueue(AttendancePhoto attendancePhoto) { return SyncQueueRepository.AddToQueue(attendancePhoto); }