Advertisement
Guest User

Untitled

a guest
Oct 21st, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.64 KB | None | 0 0
  1. tabBar = new UITabBarController();
  2.                         tabBar.ViewControllerSelected += delegate(object sender, UITabBarSelectionEventArgs e) {
  3.                                
  4.                         };
  5.                        
  6.                         MainView = tabBar.View;
  7.                        
  8.                        
  9.                         home = new HomeDialogViewController();
  10.                         contacts = new ContactsDialogViewController();
  11.                         projects = new ProjectsDialogViewController();
  12.                         //invoices = new InvoicesDialogViewController();
  13.                         //invoiceTimeline = new InvoiceTimelineDialogViewController();
  14.                         //users = new UsersDialogViewController();
  15.                         mileage = new MileageDialogViewController();
  16.                         info = new InfoViewController();
  17.                        
  18.                         DataSource.Instance.RegisterViewControllers(home, contacts, projects); //, invoiceTimeline); //, users);
  19.                        
  20.                         tabControllers = new UINavigationController[] {
  21.                        
  22.                                 new UINavigationController(home) {
  23.                                         TabBarItem = new UITabBarItem("Home", StockImages.Home, 0)
  24.                                 },
  25.                                 new UINavigationController(projects) {
  26.                                         TabBarItem = new UITabBarItem("Projects", StockImages.Project, 2)
  27.                                 },
  28.                                 new UINavigationController(mileage) {
  29.                                         TabBarItem = new UITabBarItem("Mileage", StockImages.GasPump, 3)
  30.                                 },
  31.                                 new UINavigationController(contacts) {
  32.                                         TabBarItem = new UITabBarItem("Contacts", StockImages.Users, 3)
  33.                                 },
  34.                                
  35.                                 new UINavigationController(info) {
  36.                                         TabBarItem = new UITabBarItem("Info", StockImages.Info, 4)
  37.                                 }
  38.                                 //new UINavigationController(invoices) {
  39.                                 //      TabBarItem = new UITabBarItem("Invoices", StockImages.Invoice, 3)
  40.                                 //}
  41.                                 //new UINavigationController(invoiceTimeline) {
  42.                                 //      TabBarItem = new UITabBarItem("Invoices", StockImages.Invoice, 3)
  43.                                 //}
  44.                                 //,
  45.                                 //new UINavigationController(users) {
  46.                                 //      TabBarItem = new UITabBarItem("Users", StockImages.User, 4)
  47.                                 //}
  48.                         };
  49.                        
  50.                        
  51.                         tabBar.SetViewControllers(tabControllers, false);
  52.                        
  53.                         tabBar.ViewControllerSelected += delegate(object sender, UITabBarSelectionEventArgs e) {
  54.                                
  55.                                 if (e.ViewController.TabBarItem.Title == "Home")
  56.                                 {
  57.                                         home.RefreshFromDatastore();
  58.                                         home.NavigationController.PopToViewController(home.NavigationController.ViewControllers[0], false);
  59.                                 }
  60.                         };
  61.                         window.AddSubview(MainView);
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement