Skip to content

Instantly share code, notes, and snippets.

@darbio
Created June 22, 2012 02:31
Show Gist options
  • Save darbio/2969865 to your computer and use it in GitHub Desktop.
Save darbio/2969865 to your computer and use it in GitHub Desktop.
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
BeginInvokeOnMainThread (delegate () {
this.Root = CreateRoot ();
});
}
RootElement CreateRoot ()
{
this.Root = new RootElement ("Root") {
CreateSection_Items ()
}
}
Section CreateSection_Items ()
{
// Set up the section
var itemsSection = new Section (string.Format ("Items ({0})", iSession.Unique.Materials.Count)); // iSession.Unique is a Singleton
// Add the elements to the section
itemsSection.AddAll (CreateElements_Items ());
return itemsSection;
}
List <Element> CreateElements_Items ()
{
var itemElements = new List<Element> ();
foreach (var material in iSession.Unique.Materials) {
itemElements.Add (new Element (material.Description));
}
return itemElements;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment