//================================================================================ //================================================================================ /// <summary> /// Fills the table with a list of available features /// </summary> protected void PopulateFeaturesTable() { //---- declare vars List <FeatureGroup> features = new List <FeatureGroup>(); FeatureGroup featGroup; string[] mediaTypes; //---- Sources featGroup = new FeatureGroup() { Name = "Sources" }; featGroup.Features.Add(new Feature() { Name = "Camera", IsAvailable = UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) }); featGroup.Features.Add(new Feature() { Name = "Photo Library", IsAvailable = UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary) }); featGroup.Features.Add(new Feature() { Name = "Saved Photos Album", IsAvailable = UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum) }); features.Add(featGroup); //---- Camera and Flash featGroup = new FeatureGroup() { Name = "Camera and Flash" }; featGroup.Features.Add(new Feature() { Name = "Front Camera", IsAvailable = UIImagePickerController.IsCameraDeviceAvailable(UIImagePickerControllerCameraDevice.Front) }); featGroup.Features.Add(new Feature() { Name = "Front Flash", IsAvailable = UIImagePickerController.IsFlashAvailableForCameraDevice(UIImagePickerControllerCameraDevice.Front) }); featGroup.Features.Add(new Feature() { Name = "Rear Camera", IsAvailable = UIImagePickerController.IsCameraDeviceAvailable(UIImagePickerControllerCameraDevice.Rear) }); featGroup.Features.Add(new Feature() { Name = "Rear Flash", IsAvailable = UIImagePickerController.IsFlashAvailableForCameraDevice(UIImagePickerControllerCameraDevice.Rear) }); features.Add(featGroup); //---- Camera Media Types featGroup = new FeatureGroup() { Name = "Camera Media Types" }; mediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.Camera); foreach (var mediaType in mediaTypes) { featGroup.Features.Add(new Feature() { Name = mediaType, IsAvailable = true }); } features.Add(featGroup); //---- Photo Library Media Types featGroup = new FeatureGroup() { Name = "Photo Library Media Types" }; mediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary); foreach (var mediaType in mediaTypes) { featGroup.Features.Add(new Feature() { Name = mediaType, IsAvailable = true }); } features.Add(featGroup); //---- Saved Photos Album Media Types featGroup = new FeatureGroup() { Name = "Saved Photos Album Media Types" }; mediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.SavedPhotosAlbum); foreach (var mediaType in mediaTypes) { featGroup.Features.Add(new Feature() { Name = mediaType, IsAvailable = true }); } features.Add(featGroup); //---- bind to the table this._tableSource = new ImagePickerScreen.FeaturesTableDataSource(features); this.tblFeatures.Source = this._tableSource; }
// Fills the table with a list of available features protected void PopulateFeaturesTable() { // declare vars List <FeatureGroup> features = new List <FeatureGroup> (); FeatureGroup featGroup; string[] mediaTypes; // Sources featGroup = new FeatureGroup() { Name = "Sources" }; try { featGroup.Features.Add(new Feature() { Name = "Camera", IsAvailable = UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) }); } catch (System.NullReferenceException) { UIAlertView alert = new UIAlertView("No Camera", "No Camera Detected!", null, "OK", null); alert.Show(); } featGroup.Features.Add(new Feature() { Name = "Photo Library", IsAvailable = UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary) }); featGroup.Features.Add(new Feature() { Name = "Saved Photos Album", IsAvailable = UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum) }); features.Add(featGroup); // Camera and Flash featGroup = new FeatureGroup() { Name = "Camera and Flash" }; try { featGroup.Features.Add(new Feature() { Name = "Front Camera", IsAvailable = UIImagePickerController.IsCameraDeviceAvailable(UIImagePickerControllerCameraDevice.Front) }); featGroup.Features.Add(new Feature() { Name = "Front Flash", IsAvailable = UIImagePickerController.IsFlashAvailableForCameraDevice(UIImagePickerControllerCameraDevice.Front) }); featGroup.Features.Add(new Feature() { Name = "Rear Camera", IsAvailable = UIImagePickerController.IsCameraDeviceAvailable(UIImagePickerControllerCameraDevice.Rear) }); featGroup.Features.Add(new Feature() { Name = "Rear Flash", IsAvailable = UIImagePickerController.IsFlashAvailableForCameraDevice(UIImagePickerControllerCameraDevice.Rear) }); features.Add(featGroup); } catch (System.NullReferenceException) { UIAlertView alert = new UIAlertView("No Camera", "No Camera Detected!", null, "OK", null); alert.Show(); } // Camera Media Types featGroup = new FeatureGroup() { Name = "Camera Media Types" }; try { mediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.Camera); foreach (var mediaType in mediaTypes) { featGroup.Features.Add(new Feature() { Name = mediaType, IsAvailable = true }); } features.Add(featGroup); } catch (System.NullReferenceException) { UIAlertView alert = new UIAlertView("No Camera", "No Camera Detected!", null, "OK", null); alert.Show(); } // Photo Library Media Types featGroup = new FeatureGroup() { Name = "Photo Library Media Types" }; mediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary); foreach (var mediaType in mediaTypes) { featGroup.Features.Add(new Feature() { Name = mediaType, IsAvailable = true }); } features.Add(featGroup); // Saved Photos Album Media Types featGroup = new FeatureGroup() { Name = "Saved Photos Album Media Types" }; mediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.SavedPhotosAlbum); foreach (var mediaType in mediaTypes) { featGroup.Features.Add(new Feature() { Name = mediaType, IsAvailable = true }); } features.Add(featGroup); // bind to the table tableSource = new ImagePickerScreen.FeaturesTableDataSource(features); tblFeatures.Source = tableSource; }
// Fills the table with a list of available features protected void PopulateFeaturesTable() { // declare vars List<FeatureGroup> features = new List<FeatureGroup> (); FeatureGroup featGroup; string[] mediaTypes; // Sources featGroup = new FeatureGroup () { Name = "Sources" }; try { featGroup.Features.Add (new Feature () { Name = "Camera", IsAvailable = UIImagePickerController.IsSourceTypeAvailable (UIImagePickerControllerSourceType.Camera) }); } catch (System.NullReferenceException) { UIAlertView alert = new UIAlertView ("No Camera", "No Camera Detected!", null, "OK", null); alert.Show (); } featGroup.Features.Add (new Feature () { Name = "Photo Library", IsAvailable = UIImagePickerController.IsSourceTypeAvailable (UIImagePickerControllerSourceType.PhotoLibrary) }); featGroup.Features.Add (new Feature () { Name = "Saved Photos Album", IsAvailable = UIImagePickerController.IsSourceTypeAvailable (UIImagePickerControllerSourceType.SavedPhotosAlbum) }); features.Add (featGroup); // Camera and Flash featGroup = new FeatureGroup () { Name = "Camera and Flash" }; try { featGroup.Features.Add (new Feature () { Name = "Front Camera", IsAvailable = UIImagePickerController.IsCameraDeviceAvailable (UIImagePickerControllerCameraDevice.Front) }); featGroup.Features.Add (new Feature () { Name = "Front Flash", IsAvailable = UIImagePickerController.IsFlashAvailableForCameraDevice (UIImagePickerControllerCameraDevice.Front) }); featGroup.Features.Add (new Feature () { Name = "Rear Camera", IsAvailable = UIImagePickerController.IsCameraDeviceAvailable (UIImagePickerControllerCameraDevice.Rear) }); featGroup.Features.Add (new Feature () { Name = "Rear Flash", IsAvailable = UIImagePickerController.IsFlashAvailableForCameraDevice (UIImagePickerControllerCameraDevice.Rear) }); features.Add (featGroup); } catch (System.NullReferenceException) { UIAlertView alert = new UIAlertView ("No Camera", "No Camera Detected!", null, "OK", null); alert.Show (); } // Camera Media Types featGroup = new FeatureGroup () { Name = "Camera Media Types" }; try { mediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.Camera); foreach (var mediaType in mediaTypes) { featGroup.Features.Add (new Feature () { Name = mediaType, IsAvailable = true }); } features.Add (featGroup); } catch (System.NullReferenceException) { UIAlertView alert = new UIAlertView ("No Camera", "No Camera Detected!", null, "OK", null); alert.Show (); } // Photo Library Media Types featGroup = new FeatureGroup () { Name = "Photo Library Media Types" }; mediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.PhotoLibrary); foreach (var mediaType in mediaTypes) { featGroup.Features.Add (new Feature () { Name = mediaType, IsAvailable = true }); } features.Add (featGroup); // Saved Photos Album Media Types featGroup = new FeatureGroup () { Name = "Saved Photos Album Media Types" }; mediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.SavedPhotosAlbum); foreach (var mediaType in mediaTypes) { featGroup.Features.Add (new Feature () { Name = mediaType, IsAvailable = true }); } features.Add (featGroup); // bind to the table tableSource = new ImagePickerScreen.FeaturesTableDataSource (features); tblFeatures.Source = tableSource; }