Пример #1
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            Window = new UIWindow(UIScreen.MainScreen.Bounds);

            IncludeReferences();

            // Initialize App
            App.Initialize().Wait();
            App.Activated();

            // Check if tutorial has been seen
            if (NSUserDefaults.StandardUserDefaults.BoolForKey(PreferencesSettings.FirstLaunchKey))
            {
                // If you have defined a root view controller, set it here:
                Window.RootViewController = new RootViewController();
            }
            else
            {
                UIStoryboard storyboard = UIStoryboard.FromName("MainStoryboard", null);
                IntroductionPageViewController introductionVC = storyboard.InstantiateViewController("IntroductionPageViewController") as IntroductionPageViewController;
                Window.RootViewController = introductionVC;
                UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);
                UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.None);
            }

            // Set background fetch interval
            UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum);

            // make the window visible
            Window.MakeKeyAndVisible();

            return(true);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var storyboard = UIStoryboard.FromName("MainStoryboard", null);

            // Set texts
            lblOffline.Text     = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_title_offline_mode", null);
            lblOfflineText.Text = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_description_offline_mode", null);

            lblPosition.Text            = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_title_anchorage", null);
            lblPositionDescription.Text = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_description_anchorage", null);

            lblRecording.Text = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_section_setup", null).ToUpper();

            lblUseWifi.Text     = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_title_prefer_unmetered", null);
            lblUseWifiText.Text = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_description_prefer_unmetered", null);

            lblVehicle.Text            = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_title_vehicle", null);
            lblVehicleDescription.Text = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_description_vehicle", null);

            lblCalibration.Text = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_section_calibration", null).ToUpper();
            btnCalibrate.SetTitle(NSBundle.MainBundle.LocalizedString("Vernacular_P0_calibration_forget", null), UIControlState.Normal);

            lblIntroduction.Text = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_section_introduction", null).ToUpper();
            btnIntro.SetTitle(NSBundle.MainBundle.LocalizedString("Vernacular_P0_tutorial_redo", null), UIControlState.Normal);

            lblPreferences.Text = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_section_preferences", null).ToUpper();

            lblDisableSuspention.Text      = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_title_disable_suspension", null);
            _lblDisableSuspentionText.Text = NSBundle.MainBundle.LocalizedString("Vernacular_P0_settings_description_disable_suspension", null);

            SetButtonTexts();

            RefreshCalibrationInfo();

            // Set text colors
            lblPreferences.TextColor  = StyleSettings.ThemePrimaryColor();
            lblRecording.TextColor    = StyleSettings.ThemePrimaryColor();
            lblCalibration.TextColor  = StyleSettings.ThemePrimaryColor();
            lblIntroduction.TextColor = StyleSettings.ThemePrimaryColor();
            btnIntro.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal);
            btnIntro.BackgroundColor    = StyleSettings.ThemePrimaryColor();
            btnIntro.Layer.CornerRadius = 5;
            btnCalibrate.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal);
            btnCalibrate.BackgroundColor    = StyleSettings.ThemePrimaryColor();
            btnCalibrate.Layer.CornerRadius = 5;

            // Set button image size
            btnPosition.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            btnVehicle.ImageView.ContentMode  = UIViewContentMode.ScaleAspectFit;

            // Set switch status
            switchWifi.On       = NSUserDefaults.StandardUserDefaults.BoolForKey(_stringPreferUnmeteredConnection);
            switchOffline.On    = NSUserDefaults.StandardUserDefaults.BoolForKey(_stringOfflineMode);
            switchSuspention.On = NSUserDefaults.StandardUserDefaults.BoolForKey(_stringSuspention);

            // Init calibrator
            _calibrator = Calibrator.Create();

            // Set wifi mode
            switchWifi.ValueChanged += (object sender, EventArgs e) => {
                if (switchWifi.On)
                {
                    Settings.PreferUnmeteredConnection = true;
                    NSUserDefaults.StandardUserDefaults.SetBool(true, _stringPreferUnmeteredConnection);
                }
                else
                {
                    Settings.PreferUnmeteredConnection = false;
                    NSUserDefaults.StandardUserDefaults.SetBool(false, _stringPreferUnmeteredConnection);
                }
            };

            // Set offline mode
            switchOffline.ValueChanged += (object sender, EventArgs e) => {
                if (switchOffline.On)
                {
                    Settings.OfflineMode = true;
                    NSUserDefaults.StandardUserDefaults.SetBool(true, _stringOfflineMode);
                }
                else
                {
                    Settings.OfflineMode = false;
                    NSUserDefaults.StandardUserDefaults.SetBool(false, _stringOfflineMode);
                }
            };

            // Set suspension status
            switchSuspention.ValueChanged += (object sender, EventArgs e) => {
                if (switchSuspention.On)
                {
                    Settings.SuspensionDisabled = true;
                    NSUserDefaults.StandardUserDefaults.SetBool(true, _stringSuspention);
                }
                else
                {
                    Settings.SuspensionDisabled = false;
                    NSUserDefaults.StandardUserDefaults.SetBool(false, _stringSuspention);
                }
            };

            // change vehicle type
            btnVehicle.TouchUpInside += (object sender, EventArgs e) => {
                var SelectVehicleVC = storyboard.InstantiateViewController("CustomPickerViewController") as CustomPickerViewController;
                SelectVehicleVC.pickerType             = PreferencesSettings.VehicleTypePicker;
                SelectVehicleVC.SettingsVC             = this;
                SelectVehicleVC.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                SelectVehicleVC.ModalTransitionStyle   = UIModalTransitionStyle.CoverVertical;
                this.PresentViewController(SelectVehicleVC, true, null);
            };

            // change anchorage type
            btnPosition.TouchUpInside += (object sender, EventArgs e) => {
                var SelectAnchorageVC = storyboard.InstantiateViewController("CustomPickerViewController") as CustomPickerViewController;
                SelectAnchorageVC.pickerType             = PreferencesSettings.AnchorageTypePicker;
                SelectAnchorageVC.SettingsVC             = this;
                SelectAnchorageVC.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                SelectAnchorageVC.ModalTransitionStyle   = UIModalTransitionStyle.CoverVertical;
                this.PresentViewController(SelectAnchorageVC, true, null);
            };

            // Show intro
            btnIntro.TouchUpInside += (object sender, EventArgs e) => {
                IntroductionPageViewController introductionVC = storyboard.InstantiateViewController("IntroductionPageViewController") as IntroductionPageViewController;
                this.NavigationController.PresentViewController(introductionVC, true, null);
            };

            // Re-calibrate
            btnCalibrate.TouchUpInside += (object sender, EventArgs e) => {
                if (_calibrating)
                {
                    return;
                }
                else
                {
                    _calibrating = true;
                    ReCalibrate();
                }
            };
        }
Пример #3
0
 public PageDataSource(IntroductionPageViewController parentController)
 {
     this.parentController = parentController;
 }