Ejemplo n.º 1
0
        //
        // 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)
        {
            // trace event
            TraceHelper.StartMessage("App: Loaded");

            // if data isn't loaded from storage yet, load the app data
            if (!App.ViewModel.IsDataLoaded)
            {
                // Load app data from local storage (user creds, about tab data, constants, item types, folders, etc)
                App.ViewModel.LoadData();
            }

            // create pages
            var add = new AddPage();
            var calendar = new SchedulePage();
            var folders = new UINavigationController(new FoldersViewController(UITableViewStyle.Plain));
            var settings = new SettingsPage();
            var more = new MoreViewController();
            //var more = new UINavigationController(new MoreViewController());

            tabBarController = new UITabBarController ();
            tabBarController.ViewControllers = new UIViewController [] {
                add,
                calendar,
                folders,
                settings,
                more,
            };

            tabBarController.ViewControllerSelected += (sender, e) =>
            {
                UITabBarController v = (UITabBarController) sender;
                v.LoadView();
            };

            // if haven't synced with web service yet, try now
            if (initialSyncAlreadyHappened == false)
            {
                App.ViewModel.SyncWithService();
                initialSyncAlreadyHappened = true;

                // if there's a home tab set, switch to it now
                var homeTab = PhoneSettingsHelper.GetHomeTab(App.ViewModel.PhoneClientFolder);
                if (homeTab != null && homeTab != "Add")
                    SelectTab(homeTab);
            }

            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);
            if (UIDevice.CurrentDevice.CheckSystemVersion(4, 0))
                window.RootViewController = tabBarController;
            else
                window.AddSubview(tabBarController.View);
            window.MakeKeyAndVisible();

            // trace exit
            TraceHelper.AddMessage("Exiting App Loaded");

            return true;
        }
Ejemplo n.º 2
0
        //
        // 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)
        {
            // trace event
            TraceHelper.StartMessage("App: Loaded");

            // if data isn't loaded from storage yet, load the app data
            if (!App.ViewModel.IsDataLoaded)
            {
                // Load app data from local storage (user creds, about tab data, constants, item types, folders, etc)
                App.ViewModel.LoadData();
            }

            // create pages
            var add      = new AddPage();
            var calendar = new SchedulePage();
            var folders  = new UINavigationController(new FoldersViewController(UITableViewStyle.Plain));
            var settings = new SettingsPage();
            var more     = new MoreViewController();

            //var more = new UINavigationController(new MoreViewController());

            tabBarController = new UITabBarController();
            tabBarController.ViewControllers = new UIViewController [] {
                add,
                calendar,
                folders,
                settings,
                more,
            };

            tabBarController.ViewControllerSelected += (sender, e) =>
            {
                UITabBarController v = (UITabBarController)sender;
                v.LoadView();
            };

            // if haven't synced with web service yet, try now
            if (initialSyncAlreadyHappened == false)
            {
                App.ViewModel.SyncWithService();
                initialSyncAlreadyHappened = true;

                // if there's a home tab set, switch to it now
                var homeTab = PhoneSettingsHelper.GetHomeTab(App.ViewModel.PhoneClientFolder);
                if (homeTab != null && homeTab != "Add")
                {
                    SelectTab(homeTab);
                }
            }

            // create a new window instance based on the screen size
            window = new UIWindow(UIScreen.MainScreen.Bounds);
            if (UIDevice.CurrentDevice.CheckSystemVersion(4, 0))
            {
                window.RootViewController = tabBarController;
            }
            else
            {
                window.AddSubview(tabBarController.View);
            }
            window.MakeKeyAndVisible();

            // trace exit
            TraceHelper.AddMessage("Exiting App Loaded");

            return(true);
        }