예제 #1
0
		public void InitController(Boolean stop)
		{
			if (stop) {
				// Check location was aborted with quit
				locationManager.StopUpdatingLocation ();
				DestroyEngine ();
				appDelegate.CartStop ();

				return;
			}

			locationManager.StopUpdatingLocation ();
			locationManager.DistanceFilter = 2.0;
			locationManager.HeadingFilter = 5.0;
			locationManager.Delegate = new LocationManagerDelegate (this);
			locationManager.StartUpdatingLocation ();
			locationManager.StartUpdatingHeading ();

			// Create Engine
			CreateEngine (cart);

			// Create screens
			screenMain = new ScreenMain(this);

			// Set left button
			var leftBarButton = new UIBarButtonItem (Catalog.GetString("Quit"), UIBarButtonItemStyle.Plain, (sender, args) => {
				ButtonPressed(null);
				quit();
			});
			leftBarButton.TintColor = Colors.NavBarButton;
			screenMain.NavigationItem.SetLeftBarButtonItem(leftBarButton, true);

			// Set right button
			var rightBarButton = new UIBarButtonItem (Catalog.GetString("Save"), UIBarButtonItemStyle.Plain, (sender, args) => {
				ButtonPressed(null);
				Save();
			});
			rightBarButton.TintColor = Colors.NavBarButton;
			screenMain.NavigationItem.SetRightBarButtonItem(rightBarButton, true);

			screenListLocations = new ScreenList (this, ScreenType.Locations); 
			screenListItems = new ScreenList (this, ScreenType.Items); 
			screenListInventory = new ScreenList (this, ScreenType.Inventory); 
			screenListTasks = new ScreenList (this, ScreenType.Tasks); 

			Delegate = new ScreenControllerDelegate();

			// ... and push it to the UINavigationController while replacing the CheckLocation
			SetViewControllers (new UIViewController[] { screenMain }, animation);

			Title = cart.Name; 

			if (restore)
				Restore();
			else
				Start ();
		}
예제 #2
0
        public void InitController(Boolean stop)
        {
            if (stop)
            {
                // Check location was aborted with quit
                locationManager.StopUpdatingLocation();
                DestroyEngine();
                appDelegate.CartStop();

                return;
            }

            locationManager.StopUpdatingLocation();
            locationManager.DistanceFilter = 2.0;
            locationManager.HeadingFilter  = 5.0;
            locationManager.Delegate       = new LocationManagerDelegate(this);
            locationManager.StartUpdatingLocation();
            locationManager.StartUpdatingHeading();

            // Create Engine
            CreateEngine(cart);

            // Create screens
            screenMain = new ScreenMain(this);

            // Set left button
            var leftBarButton = new UIBarButtonItem(Catalog.GetString("Quit"), UIBarButtonItemStyle.Plain, (sender, args) => {
                ButtonPressed(null);
                quit();
            });

            leftBarButton.TintColor = Colors.NavBarButton;
            screenMain.NavigationItem.SetLeftBarButtonItem(leftBarButton, true);

            // Set right button
            var rightBarButton = new UIBarButtonItem(Catalog.GetString("Save"), UIBarButtonItemStyle.Plain, (sender, args) => {
                ButtonPressed(null);
                Save();
            });

            rightBarButton.TintColor = Colors.NavBarButton;
            screenMain.NavigationItem.SetRightBarButtonItem(rightBarButton, true);

            screenListLocations = new ScreenList(this, ScreenType.Locations);
            screenListItems     = new ScreenList(this, ScreenType.Items);
            screenListInventory = new ScreenList(this, ScreenType.Inventory);
            screenListTasks     = new ScreenList(this, ScreenType.Tasks);

            Delegate = new ScreenControllerDelegate();

            // ... and push it to the UINavigationController while replacing the CheckLocation
            SetViewControllers(new UIViewController[] { screenMain }, animation);

            Title = cart.Name;

            if (restore)
            {
                Restore();
            }
            else
            {
                Start();
            }
        }