public void UpdateCell(UserLog.LogEntry data)
        {
            this.BackgroundColor = StyleSettings.ThemePrimaryDarkLightenedColor();

            lblTime.Text      = data.Timestamp.ToString("T");
            lblTime.TextColor = StyleSettings.ThemePrimaryColor();

            lblText.Text      = data.Message;
            lblText.TextColor = StyleSettings.TextOnDarkColor();

            if (data.Icon != UserLog.Icon.None)
            {
                imgAlert.Hidden = false;
                switch (data.Icon)
                {
                case UserLog.Icon.Warning:
                    imgAlert.Image = UIImage.FromBundle("ic_warning_white");
                    break;

                case UserLog.Icon.Error:
                    imgAlert.Image = UIImage.FromBundle("ic_error_white");
                    break;

                default:
                    imgAlert.Image = UIImage.FromBundle("ic_error_white");
                    break;
                }
            }
            else
            {
                imgAlert.Hidden = true;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            // set data model
            dataModel = SetDataModel();

            btnGo.SetTitle(NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_accept", null).ToUpper(), UIControlState.Normal);
            btnGo.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal);
            btnGo.BackgroundColor = StyleSettings.ThemePrimaryColor();

            // Set pickerview data model
            TypePickerViewModel model = new TypePickerViewModel();

            pickerView.Model = model;
            model.dataModel  = this.dataModel;
            pickerView.ShowSelectionIndicator = true;

            // set default selected row

            // btn handlers
            btnGo.TouchUpInside += (object sender, EventArgs e) => {
                var selected = SetSelectedType(pickerView.SelectedRowInComponent(0));
                this.DismissViewController(true, () => {
                    Settings.LastNumberOfPeople = selected;
                    parentVC.InitRecording();
                });
            };
        }
Example #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Set Localized Strings
            String title = NSBundle.MainBundle.LocalizedString("Vernacular_P0_tutorial_1_title", null).PrepareForLabel();

            lblTitle.Text = title;

            String body = NSBundle.MainBundle.LocalizedString("Vernacular_P0_tutorial_1_text_1", null).PrepareForLabel();

            lblBody.Text = body;

            // Set UI elements
            View.BackgroundColor = StyleSettings.ThemePrimaryDarkLightenedColor();
            lblTitle.TextColor   = StyleSettings.ThemePrimaryColor();
            lblBody.TextColor    = StyleSettings.TextOnDarkColor();
        }
Example #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

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

            lblTitle.Text = title;

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

            lblText.Text = body1;

            // Set UI elements
            View.BackgroundColor = StyleSettings.ThemePrimaryDarkLightenedColor();
            lblTitle.TextColor   = StyleSettings.ThemePrimaryColor();
            lblText.TextColor    = StyleSettings.TextOnDarkColor();
        }
        public void UpdateCell(UploadQueueViewModel.UploadQueueItem data)
        {
            this.BackgroundColor = StyleSettings.ThemePrimaryDarkLightenedColor();

            lblFileName.Text      = data.Filename;
            lblFileName.TextColor = StyleSettings.TextOnDarkColor();

            lblRecorded.Text      = NSBundle.MainBundle.LocalizedString("Vernacular_P0_label_file_creation", null).PrepareForLabel();
            lblRecorded.TextColor = StyleSettings.SubtleTextOnBrightColor();

            lblDate.Text      = data.Created.ToString("ddd dd MMMMM yyyy hh:mm");
            lblDate.TextColor = StyleSettings.TextOnDarkColor();

            lblSize.Text      = NSBundle.MainBundle.LocalizedString("Vernacular_P0_label_file_size", null).PrepareForLabel();
            lblSize.TextColor = StyleSettings.SubtleTextOnBrightColor();

            int ksize = (int)Math.Ceiling(data.FileSize / 1024.0);

            lblSizeData.Text      = string.Format(NSBundle.MainBundle.LocalizedString("Vernacular_P0_label_file_size_value", null).PrepareForLabel(), ksize);
            lblSizeData.TextColor = StyleSettings.TextOnDarkColor();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            String weekText = NSBundle.MainBundle.LocalizedString("Vernacular_P0_stats_week_label", null).PrepareForLabel();

            lblWeekText.Text      = weekText;
            lblWeekText.TextColor = StyleSettings.TextOnDarkColor();

            String overallText = NSBundle.MainBundle.LocalizedString("Vernacular_P0_stats_overall_label", null).PrepareForLabel();

            lblOverallText.Text      = overallText;
            lblOverallText.TextColor = StyleSettings.TextOnDarkColor();

            String lastTrackText = NSBundle.MainBundle.LocalizedString("Vernacular_P0_stats_last_track_label", null).PrepareForLabel();

            lblLastTrackText.Text      = lastTrackText;
            lblLastTrackText.TextColor = StyleSettings.TextOnDarkColor();

            try
            {
                using (var conn = DatabaseUtility.OpenConnection())
                {
                    var week    = StatisticHelper.GetPeriodSummary(conn, StatisticPeriod.Week);
                    var overall = StatisticHelper.GetPeriodSummary(conn, StatisticPeriod.Overall);
                    var last    = StatisticHelper.GetLastTrack(conn);

                    UpdateKmCounter(lblLastTrack, last?.DistanceTraveled);
                    UpdateKmCounter(lblWeek, week.Distance);
                    UpdateKmCounter(lblOverall, overall.Distance);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to load statistics");
            }

            // TODO: add share button
        }
        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();
            };
        }
Example #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            lblTitle.Text      = NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_blablacar_title", null);
            lblTitle.TextColor = StyleSettings.TextOnDarkColor();

            lblBody1.Text      = NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_blablacar_description", null).PrepareForLabel();
            lblBody1.TextColor = StyleSettings.TextOnDarkColor();

            lblBody2.Text      = "";
            lblBody2.TextColor = StyleSettings.TextOnDarkColor();

            lblBody3.Text      = NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_blablacar_action_hint", null);
            lblBody3.TextColor = StyleSettings.TextOnDarkColor();

            btnContinue.SetTitle(NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_blablacar_ignore", null).ToUpper(), UIControlState.Normal);
            btnContinue.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal);
            btnContinue.BackgroundColor = StyleSettings.ThemePrimaryColor();

            btnBlaBla.BackgroundColor = StyleSettings.LightGrayPressedColor();

            btnBlaBla.TouchUpInside += (sender, e) => {
                // Open app if available, else website
                this.DismissViewController(true, () =>
                {
                    OpenBlaBlaCar();
                    parentVC.StartRecordingCommands();
                });
            };

            btnContinue.TouchUpInside += (sender, e) => {
                // Start registration
                this.DismissViewController(true, parentVC.StartRecordingCommands);
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

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

            lblTitle.Text = title;

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

            lblBody1.Text = body1;

            String body2 = NSBundle.MainBundle.LocalizedString("Vernacular_P0_tutorial_7_text_2", null).PrepareForLabel();

            lblBody2.Text = body2;

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

            btnGo.SetTitle(btn, UIControlState.Normal);

            String calibrationLabel = NSBundle.MainBundle.LocalizedString("Vernacular_P0_calibration_not_done", null);

            lblCalibration.Text   = calibrationLabel;
            lblCalibration.Hidden = false;

            // Set UI elements
            View.BackgroundColor     = StyleSettings.ThemePrimaryDarkLightenedColor();
            lblTitle.TextColor       = StyleSettings.ThemePrimaryColor();
            lblBody1.TextColor       = StyleSettings.TextOnDarkColor();
            lblBody2.TextColor       = StyleSettings.TextOnDarkColor();
            lblCalibration.TextColor = StyleSettings.LightGrayColor();
            btnGo.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal);
            btnGo.Layer.CornerRadius = 5;
#if DEBUG
            btnGo.Enabled = true;
#else
            btnGo.Enabled = false;
#endif
            btnGo.BackgroundColor = StyleSettings.LightGrayColor();

            if (Settings.CalibrationDone)
            {
                btnGo.Enabled         = true;
                btnGo.BackgroundColor = StyleSettings.ThemePrimaryColor();
                lblCalibration.Hidden = true;
            }

            btnGo.TouchUpInside += (object sender, EventArgs e) => {
                if (NSUserDefaults.StandardUserDefaults.BoolForKey(PreferencesSettings.FirstLaunchKey))
                {
                    IntroVC.DismissViewController(true, null);
                }
                else
                {
                    NSUserDefaults.StandardUserDefaults.SetBool(true, PreferencesSettings.FirstLaunchKey);
                    var window = UIApplication.SharedApplication.KeyWindow;
                    window.RootViewController = new RootViewController();
                }
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

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

            lblTitle.Text = title;

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

            lblBody1.Text = body1;

            String matString   = NSBundle.MainBundle.LocalizedString("Vernacular_P0_anchorage_mat", null).PrepareForLabel();
            String staffString = NSBundle.MainBundle.LocalizedString("Vernacular_P0_anchorage_bracket", null).PrepareForLabel();
            String otherString = NSBundle.MainBundle.LocalizedString("Vernacular_P0_anchorage_pocket", null).PrepareForLabel();

            lblBody2.Text = staffString;

            String bottom = NSBundle.MainBundle.LocalizedString("Vernacular_P0_tutorial_bottom_question_notice", null).PrepareForLabel();

            lblBottom.Text = bottom;

            // Set UI elements
            View.BackgroundColor = StyleSettings.ThemePrimaryDarkLightenedColor();
            lblTitle.TextColor   = StyleSettings.ThemePrimaryColor();
            lblBody1.TextColor   = StyleSettings.TextOnDarkColor();
            lblBody2.TextColor   = StyleSettings.ThemePrimaryColor();
            lblBottom.TextColor  = StyleSettings.SubduedTextOnDarkColor();
            btnMat.SetTitle("", UIControlState.Normal);
            btnStaff.SetTitle("", UIControlState.Normal);
            btnOther.SetTitle("", UIControlState.Normal);

            // Set button backgrounds
            btnStaff.ClipsToBounds = true;
            btnStaff.ContentMode   = UIViewContentMode.ScaleAspectFit;
            btnStaff.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_bracket", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
            btnMat.ClipsToBounds = true;
            btnMat.ContentMode   = UIViewContentMode.ScaleAspectFit;
            btnMat.SetBackgroundImage(UIImage.FromBundle("icon_mat"), UIControlState.Normal);
            btnOther.ClipsToBounds = true;
            btnOther.ContentMode   = UIViewContentMode.ScaleAspectFit;
            btnOther.SetBackgroundImage(UIImage.FromBundle("icon_pocket"), UIControlState.Normal);

            // Button handlers

            // car button
            btnMat.TouchUpInside += delegate {
                btnMat.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_mat", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
                btnStaff.SetBackgroundImage(UIImage.FromBundle("icon_bracket"), UIControlState.Normal);
                btnOther.SetBackgroundImage(UIImage.FromBundle("icon_pocket"), UIControlState.Normal);

                lblBody2.Text = matString;
                selectAnchorage(AnchorageType.MobileMat);
            };

            // motorcycle button
            btnStaff.TouchUpInside += delegate {
                btnStaff.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_bracket", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
                btnMat.SetBackgroundImage(UIImage.FromBundle("icon_mat"), UIControlState.Normal);
                btnOther.SetBackgroundImage(UIImage.FromBundle("icon_pocket"), UIControlState.Normal);

                lblBody2.Text = staffString;
                selectAnchorage(AnchorageType.MobileBracket);
            };

            // truck button
            btnOther.TouchUpInside += delegate {
                btnOther.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_pocket", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
                btnStaff.SetBackgroundImage(UIImage.FromBundle("icon_bracket"), UIControlState.Normal);
                btnMat.SetBackgroundImage(UIImage.FromBundle("icon_mat"), UIControlState.Normal);

                lblBody2.Text = otherString;
                selectAnchorage(AnchorageType.Pocket);
            };
        }
        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 override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Localized texts
            String title = NSBundle.MainBundle.LocalizedString("Vernacular_P0_app_name", null).PrepareForLabel();

            lblTitle.Text      = title;
            lblTitle.TextColor = StyleSettings.TextOnDarkColor();

            lblVersion.Text      = String.Format("{0}.{1}", App.Version.Major, App.Version.Minor);
            lblVersion.TextColor = StyleSettings.ThemePrimaryColor();

            String developed = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_developed_by", null).ToUpper().PrepareForLabel();

            lblDeveloped.Text      = developed;
            lblDeveloped.TextColor = StyleSettings.ThemePrimaryColor();

            String developedWithC4rs = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_c4rs", null).PrepareForLabel();

            lblDevelopedWith.Text      = developedWithC4rs;
            lblDevelopedWith.TextColor = StyleSettings.TextOnDarkColor();

            String university = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_author", null).PrepareForLabel();

            lblUniversity.Text      = university;
            lblUniversity.TextColor = StyleSettings.TextOnDarkColor();

            String collaborators = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_contributors", null).ToUpper().PrepareForLabel();

            lblCollaborators.Text      = collaborators;
            lblCollaborators.TextColor = StyleSettings.ThemePrimaryColor();

            String collaboratorList = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_authors", null).PrepareForLabel();

            lblCollaboratorList.Text      = collaboratorList;
            lblCollaboratorList.TextColor = StyleSettings.TextOnDarkColor();

            String design = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_icon_design", null).ToUpper().PrepareForLabel();

            lblDesign.Text      = design;
            lblDesign.TextColor = StyleSettings.ThemePrimaryColor();

            String designInfo = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_icon_design_text", null).PrepareForLabel();

            lblDesignInfo.Text      = designInfo;
            lblDesignInfo.TextColor = StyleSettings.TextOnDarkColor();

            String comments = NSBundle.MainBundle.LocalizedString("Vernacular_P0_about_feedback", null).ToUpper().PrepareForLabel();

            lblComments.Text      = comments;
            lblComments.TextColor = StyleSettings.ThemePrimaryColor();

            String email = NSBundle.MainBundle.LocalizedString("Vernacular_P0_mail_address", null).PrepareForLabel();

            btnEmail.SetTitle(email, UIControlState.Normal);
            btnEmail.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal);

            lblAppInfo.Text      = App.ApplicationInformation + ".";
            lblAppInfo.TextColor = StyleSettings.SubtleTextOnDarkColor();

            btnEmail.TouchUpInside += (object sender, EventArgs e) => {
                // Send Email
                MFMailComposeViewController mailController;

                if (MFMailComposeViewController.CanSendMail)
                {
                    Log.Debug("opening mail controller");
                    // Set mail composer
                    mailController = new MFMailComposeViewController();

                    // populate email
                    mailController.SetToRecipients(new string[] { NSBundle.MainBundle.LocalizedString("Vernacular_P0_mail_address", null) });
                    mailController.SetSubject(NSBundle.MainBundle.LocalizedString("Vernacular_P0_app_name", null));

                    // activate send button
                    mailController.Finished += (object s, MFComposeResultEventArgs args) => {
                        Console.WriteLine(args.Result.ToString());
                        args.Controller.DismissViewController(true, null);
                    };

                    // present view controller
                    this.PresentViewController(mailController, true, null);
                }
                else
                {
                    Log.Debug("failed opening mail controller");

                    String errorTitle = NSBundle.MainBundle.LocalizedString("Vernacular_P0_information_message_title_engine_error", null).PrepareForLabel();
                    String errorBody  = NSBundle.MainBundle.LocalizedString("Vernacular_P0_error_send_mail_not_configured", null).PrepareForLabel();

                    //Create Alert
                    var errorAlertController = UIAlertController.Create(errorTitle, errorBody, UIAlertControllerStyle.Alert);

                    //Add Actions
                    errorAlertController.AddAction(UIAlertAction.Create(NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_ok", null), UIAlertActionStyle.Default, null));

                    //Present Alert
                    PresentViewController(errorAlertController, true, null);
                }
            };
        }
Example #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

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

            lblTitle.Text = title;

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

            lblBody1.Text = body1;

            String motorcycleString = NSBundle.MainBundle.LocalizedString("Vernacular_P0_vehicle_motorcycle", null).PrepareForLabel();
            String carString        = NSBundle.MainBundle.LocalizedString("Vernacular_P0_vehicle_car", null).PrepareForLabel();
            String truckString      = NSBundle.MainBundle.LocalizedString("Vernacular_P0_vehicle_truck", null).PrepareForLabel();

            lblBody2.Text = carString;

            String bottom = NSBundle.MainBundle.LocalizedString("Vernacular_P0_tutorial_bottom_question_notice", null).PrepareForLabel();

            lblBottom.Text = bottom;

            // Set UI String elements
            View.BackgroundColor = StyleSettings.ThemePrimaryDarkLightenedColor();
            lblTitle.TextColor   = StyleSettings.ThemePrimaryColor();
            lblBody1.TextColor   = StyleSettings.TextOnDarkColor();
            lblBody2.TextColor   = StyleSettings.ThemePrimaryColor();
            lblBottom.TextColor  = StyleSettings.SubduedTextOnDarkColor();
            btnCar.SetTitle("", UIControlState.Normal);
            btnMotorcycle.SetTitle("", UIControlState.Normal);
            btnTruck.SetTitle("", UIControlState.Normal);

            // Set button backgrounds
            btnMotorcycle.ClipsToBounds = true;
            btnMotorcycle.ContentMode   = UIViewContentMode.ScaleAspectFit;
            btnMotorcycle.SetBackgroundImage(UIImage.FromBundle("icon_motorcycle"), UIControlState.Normal);
            btnCar.ClipsToBounds = true;
            btnCar.ContentMode   = UIViewContentMode.ScaleAspectFit;
            btnCar.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_car", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
            btnTruck.ClipsToBounds = true;
            btnTruck.ContentMode   = UIViewContentMode.ScaleAspectFit;
            btnTruck.SetBackgroundImage(UIImage.FromBundle("icon_bus"), UIControlState.Normal);

            // Button handlers

            // car button
            btnCar.TouchUpInside += delegate {
                btnCar.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_car", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
                btnMotorcycle.SetBackgroundImage(UIImage.FromBundle("icon_motorcycle"), UIControlState.Normal);
                btnTruck.SetBackgroundImage(UIImage.FromBundle("icon_bus"), UIControlState.Normal);

                lblBody2.Text = carString;
                selectVehicle(VehicleType.Car);
            };

            // motorcycle button
            btnMotorcycle.TouchUpInside += delegate {
                btnMotorcycle.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_motorcycle", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
                btnCar.SetBackgroundImage(UIImage.FromBundle("icon_car"), UIControlState.Normal);
                btnTruck.SetBackgroundImage(UIImage.FromBundle("icon_bus"), UIControlState.Normal);

                lblBody2.Text = motorcycleString;
                selectVehicle(VehicleType.Motorcycle);
            };

            // truck button
            btnTruck.TouchUpInside += delegate {
                btnTruck.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_bus", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
                btnMotorcycle.SetBackgroundImage(UIImage.FromBundle("icon_motorcycle"), UIControlState.Normal);
                btnCar.SetBackgroundImage(UIImage.FromBundle("icon_car"), UIControlState.Normal);

                lblBody2.Text = truckString;
                selectVehicle(VehicleType.Truck);
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UIBarButtonItem trash = new UIBarButtonItem(
                UIBarButtonSystemItem.Trash,
                (s, e) => {
                //Create Alert
                var title = NSBundle.MainBundle.LocalizedString("Vernacular_P0_title_queue", null).PrepareForLabel();
                var body  = NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_queue_clear_description", null).PrepareForLabel();
                var okCancelAlertController = UIAlertController.Create(title, body, UIAlertControllerStyle.Alert);

                //Add Actions
                var okString     = NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_queue_clear_delete_all", null).PrepareForLabel();
                var cancelString = NSBundle.MainBundle.LocalizedString("Vernacular_P0_dialog_cancel", null).PrepareForLabel();

                okCancelAlertController.AddAction(UIAlertAction.Create(okString, UIAlertActionStyle.Default, alert => {
                    if (ViewModel != null)
                    {
                        ViewModel.ClearUploadQueueCommand.Execute(null);
                        RefreshList();
                    }
                }
                                                                       ));
                okCancelAlertController.AddAction(UIAlertAction.Create(cancelString, UIAlertActionStyle.Cancel, null));

                //Present Alert
                PresentViewController(okCancelAlertController, true, null);
            }
                );

            // Add button to item array
            barButtonItems[0] = trash;

            // add navigation items to navigation bar
            NavigationItem.RightBarButtonItems = barButtonItems;

            // Perform any additional setup after loading the view, typically from a nib.
            tableView.SeparatorColor = StyleSettings.SubtleTextOnDarkColor();
            UIView view = new UIView(new CGRect(0, 0, 1, 1));

            tableView.TableFooterView = view;

            String noData = NSBundle.MainBundle.LocalizedString("Vernacular_P0_status_no_files_in_queue", null).PrepareForLabel();

            lblNoData.Text = noData;

            String forceUpload = NSBundle.MainBundle.LocalizedString("Vernacular_P0_action_force_upload", null).PrepareForLabel().ToUpper();

            btnPushData.SetTitle(forceUpload, UIControlState.Normal);

            btnPushData.BackgroundColor = StyleSettings.ThemePrimaryColor();
            btnPushData.SetTitleColor(StyleSettings.TextOnDarkColor(), UIControlState.Normal);
            btnPushData.Layer.CornerRadius = 2;

            // Initialize data
            //View model setup
            ViewModel = new UploadQueueViewModel();
            ViewModel.OnCreate();

            ViewModel.UploadQueueUpdated += HandleUploadQueueUpdated;
            ViewModel.IsUploadingChanged += HandleIsUploadingChanged;

            ViewModel.RefreshQueueCommand.Execute(null);

            // Add table source
            tableSource      = new DataTableSource(this.tableView, this);
            tableSource.data = ViewModel;
            tableView.Source = tableSource;

            // handle force upload button click
            btnPushData.TouchUpInside += (object sender, EventArgs e) => {
                TryDataUpload();
            };

            ViewModel.IsUploadingChanged += (object sender, EventArgs e) => {
                if (ViewModel.IsUploading)
                {
                    btnPushData.Enabled = false;

                    // derive the center x and y
                    nfloat centerX = this.View.Frame.Width / 2;
                    nfloat centerY = this.View.Frame.Height / 2;

                    // create the activity spinner, center it horizontall and put it 5 points above center x
                    activitySpinner       = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
                    activitySpinner.Frame = new RectangleF(
                        (float)(centerX - (activitySpinner.Frame.Width / 2)),
                        (float)(centerY - activitySpinner.Frame.Height - 20),
                        (float)activitySpinner.Frame.Width,
                        (float)activitySpinner.Frame.Height);
                    activitySpinner.AutoresizingMask = UIViewAutoresizing.All;
                    this.View.AddSubview(activitySpinner);
                    activitySpinner.StartAnimating();
                }
                else
                {
                    btnPushData.Enabled = true;
                    activitySpinner.RemoveFromSuperview();
                }
            };
        }