void HandleRowClicked (RowClickedEventArgs e) { Console.WriteLine ("Changing Screens"); (detailViewController as IDetailView).ContentsButtonClicked -= ContentsButtonClickHandler; // if the nav item has a proper controller, push it on to the NavigationController // NOTE: we could also raise an event here, to loosely couple this, but isn't neccessary, // because we'll only ever use this this way if (e.Item.Controller != null) { UIView.BeginAnimations ("DetailViewPush"); detailViewController = e.Item.Controller; ViewControllers = new UIViewController[] { masterViewController, detailViewController }; UIView.SetAnimationTransition (UIViewAnimationTransition.FlipFromRight, ViewControllers [1].View, false); UIView.CommitAnimations (); } else { if (e.Item.ControllerType != null) { ConstructorInfo ctor = null; // if the nav item has constructor aguments if (e.Item.ControllerConstructorArgs.Length > 0) { // look for the constructor ctor = e.Item.ControllerType.GetConstructor (e.Item.ControllerConstructorTypes); } else { // search for the default constructor ctor = e.Item.ControllerType.GetConstructor (System.Type.EmptyTypes); } // if we found the constructor if (ctor != null) { UIViewController instance = null; if (e.Item.ControllerConstructorArgs.Length > 0) { // instance the view controller instance = ctor.Invoke (e.Item.ControllerConstructorArgs) as UIViewController; } else { // instance the view controller instance = ctor.Invoke (null) as UIViewController; } if (instance != null) { // save the object e.Item.Controller = instance; // push the view controller onto the stack UIView.BeginAnimations ("DetailViewPush"); detailViewController = e.Item.Controller; ViewControllers = new UIViewController[] { masterViewController, detailViewController }; UIView.SetAnimationTransition (UIViewAnimationTransition.FlipFromRight, ViewControllers [1].View, false); UIView.CommitAnimations (); } else Console.WriteLine ("instance of view controller not created"); } else Console.WriteLine ("constructor not found"); } } ToogleMasterViewVisibility (InterfaceOrientation); (detailViewController as IDetailView).ContentsButtonClicked += ContentsButtonClickHandler; }
void HandleRowClicked(RowClickedEventArgs e) { Console.WriteLine("Changing Screens"); (detailViewController as IDetailView).ContentsButtonClicked -= ContentsButtonClickHandler; // if the nav item has a proper controller, push it on to the NavigationController // NOTE: we could also raise an event here, to loosely couple this, but isn't neccessary, // because we'll only ever use this this way if (e.Item.Controller != null) { UIView.BeginAnimations("DetailViewPush"); detailViewController = e.Item.Controller; ViewControllers = new UIViewController[] { masterViewController, detailViewController }; UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromRight, ViewControllers [1].View, false); UIView.CommitAnimations(); } else { if (e.Item.ControllerType != null) { ConstructorInfo ctor = null; // if the nav item has constructor aguments if (e.Item.ControllerConstructorArgs.Length > 0) { // look for the constructor ctor = e.Item.ControllerType.GetConstructor(e.Item.ControllerConstructorTypes); } else { // search for the default constructor ctor = e.Item.ControllerType.GetConstructor(System.Type.EmptyTypes); } // if we found the constructor if (ctor != null) { UIViewController instance = null; if (e.Item.ControllerConstructorArgs.Length > 0) { // instance the view controller instance = ctor.Invoke(e.Item.ControllerConstructorArgs) as UIViewController; } else { // instance the view controller instance = ctor.Invoke(null) as UIViewController; } if (instance != null) { // save the object e.Item.Controller = instance; // push the view controller onto the stack UIView.BeginAnimations("DetailViewPush"); detailViewController = e.Item.Controller; ViewControllers = new UIViewController[] { masterViewController, detailViewController }; UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromRight, ViewControllers [1].View, false); UIView.CommitAnimations(); } else { Console.WriteLine("instance of view controller not created"); } } else { Console.WriteLine("constructor not found"); } } } ToogleMasterViewVisibility(InterfaceOrientation); (detailViewController as IDetailView).ContentsButtonClicked += ContentsButtonClickHandler; }