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

            _pageViewController = new MultiStepProcessHorizontalViewController(new MultiStepProcessDataSource(Steps), this);
            _pageControl        = new UIPageControl
            {
                CurrentPage            = 0,
                Pages                  = Steps.Count,
                BackgroundColor        = UIColor.Gray,
                PageIndicatorTintColor = UIColor.Green,                //FromHex(0x4F8C13),//UIColor.Green,
                Frame                  = new CGRect(0, UIScreen.MainScreen.Bounds.Height - 50, UIScreen.MainScreen.Bounds.Width, 50)
            };


            View.Add(_pageViewController.View);
            View.Add(_pageControl);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UIImageView background = new UIImageView();

//assign our image file to the UIImageView
            background.Image = UIImage.FromBundle("new_home_bg1");

            //assign the UIImageView as the background view of the table
            this.TableView.BackgroundView = background;

            //set the textbox background to light gray
            this.TableView.BackgroundColor = UIColor.LightGray;

            //set the background of each table cell to clear
            foreach (var cell in this.TableView.VisibleCells)
            {
                cell.BackgroundColor = UIColor.Clear;
                cell.SelectionStyle  = UITableViewCellSelectionStyle.None;
            }

            var statusBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height;

            MultiStepProcessHorizontalViewController parentViewController = this.ParentViewController as MultiStepProcessHorizontalViewController;
            var navigationController = parentViewController.ContainerViewController.NavigationController;
            var navBarHeight         = navigationController.NavigationBar.Bounds.Height;

            TableView.ContentInset = new UIEdgeInsets(statusBarHeight + navBarHeight, 0, 50, 0);

            MapCCodeList         = new List <Location>();
            LocationList         = new List <Location>();
            provinceList         = new List <Location>();
            stateList            = new List <Location>();
            FilteredLocationList = new List <Location>();
            SelectedMapCCode     = new Location();
            SelectedLocation     = new Location();

            LocationsPickerViewProperty.Alpha = 0f;
            //LocationPickerWidthConstraintProperty.Constant = 0f;
            //if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            //{
            //	MapCCodePickerWidthConstraint.Constant = 80f;
            //}
            //else {
            //	MapCCodePickerWidthConstraint.Constant = 150f;
            //}

            //Load values if already registered
            if (Settings.IsRegistered)
            {
                EmailTextField.Text       = Settings.Email;
                PasswordTextField.Text    = Settings.Password;
                FirstNameTextField.Text   = Settings.FirstName;
                LastNameTextField.Text    = Settings.LastName;
                PhoneTextField.Text       = Settings.Phone;
                CompanyTextField.Text     = Settings.Company;
                HomeAirportTextField.Text = Settings.HomeAirport;
            }

            //hide keyboard when touch anywhere
            HideKeyboardGesture = new UITapGestureRecognizer(() =>
            {
                View.EndEditing(true);
            });

            Task.Run(async() =>
            {
                LocationResponse location = new LocationResponse();
                if (Reachability.IsHostReachable(Settings._baseDomain))
                {
                    location = await LocationResponse.GetLocations();
                    if (location.Status != "Success")
                    {
                        InvokeOnMainThread(() =>
                        {
                            var alert = UIAlertController.Create("There was a problem loading registration data", "Please try again.", UIAlertControllerStyle.Alert);

                            alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) =>
                            {
                                RegistrationViewController registrationVC = (RegistrationViewController)((MultiStepProcessHorizontalViewController)this.ParentViewController).ContainerViewController;
                                //var firstStep = registrationVC.Steps.FirstOrDefault();
                                //registrationVC._pageViewController.SetViewControllers(new[] { firstStep as UIViewController }, UIPageViewControllerNavigationDirection.Reverse, true, (finished) =>
                                //{
                                //	if (finished)
                                //	{
                                //		//finalStep.StepActivated(this, new MultiStepProcessStepEventArgs());

                                //	}
                                //});
                                registrationVC.DismissViewController(true, null);
                            }));

                            PresentViewController(alert, animated: true, completionHandler: () =>
                            {
                            });
                        });
                    }
                    else
                    {
                        //Save to settings file to use object during the rest of the registration process
                        Settings.LocationResponse = location;

                        var distinctMapCodes = location.Locations.Select(row => row.MapCCode).Distinct().ToList();
                        List <Location> filteredLocationListByFirstMapCode = new List <Location>();
                        foreach (var mapCode in distinctMapCodes)
                        {
                            Location loc = location.Locations.FirstOrDefault(row => row.MapCCode == mapCode);

                            if (loc != null)
                            {
                                if (loc.MapCCode == "WO")
                                {
                                    Location placeholderLocation     = new Location();
                                    placeholderLocation.LocationId   = loc.LocationId;
                                    placeholderLocation.LocName      = "World";
                                    placeholderLocation.Abbreviation = loc.Abbreviation;
                                    placeholderLocation.MapCCode     = loc.MapCCode;
                                    placeholderLocation.DisplayOrder = loc.DisplayOrder;
                                    filteredLocationListByFirstMapCode.Add(placeholderLocation);
                                }
                                else
                                {
                                    filteredLocationListByFirstMapCode.Add(loc);
                                }
                            }
                        }
                        MapCCodeList = filteredLocationListByFirstMapCode.OrderByDescending(row => row.DisplayOrder).ToList();

                        Location sleLocation     = new Location();
                        sleLocation.LocationId   = 0;
                        sleLocation.LocName      = "Select";
                        sleLocation.Abbreviation = "Select";
                        sleLocation.MapCCode     = "SE";
                        sleLocation.DisplayOrder = 0;
                        MapCCodeList.Insert(0, sleLocation);

                        LocationList         = location.Locations.OrderBy(row => row.DisplayOrder).ToList();
                        provinceList         = location.ProvinceLst.OrderBy(row => row.DisplayOrder).ToList();
                        stateList            = location.StatesLst.OrderBy(row => row.DisplayOrder).ToList();
                        FilteredLocationList = LocationList;

                        if (MapCCodeList.Count > 1 && Settings.LocationPickerSelectedId == 0)
                        {
                            //Assign value to registration objec
                            Settings.LocationPickerSelectedId = MapCCodeList[0].LocationId;
                        }

                        InvokeOnMainThread(() =>
                        {
                            MapCCodePicker.Model = new MapCCodeMod(this);
                            LocationPicker.Model = new LocationsMod(this);

                            if (Settings.IsRegistered)
                            {
                                var previouslSelectedLocation = MapCCodeList.FirstOrDefault(row => row.LocationId == Settings.LocationPickerSelectedId);

                                if (previouslSelectedLocation != null)
                                {
                                    int currentIndex = MapCCodeList.IndexOf(MapCCodeList.FirstOrDefault(row => row.LocationId == Settings.LocationPickerSelectedId));;
                                    MapCCodePicker.Select(currentIndex, 0, true);
                                }
                                else
                                {
                                    if (Settings.LocationPickerSelectedId != 0)
                                    {
                                        int locationId = Settings.LocationPickerSelectedId;
                                        int mapCIndex  = MapCCodeList.IndexOf(MapCCodeList.FirstOrDefault(row => row.LocationId == 0));
                                        MapCCodePicker.Select(mapCIndex, 0, true);
                                        MapCCodePicker.Model.Selected(MapCCodePicker, mapCIndex, 0);

                                        int locationCInddex = FilteredLocationList.IndexOf(FilteredLocationList.FirstOrDefault(row => row.LocationId == locationId));
                                        LocationPicker.Select(locationCInddex, 0, true);
                                        LocationPicker.Model.Selected(LocationPicker, locationCInddex, 0);
                                        //LocationPicker.Alpha = 1f;
                                    }
                                }
                            }
                            else
                            {
                                //MapCCodePicker.Model.Selected(MapCCodePicker, 0, 0);
                                MapCCodePicker.Select(0, 0, true);
                            }
                        });
                    }
                }
                else
                {
                    InvokeOnMainThread(() =>
                    {
                        var alert = UIAlertController.Create("Please connect to the internet", "Internet access is required.", UIAlertControllerStyle.Alert);

                        alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) =>
                        {
                            RegistrationViewController registrationVC = (RegistrationViewController)((MultiStepProcessHorizontalViewController)this.ParentViewController).ContainerViewController;
                            //var firstStep = registrationVC.Steps.FirstOrDefault();
                            //registrationVC._pageViewController.SetViewControllers(new[] { firstStep as UIViewController }, UIPageViewControllerNavigationDirection.Reverse, true, (finished) =>
                            //{
                            //	if (finished)
                            //	{
                            //		//finalStep.StepActivated(this, new MultiStepProcessStepEventArgs());

                            //	}
                            //});
                            registrationVC.DismissViewController(true, null);
                        }));

                        PresentViewController(alert, animated: true, completionHandler: () =>
                        {
                        });
                    });
                }
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UIImageView background = new UIImageView();

//assign our image file to the UIImageView
            background.Image = UIImage.FromBundle("new_home_bg1");

            //assign the UIImageView as the background view of the table
            this.TableView.BackgroundView = background;

            //set the textbox background to light gray
            this.TableView.BackgroundColor = UIColor.LightGray;

            //set the background of each table cell to clear
            foreach (var cell in this.TableView.VisibleCells)

            {
                cell.BackgroundColor = UIColor.Clear;
                cell.SelectionStyle  = UITableViewCellSelectionStyle.None;
            }

            var statusBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height;

            MultiStepProcessHorizontalViewController parentViewController = this.ParentViewController as MultiStepProcessHorizontalViewController;
            var navigationController = parentViewController.ContainerViewController.NavigationController;
            var navBarHeight         = navigationController.NavigationBar.Bounds.Height;

            TableView.ContentInset = new UIEdgeInsets(statusBarHeight + navBarHeight, 0, 50, 0);

            TypeLabel.Alpha   = 0f;
            RatingLabel.Alpha = 0f;

            TypePickerView.Alpha   = 0f;
            RatingPickerView.Alpha = 0f;

            TypePickerView.Model   = new PilotTypeModel(this);
            RatingPickerView.Model = new RatingModel();

            if (Settings.IsPilot)
            {
                PilotSwitch.On       = true;
                TypeLabel.Alpha      = 1f;
                TypePickerView.Alpha = 1f;

                int statusIndex = Settings.LocationResponse.AreYouAPilot.IndexOf(Settings.LocationResponse.AreYouAPilot.FirstOrDefault(row => row.PilotStatusId == Settings.PilotStatusId));
                TypePickerView.Select(statusIndex, 0, true);
                TypePickerView.Model.Selected(TypePickerView, statusIndex, 0);



                int ratingIndex = Settings.LocationResponse.PilotRating.IndexOf(Settings.LocationResponse.PilotRating.FirstOrDefault(row => row.PilotTypeId == Settings.PilotTypeId));
                RatingPickerView.Select(ratingIndex, 0, true);
                RatingPickerView.Model.Selected(RatingPickerView, ratingIndex, 0);
            }
            else
            {
                PilotSwitch.On       = false;
                TypeLabel.Alpha      = 0f;
                TypePickerView.Alpha = 0f;
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UIImageView background = new UIImageView();

//assign our image file to the UIImageView
            background.Image = UIImage.FromBundle("new_home_bg1");

            //assign the UIImageView as the background view of the table
            this.TableView.BackgroundView = background;

            //set the textbox background to light gray
            this.TableView.BackgroundColor = UIColor.LightGray;

            //set the background of each table cell to clear
            foreach (var cell in this.TableView.VisibleCells)

            {
                cell.BackgroundColor = UIColor.Clear;
                cell.SelectionStyle  = UITableViewCellSelectionStyle.None;
            }

            var statusBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height;

            MultiStepProcessHorizontalViewController parentViewController = this.ParentViewController as MultiStepProcessHorizontalViewController;
            var navigationController = parentViewController.ContainerViewController.NavigationController;
            var navBarHeight         = navigationController.NavigationBar.Bounds.Height;

            TableView.ContentInset = new UIEdgeInsets(statusBarHeight + navBarHeight, 0, 50, 0);

            ManufacturePicker.Alpha = 0f;
            DesigPickerView.Alpha   = 0f;

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            {
                //ClassWidthConstraint.Constant = 150f;
                //ManufactureWidthConstraint.Constant = 150f;
                //DesigWidthConstraint.Constant = 150f;
            }

            ClassPicker.Model       = new ClassModel(this);
            TimeframePicker.Model   = new TimeframeModel();
            PurposePicker.Model     = new PurposeModel();
            SortOptionsPicker.Model = new SortOptionsModel();

            if (Settings.ClassificationId != 0)
            {
                int classIndex = Settings.ClassificationList.IndexOf(Settings.ClassificationList.FirstOrDefault(row => row.ClassificationId == Settings.ClassificationId));
                ClassPicker.Select(classIndex, 0, true);
                ClassPicker.Model.Selected(ClassPicker, classIndex, 0);
            }

            if (Settings.PurchaseTimeFrame != 0)
            {
                int classIndex = 0;
                if (Settings.PurchaseTimeFrame == 3)
                {
                    classIndex = 1;
                }
                if (Settings.PurchaseTimeFrame == 12)
                {
                    classIndex = 2;
                }
                TimeframePicker.Select(classIndex, 0, true);
                TimeframePicker.Model.Selected(TimeframePicker, classIndex, 0);
            }

            if (Settings.PurposeId != 0)
            {
                //Settings.LocationResponse.PurposeForFlying
                int purposeIndex = Settings.LocationResponse.PurposeForFlying.IndexOf(Settings.LocationResponse.PurposeForFlying.FirstOrDefault(row => row.FlyingPurposeId == Settings.PurposeId));
                PurposePicker.Select(purposeIndex, 0, true);
                PurposePicker.Model.Selected(PurposePicker, purposeIndex, 0);
            }

            HoursTextField.Text = Settings.Hours.ToString();

            if (Settings.SortOptions != string.Empty)
            {
                //SortOptionsList.Add("No Preference");
                //SortOptionsList.Add("Recently Updated");
                //SortOptionsList.Add("Price");
                //SortOptionsList.Add("Total Time");
                int sortIndex = 0;
                if (Settings.SortOptions == "No Preference")
                {
                    sortIndex = 0;
                }

                if (Settings.SortOptions == "Recently Updated")
                {
                    sortIndex = 1;
                }

                if (Settings.SortOptions == "Price")
                {
                    sortIndex = 2;
                }

                if (Settings.SortOptions == "Total Time")
                {
                    sortIndex = 3;
                }
                SortOptionsPicker.Select(sortIndex, 0, true);
                SortOptionsPicker.Model.Selected(SortOptionsPicker, sortIndex, 0);
            }

            //hide keyboard when touch anywhere
            HideKeyboardGesture = new UITapGestureRecognizer(() =>
            {
                View.EndEditing(true);
            });
        }