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();
                });
            };
        }
        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 UIView GetView(UIPickerView pickerView, nint row, nint component, UIView view)
            {
                UILabel lbl = new UILabel(new RectangleF(0, 0, 200f, 40f));

                lbl.TextColor     = StyleSettings.ThemePrimaryColor();
                lbl.TextAlignment = UITextAlignment.Center;
                lbl.Text          = GetTitle(pickerView, row, component);
                return(lbl);
            }
        public static UIColor GetTitleColor(this InformationMessage message)
        {
            switch (message)
            {
            case InformationMessage.UploadFailure:
            case InformationMessage.InternalEngineError:
                return(StyleSettings.ErrorColor());

            default:
                return(StyleSettings.ThemePrimaryColor());
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            // Set Nav Bar Style
            this.NavigationBar.BarStyle        = UIBarStyle.BlackOpaque;
            this.NavigationBar.BarTintColor    = StyleSettings.ThemePrimaryColor();
            this.NavigationBar.TintColor       = UIColor.White;
            this.NavigationBar.BackgroundColor = StyleSettings.ThemePrimaryColor();
            this.NavigationBar.Opaque          = true;
            this.NavigationBar.Translucent     = false;
        }
Exemple #6
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();
        }
        private UIButton SetSupportButton(UIButton btn)
        {
            btn.ClipsToBounds = true;
            btn.ContentMode   = UIViewContentMode.ScaleAspectFit;

            // Anchorage type
            if (Settings.LastAnchorageType == AnchorageType.MobileBracket)
            {
                btn.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_bracket", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
            }
            else if (Settings.LastAnchorageType == AnchorageType.MobileMat)
            {
                btn.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_mat", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
            }
            else if (Settings.LastAnchorageType == AnchorageType.Pocket)
            {
                btn.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_pocket", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
            }
            return(btn);
        }
        private UIButton SetVehicleButton(UIButton btn)
        {
            // Set button backgrounds
            btn.ClipsToBounds = true;
            btn.ContentMode   = UIViewContentMode.ScaleAspectFit;

            // Vehicle type
            if (Settings.LastVehicleType == VehicleType.Motorcycle)
            {
                btn.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_motorcycle", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
            }
            else if (Settings.LastVehicleType == VehicleType.Car)
            {
                btn.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_car", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
            }
            else if (Settings.LastVehicleType == VehicleType.Truck)
            {
                btn.SetBackgroundImage(ChangeImageColor.GetColoredImage("icon_bus", StyleSettings.ThemePrimaryColor()), UIControlState.Normal);
            }

            return(btn);
        }
        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();
            };
        }
Exemple #10
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();

            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);
                }
            };
        }
Exemple #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();
                }
            };
        }