void OnSaveClicked(object sender, EventArgs args) { if (profile.TailNumber == null || profile.TailNumber.Length < 2) { return; } if (profile.Photograph != null) { UIImage thumbnail; NSError error; if (!PhotoManager.Save(profile.TailNumber, profile.Photograph, false, out error)) { var alert = new UIAlertView("Error", error.LocalizedDescription, null, "Dismiss", null); alert.Show(); return; } thumbnail = PhotoManager.ScaleToSize(profile.Photograph, 96, 72); PhotoManager.Save(profile.TailNumber, thumbnail, true, out error); // Note: we don't dispose the thumbnail because it has been added to the cache. thumbnail = null; } // Save the values back to the Aircraft object Aircraft.TailNumber = profile.TailNumber; Aircraft.Make = profile.Make; Aircraft.Model = profile.Model; Aircraft.Classification = ClassificationFromIndexes(category.RadioSelected, classes.Selected); Aircraft.IsComplex = isComplex.Value; Aircraft.IsHighPerformance = isHighPerformance.Value; Aircraft.IsTailDragger = isTailDragger.Value; Aircraft.IsSimulator = isSimulator.Value; Aircraft.Notes = notes.Value; // We'll treat this as a special case for now... if (Aircraft.Make == null && Aircraft.IsSimulator) { Aircraft.Make = "Simulator"; } if (exists) { LogBook.Update(Aircraft); } else { LogBook.Add(Aircraft); } NavigationController.PopViewControllerAnimated(true); OnEditorClosed(); }
void OnPhotoChosen(UIImagePickerController picker, UIImage photo) { Photograph = PhotoManager.ScaleToSize(photo, (int)PhotoWidth, (int)PhotoHeight); if (picker.SourceType == UIImagePickerControllerSourceType.Camera) { photo.SaveToPhotosAlbum(OnPhotoSaved); } else { photo.Dispose(); } popover.Dismiss(true); }