// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); vc_MainMenu newScreen = new vc_MainMenu (); this.navController = new UINavigationController (); this.navController.SetNavigationBarHidden (true, false); this.navController.PushViewController (newScreen, false); window.RootViewController = this.navController; window.MakeKeyAndVisible (); return true; // viewController = new vc_ManageVeggies (); // window.RootViewController = viewController; // window.MakeKeyAndVisible (); // // return true; }
public override void ViewDidLoad() { base.ViewDidLoad (); // connect table to source. VeggieTableSource source = new VeggieTableSource (); Console.WriteLine ("\n vc_ManageVeggies.ViewDidLoad: " + Veggies.CountVeggies ().ToString () + " veggies found! :-)"); if (Veggies.CountVeggies () > 0) { this.tblVeggies.Source = source; } btnNewVeggie.TouchUpInside += delegate { Veggies.SelectedVeggie = string.Empty; vc_VeggieAddEdit newScreen = new vc_VeggieAddEdit (); try { this.NavigationController.PushViewController (newScreen, false); } catch (Exception ex) { Console.WriteLine ("btnNewVeggie error: " + ex.ToString ()); } }; btnEditVeggie.TouchUpInside += delegate { if (Veggies.SelectedVeggie == string.Empty) { UIAlertView alert = new UIAlertView ("Oops!", "Please select a veggie to edit.", null, "OK"); alert.Show (); } else { vc_VeggieAddEdit newScreen = new vc_VeggieAddEdit (); this.NavigationController.PushViewController (newScreen, false); } }; btnDeleteVeggie.TouchUpInside += delegate { Veggies.DeleteVeggie (Veggies.SelectedVeggie); // update VeggieNames list and reload tableview data. //Veggies.RefreshVeggieList (); Veggies.VeggieNames.Remove (Veggies.SelectedVeggie); tblVeggies.ReloadData (); }; btnDone.TouchUpInside += delegate { vc_MainMenu newScreen = new vc_MainMenu (); NavigationController.PushViewController (newScreen, false); }; }