// Called for each group that is enumerated protected void GroupsEnumerator (ALAssetsGroup group, ref bool stop) { // when the enumeration is completed, this method is invoked with group set to null if (group != null) { Console.WriteLine ("Group found: " + group.Type.ToString ()); // don't stop, baby stop = false; // photos and videos. could also pass AllVideos, AllVideos, etc. group.SetAssetsFilter (ALAssetsFilter.AllAssets); if (group.Name != null) Console.WriteLine("Group Name: " + group.Name); // add the group to the assets dictionary groups.Add(group); assetGroups.Add(group, new List<ALAsset> ()); currentGroup = group; // enumerate each asset within the group group.Enumerate(AssetEnumerator); } else { Console.WriteLine ("Group enumeration completed."); assetGroupTableSource = new AssetGroupTableSource (groups); TableView.Source = assetGroupTableSource; assetGroupTableSource.GroupSelected += (object sender, AssetGroupTableSource.GroupSelectedEventArgs e) => { AssetEnumerationScreen assetScreen = new AssetEnumerationScreen (e.Group.Name, assetGroups[e.Group]); NavigationController.PushViewController (assetScreen, true); }; } }
// Called for each group that is enumerated protected void GroupsEnumerator(ALAssetsGroup group, ref bool stop) { // when the enumeration is completed, this method is invoked with group set to null if (group != null) { Console.WriteLine("Group found: " + group.Type.ToString()); // don't stop, baby stop = false; // photos and videos. could also pass AllVideos, AllVideos, etc. group.SetAssetsFilter(ALAssetsFilter.AllAssets); if (group.Name != null) { Console.WriteLine("Group Name: " + group.Name); } // add the group to the assets dictionary groups.Add(group); assetGroups.Add(group, new List <ALAsset> ()); currentGroup = group; // enumerate each asset within the group group.Enumerate(AssetEnumerator); } else { Console.WriteLine("Group enumeration completed."); assetGroupTableSource = new AssetGroupTableSource(groups); TableView.Source = assetGroupTableSource; assetGroupTableSource.GroupSelected += (object sender, AssetGroupTableSource.GroupSelectedEventArgs e) => { AssetEnumerationScreen assetScreen = new AssetEnumerationScreen(e.Group.Name, assetGroups[e.Group]); NavigationController.PushViewController(assetScreen, true); }; TableView.ReloadData(); } }