public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Set Localized Strings
            String title = NSBundle.MainBundle.LocalizedString("Vernacular_P0_tutorial_5_title", null).PrepareForLabel();

            lblTitle.Text = title;

            String body1 = NSBundle.MainBundle.LocalizedString("Vernacular_P0_tutorial_5_explanation", null).PrepareForLabel();

            lblBody1.Text = body1;

            String btn = NSBundle.MainBundle.LocalizedString("Vernacular_P0_tutorial_5_calibrate", null).ToUpper().PrepareForLabel();

            btnCalibrate.SetTitle(btn, UIControlState.Normal);

            // Set UI elements
            View.BackgroundColor = StyleSettings.ThemePrimaryDarkLightenedColor();
            lblTitle.TextColor   = StyleSettings.ThemePrimaryColor();
            lblBody1.TextColor   = StyleSettings.TextOnDarkColor();
            lblBody2.TextColor   = StyleSettings.TextOnDarkColor();
            btnCalibrate.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal);
            btnCalibrate.BackgroundColor    = StyleSettings.ThemePrimaryColor();
            btnCalibrate.Layer.CornerRadius = 5;

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

            btnCalibrate.TouchUpInside += (object sender, EventArgs e) => {
                if (_calibrating)
                {
                    return;
                }
                _calibrating = true;
                Calibrate();
            };
        }
        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();
                }
            };
        }
 public Fragment5Calibration()
 {
     _calibrator = Calibrator.Create();
 }
Exemple #4
0
        public CalibrationUiManager()
        {
            _calibrator = Calibrator.Create();

            IsCalibrating = false;
        }