public async override void Selected(UIPickerView picker, nint row, nint component)
        {
            var selected = MfgLst[(int)picker.SelectedRowInComponent(0)];

            //Assign value to registration obje
            Settings.ManufacturerId = selected.ManufacturerId;

            if (selected.ManufacturerId != 0)
            {
                if (Reachability.IsHostReachable(Settings._baseDomain))
                {
                    var manufactuerResponse = await CMMDResponse.GetCMMDResponseAsync(Settings.ClassificationId, Settings.ManufacturerId);

                    Owner.CMMDResonseProperty       = manufactuerResponse;
                    Owner.DesigPickerProperty.Alpha = 1f;
                    Owner.DesigPickerProperty.Model = new DesigModel(Owner);

                    if (Settings.DesignationId != 0)
                    {
                        int desigIndex = manufactuerResponse.ModDesLst.IndexOf(manufactuerResponse.ModDesLst.FirstOrDefault(r => r.DesignationId == Settings.DesignationId));
                        //int desigIndex = 1;
                        Owner.DesigPickerProperty.Select(desigIndex, 0, true);
                        Owner.DesigPickerProperty.Model.Selected(Owner.DesigPickerProperty, desigIndex, 0);
                    }
                }
                else
                {
                    var alert = UIAlertController.Create("Please connect to the internet", "Internet access is required.", UIAlertControllerStyle.Alert);

                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) =>
                    {
                        this.Selected(picker, 0, 0);
                    }));

                    Owner.PresentViewController(alert, animated: true, completionHandler: () =>
                    {
                    });
                }
            }
            else
            {
                Owner.DesigPickerProperty.Alpha = 0f;
            }
        }
        async void CompleteRegistrationButton_TouchUpInside(object sender, EventArgs e)
        {
            if (Reachability.IsHostReachable(Settings._baseDomain))
            {
                LoadingOverlay loadingIndicator = new LoadingOverlay(this.View.Frame, "Loading ...");
                this.View.AddSubview(loadingIndicator);
                //Attempt to register in the API
                var response = await MagAppRegisterResponse.RegisterAsync();

                if (response.Status == "Success")
                {
                    Settings.IsRegistered = true;

                    var alert = UIAlertController.Create("Congratulations!", "You have successfully registered.", UIAlertControllerStyle.Alert);

                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) =>
                    {
                    }));

                    PresentViewController(alert, animated: true, completionHandler: () =>
                    {
                        RegistrationViewController registrationVC = (RegistrationViewController)((MultiStepProcessHorizontalViewController)this.ParentViewController).ContainerViewController;

                        var loginVC = registrationVC.PresentingViewController as LoginViewController;
                        registrationVC.DismissViewController(true, null);
                        if (loginVC != null)
                        {
                            loginVC.PerformSegue("LoadTabBarControllerSeque", loginVC);
                        }
                    });
                }
                else
                {
                    loadingIndicator.Hide();
                    HelperMethods.SendBasicAlert("Oops.", "There was a problem registering. Please try again.");
                }
            }
            else
            {
                HelperMethods.SendBasicAlert("Please connect to the internet", "Internet access is required.");
            }
        }
        async void TechnicalSpecButton_TouchUpInside(object sender, EventArgs e)
        {
            Ad ad = new Ad();

            if (sender == Ad1TechnicalSpecButton)
            {
                ad = DataObject.Ads[0];
            }



            if (AircraftSpecification == null)
            {
                SpecResponse specResponse = new SpecResponse();
                AircraftSpecification = await specResponse.GetSpecBySpecIDDesignationIDAsync(ad.SpecId, ad.DesignationId);
            }

            if (AircraftSpecification.SpecId != 0)
            {
                var specTableViewController = this.Storyboard.InstantiateViewController("SpecViewController_") as SpecViewController_;

                specTableViewController.Spec = AircraftSpecification;

                this.PresentViewController(specTableViewController, true, null);
            }
            else
            {
                if (!Reachability.IsHostReachable(Settings._baseDomain))
                {
                    var alert = UIAlertController.Create("Connect to a Network", "Please connect to a network to retrieve these aircraft specs", UIAlertControllerStyle.Alert);

                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, null));
                    //alert.AddAction(UIAlertAction.Create("Snooze", UIAlertActionStyle.Default, action => Snooze()))
                    if (alert.PopoverPresentationController != null)
                    {
                        alert.PopoverPresentationController.SourceView = this.View;
                        alert.PopoverPresentationController.PermittedArrowDirections = UIPopoverArrowDirection.Up;
                    }
                    PresentViewController(alert, animated: true, completionHandler: null);
                }
            }
        }
        async void CompleteRegistrationButton_TouchUpInside(object sender, EventArgs e)
        {
            Settings.FirstName = FirstNameTextField.Text;
            Settings.LastName  = LastNameTextField.Text;
            Settings.Phone     = MobilePhoneTextField.Text;
            Settings.Company   = CompanyTextField.Text;



            if (Reachability.IsHostReachable(Settings._baseDomain))
            {
                var response = await MagAppRegisterResponse.updateAsync();

                if (response.Status == "Success")
                {
                    Settings.IsRegistered = true;

                    var alert = UIAlertController.Create("Congratulations!", "You have successfully updated.", UIAlertControllerStyle.Alert);

                    alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) =>
                    {
                    }));

                    PresentViewController(alert, animated: true, completionHandler: () =>
                    {
//						UIViewController registrationVC = (this.ParentViewController);

//registrationVC.DismissViewController(true, null);
                    });
                }
                else
                {
                    HelperMethods.SendBasicAlert("Oops.", "There was a problem updating. Please try again.");
                }
            }
            else
            {
                HelperMethods.SendBasicAlert("Please connect to the internet", "Internet access is required.");
            }
        }
        void SendEmail_TouchUpInside(object sender, EventArgs args)
        {
            if (Reachability.IsHostReachable(Settings._baseDomain))
            {
                UIButton senderButton = sender as UIButton;

                EmailInquiryViewController emailInquiryViewController = (EmailInquiryViewController)Storyboard.InstantiateViewController("EmailInquiryViewController");
                Ad ad = new Ad();
                if (senderButton == AdEmail1)
                {
                    ad = DataObject.Ads[0];
                }


                emailInquiryViewController.AdProperty = ad;
                this.PresentViewController(emailInquiryViewController, true, null);
            }
            else
            {
                HelperMethods.SendBasicAlert("Connect to a Network", "Please connect to a network to send this email");
            }
        }
Пример #6
0
        //public override UIView GetViewForHeader(UITableView tableView, int section)
        //{

        //}

        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            //var cell = tableView.CellAt(indexPath);

            var section = keys[indexPath.Section];

            if (section == _rangeSection)
            {
                if (Reachability.IsHostReachable(Settings._baseDomain))
                {
                    var specSection = SpecDictionary[keys[indexPath.Section]];

                    MapViewController mapViewController = (MapViewController)Owner.Storyboard.InstantiateViewController("MapViewController");
                    mapViewController.SpecFieldList = specSection;
                    Owner.ShowDetailViewController(mapViewController, this);
                }

                else
                {
                    HelperMethods.SendBasicAlert("Connect to a Network", Settings._networkProblemMessage);
                }
            }
            tableView.DeselectRow(indexPath, true);
        }
        async void AdRGButton_TouchUpInside(object sender, EventArgs e)
        {
            Ad ad = new Ad();


            if (sender == Ad1RGButton)
            {
                ad = DataObject.Ads[0];
            }

            if (Reachability.IsHostReachable(Settings._baseDomain))
            {
                SpecResponse specResponse = new SpecResponse();

                var specification = await specResponse.GetSpecBySpecIDDesignationIDAsync(ad.SpecId, ad.DesignationId);

                if (specification.SpecId != 0)
                {
                    //var specTableViewController = this.Storyboard.InstantiateViewController("SpecViewController_") as SpecViewController_;

                    //specTableViewController.Spec = specification;

                    //this.PresentViewController(specTableViewController, true, null);

                    MapViewController mapViewController = (MapViewController)Storyboard.InstantiateViewController("MapViewController");

                    mapViewController.SpecFieldList = specification.SpecFieldDictionary[SpecTableViewSource._rangeSection];
                    ShowDetailViewController(mapViewController, this);
                }
            }

            else
            {
                HelperMethods.SendBasicAlert("Connect to a Network", Settings._networkProblemMessage);
            }
        }
        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: () =>
                        {
                        });
                    });
                }
            });
        }
Пример #9
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            Gai.SharedInstance.DispatchInterval        = 20;
            Gai.SharedInstance.TrackUncaughtExceptions = true;

            Tracker = Gai.SharedInstance.GetTracker(TrackingId);

            //Clay Martin 10/21/17: Allowing IDFA collection for more sophisticated analytics
            Tracker.SetAllowIdfaCollection(true);

            // Code to start the Xamarin Test Cloud Agent
#if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
#endif
            // Make sure you set the application name before doing any inserts or gets
            BlobCache.ApplicationName = "AircraftForSaleAkavache";
            Window = new UIWindow(UIScreen.MainScreen.Bounds);

            //Wait until need to update content in the background... once implemented let the OS decide how often to fetch new content
            UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum);

            //Register for push notifications is user indicates wishes to receive
            if (Settings.IsRegisterForPushNotifications)
            {
                this.PromptForPushNotifications();
            }

            var              storyboard    = UIStoryboard.FromName("Main_ipad", NSBundle.MainBundle);
            bool             skipFirstStep = Settings.IsRegistered;
            UIViewController rootViewController;
            if (skipFirstStep)
            {
                rootViewController = storyboard.InstantiateViewController("MainTabBarController") as MainTabBarController;
            }
            else
            {
                rootViewController = storyboard.InstantiateInitialViewController();
            }

            Window.RootViewController = rootViewController;
            Window.MakeKeyAndVisible();


            UINavigationBar.Appearance.BarTintColor = UIColor.Black;


            if (!Reachability.IsHostReachable(Settings._baseDomain))
            {
                var alert = UIAlertController.Create("Connect to a Network", Settings._networkProblemMessage, UIAlertControllerStyle.Alert);

                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, null));

                if (alert.PopoverPresentationController != null)
                {
                    alert.PopoverPresentationController.SourceView = rootViewController.View;
                    alert.PopoverPresentationController.PermittedArrowDirections = UIPopoverArrowDirection.Up;
                }
                rootViewController.PresentViewController(alert, animated: true, completionHandler: null);
            }
            else
            {
                //Determine if need to dump cache
                if (Settings.LastImageCacheDump != string.Empty)
                {
                    DateTime startDate = DateTime.Parse(Settings.LastImageCacheDump);
                    double   days      = (DateTime.Now - startDate).TotalDays;
                    if (days > 7)
                    {
                        SDImageCache.SharedImageCache.ClearMemory();
                        SDImageCache.SharedImageCache.ClearDisk();
                        Settings.LastImageCacheDump = string.Empty;
                    }
                }

                //Determine if app was launched from a push notification

                if (launchOptions != null && launchOptions.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    launchedFromPushNotification = true;
                }
                else
                {
                    launchedFromPushNotification = false;
                }

                if (!launchedFromPushNotification)
                {
                    //Task.Run(async () =>
                    //{
                    //    await PerformBackgroundDataFetchFromBuyplaneAPI(() =>
                    //    {
                    //        InvokeOnMainThread(() =>
                    //        {

                    var vc = Window.RootViewController;
                    while (vc.PresentedViewController != null)
                    {
                        vc = vc.PresentedViewController;
                    }

                    if (vc is MainTabBarController)
                    {
                        var maintTabBarController = vc as MainTabBarController;
                        var magNavVC = maintTabBarController.ViewControllers.FirstOrDefault(row => row is MagazineNavigationViewController);
                        if (magNavVC != null)
                        {
                            var chooseClassVC = (magNavVC as MagazineNavigationViewController).ViewControllers.FirstOrDefault(row => row is ChooseClassificationCollectionViewController);
                            if (chooseClassVC != null)
                            {
                                (chooseClassVC as ChooseClassificationCollectionViewController).LoadBackgroundImages();
                                if (launchOptions != null && launchOptions.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                                {
                                    NSDictionary notificationDictionary = launchOptions[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                                    ReceivedRemoteNotification(application, notificationDictionary);
                                }
                            }
                        }
                    }

                    //        });

                    //    });
                    //});
                }
                else
                {
                    var vc = Window.RootViewController;
                    while (vc.PresentedViewController != null)
                    {
                        vc = vc.PresentedViewController;
                    }

                    if (vc is MainTabBarController)
                    {
                        var maintTabBarController = vc as MainTabBarController;
                        var magNavVC = maintTabBarController.ViewControllers.FirstOrDefault(row => row is MagazineNavigationViewController);
                        if (magNavVC != null)
                        {
                            var chooseClassVC = (magNavVC as MagazineNavigationViewController).ViewControllers.FirstOrDefault(row => row is ChooseClassificationCollectionViewController);
                            if (chooseClassVC != null)
                            {
                                (chooseClassVC as ChooseClassificationCollectionViewController).LoadBackgroundImages();
                                if (launchOptions != null && launchOptions.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                                {
                                    NSDictionary notificationDictionary = launchOptions[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                                    ReceivedRemoteNotification(application, notificationDictionary);
                                }
                            }
                        }
                    }
                }


                //});
            }



            return(true);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            PageHeaderLabel.BackgroundColor = UIColor.Gray;

            SizeF size = new SizeF(320, UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? 600 : 800);

            ProfileScrollView.ContentSize = size;


            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();


            FirstNameTextField.AttributedPlaceholder = new NSAttributedString(
                "FIRST NAME",
                font: FirstNameTextField.Font,
                foregroundColor: UIColor.White
                );

            LastNameTextField.AttributedPlaceholder = new NSAttributedString(

                "LAST NAME",
                font: LastNameTextField.Font,
                foregroundColor: UIColor.White
                );

            MobilePhoneTextField.AttributedPlaceholder = new NSAttributedString(
                "MOBILE PHONE",
                font: MobilePhoneTextField.Font,
                foregroundColor: UIColor.White
                );



            CompanyTextField.AttributedPlaceholder = new NSAttributedString(
                "COMPANY",
                font: CompanyTextField.Font,
                foregroundColor: UIColor.White
                );


            FirstNameTextField.Text   = Settings.FirstName;
            MobilePhoneTextField.Text = Settings.Phone;
            LastNameTextField.Text    = Settings.LastName;
            //Task.Run(async () => {
            //	try
            //	{
            //		AuthResponse response1 = await AuthResponse.GetAuthResponseAsync(Settings.AppID, Settings.Username, Settings.Password);

            //		APIManager manager = new APIManager();

            //		var reponseProfile = await manager.getUserProfile(Settings.AppID, Settings.Username, response1.AuthToken, Settings.Password);


            //		InvokeOnMainThread(() =>
            //				{

            //					//CompanyTextField.Text = reponseProfile.Company;
            //				});

            //	}
            //	catch (Exception e) {

            //	}

            //});

            //ContainerViewWidthConstraint.Constant = View.Bounds.Width - 40;
            ContainerView.BackgroundColor = UIColor.Clear;
            ContainerView.Alpha           = .8f;

            //CGSize contentSize = new CGSize(View.Bounds.Width - 40, ContainerView.Bounds.Height);
            //ProfileScrollView.ContentSize = contentSize;
            //LocationResponseList = new List<LocationResponse>();


            MapCCodePickerView.Model = new MapCCodeModel(this);


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

                                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) =>
                                {
                                    this.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 + 1;
                                        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();
                            FilteredLocationList = LocationList;
                            provinceList         = location.ProvinceLst.OrderBy(row => row.DisplayOrder).ToList();
                            stateList            = location.StatesLst.OrderBy(row => row.DisplayOrder).ToList();

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

                            InvokeOnMainThread(() =>
                            {
                                MapCCodePickerView.Model = new MapCCodeModel(this);
                                LocationsPicker.Model    = new LocationsModel(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));;
                                        MapCCodePickerView.Select(currentIndex, 0, true);
                                    }
                                    else
                                    {
                                        if (Settings.LocationPickerSelectedId != 0)
                                        {
                                            int locationId = Settings.LocationPickerSelectedId;
                                            int mapCIndex  = MapCCodeList.IndexOf(MapCCodeList.FirstOrDefault(row => row.LocationId == 0));
                                            MapCCodePickerView.Select(mapCIndex, 0, true);
                                            MapCCodePickerView.Model.Selected(MapCCodePickerView, mapCIndex, 0);

                                            int locationCInddex = FilteredLocationList.IndexOf(FilteredLocationList.FirstOrDefault(row => row.LocationId == locationId));
                                            LocationsPicker.Select(locationCInddex, 0, true);
                                            LocationsPicker.Model.Selected(LocationsPicker, locationCInddex, 0);
                                            //LocationPicker.Alpha = 1f;
                                        }
                                    }
                                }
                                else
                                {
                                    //MapCCodePicker.Model.Selected(MapCCodePicker, 0, 0);
                                    MapCCodePickerView.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: () =>
                            {
                            });
                        });
                    }
                }
                catch (Exception exe) {
                }
            }
                     );
        }
Пример #11
0
        public static void LoadWebViewWithAd(UITapGestureRecognizer tap, Ad ad, UIView mainView)
        {
            if (Reachability.IsHostReachable(Settings._baseDomain))
            {
                LoadingOverlay loadingOverlay = new LoadingOverlay(mainView.Frame);

                var frame   = new CGRect(0, 0, mainView.Bounds.Width, mainView.Bounds.Height);
                var webView = new UIWebView(frame);


                webView.LoadFinished += (sender, e) =>
                {
                    loadingOverlay.Hide();
                };


                var url = ad.AircraftForSaleURL;
                //commenting to test banmanpro
                //var url = "https://www.globalair.com/banmanpro/ad.aspx?ZoneID=94&Task=Get&Mode=HTML&SiteID=1&PageID=78751";
                webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));

                UIView.BeginAnimations("fadeflag");
                UIView.Animate(1, () =>
                {
                    tap.View.Alpha = .5f;
                }, () =>
                {
                    mainView.AddSubview(webView);
                    mainView.AddSubview(loadingOverlay);

                    UIButton closeButton = new UIButton(new CGRect(mainView.Bounds.Width - 75, 0, 75, 50));
                    closeButton.SetImage(UIImage.FromBundle("close"), UIControlState.Normal);
                    closeButton.BackgroundColor = UIColor.Black;
                    closeButton.TouchUpInside  += (sender, e) =>
                    {
                        try
                        {
                            webView.RemoveFromSuperview();
                            closeButton.RemoveFromSuperview();
                        }
                        finally
                        {
                            webView.Dispose();
                        }
                    };

                    int width, height;

                    if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
                    {
                        width  = 110;
                        height = 75;
                    }
                    else
                    {
                        width  = 60;
                        height = 40;
                    }

                    UIImageView imageView            = new UIImageView(new CGRect(mainView.Bounds.Width - width, mainView.Bounds.Height / 2, width, height));
                    imageView.Image                  = UIImage.FromBundle("swipe_left");
                    imageView.Alpha                  = .5f;
                    imageView.UserInteractionEnabled = true;
                    imageView.BackgroundColor        = UIColor.Gray;
                    imageView.ContentMode            = UIViewContentMode.ScaleAspectFit;
                    imageView.Layer.CornerRadius     = 20;

                    //imageView.MultipleTouchEnabled = true;

                    webView.AddSubview(imageView);
                    webView.AddSubview(closeButton);

                    tap.View.Alpha = 1f;
                });

                UIView.CommitAnimations();
            }
            else
            {
                SendBasicAlert("Connect to a Network", "Please connect to a network to view this ad");
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (this.TabBarController != null)
            {
                this.TabBarController.TabBar.Hidden = true;
            }



            //Ensure database refresh
            //this.NavigationItem.SetRightBarButtonItem(
            var refreshButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh, async(sender, args) =>
            {
                if (Reachability.IsHostReachable(Settings._baseDomain))
                {
                    LoadingOverlay loadingIndicator = new LoadingOverlay(this.View.Frame);
                    this.View.AddSubview(loadingIndicator);
                    // button was clicked
                    List <Ad> adList = new List <Ad>();


                    Ad.DeleteAdsByClassification(SelectedClassification);
                    adList = (await Ad.GetAdsByClassificationAsync(SelectedClassification)).ToList();


                    this.ModelController.LoadModalController(adList, SelectedClassification);

                    var firstViewController = ModelController.GetViewController(0, false);
                    var viewControllerArray = new UIViewController[] { firstViewController };
                    PageViewController.SetViewControllers(viewControllerArray, UIPageViewControllerNavigationDirection.Forward, true, null);

                    loadingIndicator.Hide();
                }
                else
                {
                    HelperMethods.SendBasicAlert("Connect to a Network", "Please connect to a network to refresh these ads");
                }
            });
            //, true);

            //start implementing search feature
            var searchButton = new UIBarButtonItem(UIBarButtonSystemItem.Search, (sender, e) =>
            {
                var errorMessage = "";
                if (ModelController != null && ModelController.adList != null && ModelController.adList.Count > 0)
                {
                    var adList = ModelController.adList;

                    SearchResultsViewController searchResultsViewController = new SearchResultsViewController();

                    searchResultsViewController.SearchResultsAdList = adList;
                    searchResultsViewController.Classification      = SelectedClassification;
                    searchResultsViewController.AdSelectedAction    = delegate
                    {
                        var pageViewController         = this.PageViewController;
                        var magFlipBoardViewController = this;



                        Ad ad = new Ad();

                        ad = searchResultsViewController.SelectedAd;

                        LoadingOverlay loadingIndicator = new LoadingOverlay(this.View.Frame, "Loading Aircraft");
                        this.View.AddSubview(loadingIndicator);

                        var modelController     = this.ModelController;
                        List <Ad> searchAddList = new List <Ad>();

                        Task.Run(async() =>
                        {
                            searchAddList = (await Ad.GetAdsByClassificationAsync(ad.Classification)).ToList();

                            //get ads with this name and move them to the from of the liste
                            List <Ad> similarAdList = new List <Ad>();

                            similarAdList = searchAddList.Where(row => row.Name == ad.Name).OrderBy(r => r.IsFeatured).ToList();

                            //similarAdList.Remove(ad);


                            for (int i = 0; i < similarAdList.Count(); i++)
                            {
                                searchAddList.Remove(similarAdList[i]);
                                searchAddList.Insert(0, similarAdList[i]);
                            }

                            //similarAdList.Remove(ad);
                            //searchAddList.Insert(0, ad);


                            var index            = searchAddList.FindIndex(x => x.ID == ad.ID);
                            var item             = searchAddList[index];
                            searchAddList[index] = searchAddList[0];
                            searchAddList[0]     = item;

                            InvokeOnMainThread(() =>
                            {
                                modelController.LoadModalController(searchAddList, ad.Classification);
                                loadingIndicator.Hide();
                                var initialViewController = modelController.GetViewController(0, false);
                                var searchViewControllers = new UIViewController[] { initialViewController };
                                pageViewController.SetViewControllers(searchViewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);

                                HelperMethods.SendBasicAlert("", "Aircraft arranged based on search selection");
                            });
                        });
                    };
                    this.PresentViewController(searchResultsViewController, true, null);
                }
                else
                {
                    errorMessage = "Oops... There was a problem. Aircraft ads are not yet loaded.";
                }
                if (errorMessage != string.Empty)
                {
                    HelperMethods.SendBasicAlert("Alert", errorMessage);
                }
            });


            List <UIBarButtonItem> navButtonList = new List <UIBarButtonItem>();

            navButtonList.Add(searchButton);
            navButtonList.Add(refreshButton);


            this.NavigationItem.SetRightBarButtonItems(navButtonList.ToArray(), true);

            ModelController = new ModelController(SelectedClassification);

            // Configure the page view controller and add it as a child view controller.
            //UIPageViewControllerSpineLocation.Min
            PageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);
            PageViewController.WeakDelegate = this;

            var startingViewController = ModelController.GetViewController(0, false);
            var viewControllers        = new UIViewController[] { startingViewController };

            PageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);

            PageViewController.WeakDataSource = ModelController;

            AddChildViewController(PageViewController);
            View.AddSubview(PageViewController.View);

            UINavigationController magazineNavigationController = (UINavigationController)Storyboard.InstantiateViewController("MagazineNavigationViewController");
            float heightTopNavBar      = (float)magazineNavigationController.NavigationBar.Frame.Size.Height;
            float statusBarHeight      = (float)UIApplication.SharedApplication.StatusBarFrame.Height;
            float totalStatusBarHeight = heightTopNavBar + statusBarHeight;
            var   pageViewRect         = new CGRect(0, totalStatusBarHeight, View.Bounds.Width, View.Bounds.Height - totalStatusBarHeight);

            PageViewController.View.Frame = pageViewRect;

            PageViewController.DidMoveToParentViewController(this);

            // Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
            //View.GestureRecognizers = PageViewController.GestureRecognizers;

            if (NavigateDirectlyToAdId != null && NavigateDirectlyToAdId != string.Empty)
            {
                LoadingIndicator = new LoadingOverlay(this.View.Frame, "Loading Aircraft", false);
                this.View.AddSubview(LoadingIndicator);
            }
        }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = tableView.CellAt(indexPath);


            if (Reachability.IsHostReachable(Settings._baseDomain))
            {
                var ad = Owner.FavoritesAdList[indexPath.Row];
                var statusBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height;
                var tabBarHeight    = Owner.TabBarController.TabBar.Bounds.Height;

                var frame   = new CGRect(0, statusBarHeight, Owner.View.Bounds.Width, Owner.View.Bounds.Height - (statusBarHeight + tabBarHeight));
                var webView = new UIWebView(frame);

                LoadingOverlay loadingOverlay = new LoadingOverlay(Owner.View.Frame);

                webView.LoadFinished += (sender, e) =>
                {
                    loadingOverlay.Hide();
                };


                var url = ad.AircraftForSaleURL;
                webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));

                UIView.BeginAnimations("fadeflag");
                UIView.Animate(1, () =>
                {
                    cell.Alpha = .5f;
                }, () =>
                {
                    Owner.View.AddSubview(webView);
                    Owner.View.AddSubview(loadingOverlay);

                    UIButton closeButton = new UIButton(new CGRect(Owner.View.Bounds.Width - 50, 0, 50, 50));
                    closeButton.SetImage(UIImage.FromBundle("close"), UIControlState.Normal);
                    closeButton.BackgroundColor = UIColor.Black;
                    closeButton.TouchUpInside  += (sender, e) =>
                    {
                        try
                        {
                            webView.RemoveFromSuperview();
                            closeButton.RemoveFromSuperview();
                        }
                        finally
                        {
                            webView.Dispose();
                        }
                    };
                    //Owner.View.AddSubview(closeButton);
                    webView.AddSubview(closeButton);

                    cell.Alpha = 1f;
                });

                UIView.CommitAnimations();
                //}
            }
            else
            {
                HelperMethods.SendBasicAlert("Connect to a Network", "Please connect to a network to view this ad");
            }



            tableView.DeselectRow(indexPath, true);
        }
Пример #14
0
        public override void ViewDidLoad()
        {
            NavigationItem.Title = "Registration";

            NavigationItem.BackBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, null);

            HideKeyboardGesture = new UITapGestureRecognizer(() =>
            {
                View.EndEditing(true);
            });

            var finishButton = new UIBarButtonItem("Finish", UIBarButtonItemStyle.Plain, async(sender, args) =>
            {
                if (Reachability.IsHostReachable(Settings._baseDomain))
                {
                    LoadingOverlay loadingIndicator = new LoadingOverlay(this.View.Frame, "Loading ...");
                    this.View.AddSubview(loadingIndicator);
                    //Attempt to register in the API
                    var response = await MagAppRegisterResponse.RegisterAsync();

                    if (response.Status == "Success")
                    {
                        loadingIndicator.Hide();
                        Settings.IsRegistered = true;

                        //var registrationStoryboard = UIStoryboard.FromName("Main_ipad", NSBundle.MainBundle);
                        //PushNotificationPromptViewController pushNotificationPromptViewController = (PushNotificationPromptViewController)registrationStoryboard.InstantiateViewController("PushNotificationPromptViewController");
                        //pushNotificationPromptViewController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                        //PresentViewController(pushNotificationPromptViewController, true, () =>
                        //{
                        var alert = UIAlertController.Create("Congratulations!", "You have successfully registered.", UIAlertControllerStyle.Alert);

                        alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, (obj) =>
                        {
                            this.DismissViewController(true, null);
                            var loginViewController = this.PresentingViewController as LoginViewController;
                            this.NavigationController.DismissViewController(true, null);
                            if (loginViewController != null)
                            {
                                loginViewController.PerformSegue("LoadTabBarControllerSeque", loginViewController);
                            }
                        }));

                        PresentViewController(alert, animated: true, completionHandler: () =>
                        {
                        });
                        //});
                    }
                    else
                    {
                        loadingIndicator.Hide();
                        HelperMethods.SendBasicAlert("Oops.", response.ResponseMsg);
                    }
                }
                else
                {
                    HelperMethods.SendBasicAlert("Please connect to the internet", "Internet access is required.");
                }
            });
            UITextAttributes icoFontAttribute = new UITextAttributes();

            icoFontAttribute.Font      = UIFont.BoldSystemFontOfSize(20);
            icoFontAttribute.TextColor = UIColor.White;

            finishButton.SetTitleTextAttributes(icoFontAttribute, UIControlState.Normal);

            this.NavigationItem.SetRightBarButtonItem(finishButton, true);

            var orderByPicker = new UIPickerView();

            orderByPicker.Model = new SortOptionsViewModel();
            orderByPicker.ShowSelectionIndicator = true;

            UIToolbar orderByToolbar = new UIToolbar();

            orderByToolbar.BarStyle    = UIBarStyle.Black;
            orderByToolbar.Translucent = true;
            orderByToolbar.SizeToFit();

            UIBarButtonItem orderByDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) =>
            {
                UITextField textview = OrderByTextField;

                textview.Text = Settings.SortOptions;
                textview.ResignFirstResponder();
            });

            orderByToolbar.SetItems(new UIBarButtonItem[] { orderByDoneButton }, true);


            OrderByTextField.InputView          = orderByPicker;
            OrderByTextField.InputAccessoryView = orderByToolbar;

            var timeframePicker = new UIPickerView();

            timeframePicker.Model = new TimeframeViewModel();
            timeframePicker.ShowSelectionIndicator = true;

            UIToolbar timeframeToolbar = new UIToolbar();

            timeframeToolbar.BarStyle    = UIBarStyle.Black;
            timeframeToolbar.Translucent = true;
            timeframeToolbar.SizeToFit();

            UIBarButtonItem timeframeDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) =>
            {
                UITextField textview = TimeFrameTextField;

                textview.Text = Settings.PurchaseTimeFrame + " months";
                textview.ResignFirstResponder();
            });

            timeframeToolbar.SetItems(new UIBarButtonItem[] { timeframeDoneButton }, true);


            TimeFrameTextField.InputView          = timeframePicker;
            TimeFrameTextField.InputAccessoryView = timeframeToolbar;

            var whyFlyPicker = new UIPickerView();

            whyFlyPicker.Model = new PurposeViewModel();
            whyFlyPicker.ShowSelectionIndicator = true;

            UIToolbar whyFlyToolbar = new UIToolbar();

            whyFlyToolbar.BarStyle    = UIBarStyle.Black;
            whyFlyToolbar.Translucent = true;
            whyFlyToolbar.SizeToFit();

            UIBarButtonItem whyFlyDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) =>
            {
                UITextField textview = WhyFlyTextField;

                //var selected = Settings.LocationResponse.PurposeForFlying.FirstOrDefault(row => row.FlyingPurposeId == Settings.PurposeId);

                textview.Text = Settings.PurposeString;
                textview.ResignFirstResponder();
            });

            whyFlyToolbar.SetItems(new UIBarButtonItem[] { whyFlyDoneButton }, true);


            WhyFlyTextField.InputView          = whyFlyPicker;
            WhyFlyTextField.InputAccessoryView = whyFlyToolbar;


            var borderFrameHeight     = WhyFlyTextField.Frame.Size.Height - 1;
            var borderFrameWidth      = this.View.Bounds.Width - 20;
            var borderBackgroundColor = UIColor.Gray.CGColor;

            // create CALayer
            var bottomBorder1 = new CALayer();

            bottomBorder1.Frame           = new CGRect(0.0f, borderFrameHeight, borderFrameWidth, 1.0f);
            bottomBorder1.BackgroundColor = borderBackgroundColor;

            var bottomBorder2 = new CALayer();

            bottomBorder2.Frame           = new CGRect(0.0f, borderFrameHeight, borderFrameWidth, 1.0f);
            bottomBorder2.BackgroundColor = borderBackgroundColor;

            var bottomBorder3 = new CALayer();

            bottomBorder3.Frame           = new CGRect(0.0f, borderFrameHeight, borderFrameWidth, 1.0f);
            bottomBorder3.BackgroundColor = borderBackgroundColor;

            var bottomBorder4 = new CALayer();

            bottomBorder4.Frame           = new CGRect(0.0f, borderFrameHeight, borderFrameWidth, 1.0f);
            bottomBorder4.BackgroundColor = borderBackgroundColor;

            var fontSize   = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? 22.0f : 16.0f;
            var fontObject = UIFont.SystemFontOfSize(fontSize);

            WhyFlyTextField.Layer.AddSublayer(bottomBorder2);
            WhyFlyTextField.Layer.MasksToBounds   = true;
            WhyFlyTextField.AttributedPlaceholder = new NSAttributedString(
                "Select from list",
                font: fontObject,
                foregroundColor: UIColor.DarkGray
                );
            WhyFlyTextField.Font = fontObject;
            WhyFlyTextField.Text = Settings.PurposeString ?? string.Empty;

            TimeFrameTextField.Layer.AddSublayer(bottomBorder3);
            TimeFrameTextField.Layer.MasksToBounds   = true;
            TimeFrameTextField.AttributedPlaceholder = new NSAttributedString(
                "Select from list",
                font: fontObject,
                foregroundColor: UIColor.DarkGray
                );
            TimeFrameTextField.Font = fontObject;
            TimeFrameTextField.Text = Settings.PurchaseTimeFrame != 0 ? Settings.PurchaseTimeFrame + " months" : string.Empty;

            OrderByTextField.Layer.AddSublayer(bottomBorder4);
            OrderByTextField.Layer.MasksToBounds   = true;
            OrderByTextField.AttributedPlaceholder = new NSAttributedString(
                "Select from list",
                font: fontObject,
                foregroundColor: UIColor.DarkGray
                );
            OrderByTextField.Font = fontObject;
            OrderByTextField.Text = Settings.SortOptions ?? string.Empty;


            // add to UITextField
            HoursTextView.Layer.AddSublayer(bottomBorder1);
            HoursTextView.Layer.MasksToBounds = true;
            HoursTextView.Font           = fontObject;
            HoursTextView.KeyboardType   = UIKeyboardType.NumberPad;
            HoursTextView.EditingDidEnd += (sender, e) => {
                if (HoursTextView.Text != string.Empty)
                {
                    int hours = 0;
                    if (int.TryParse(HoursTextView.Text, out hours) && hours > 0)
                    {
                        Settings.Hours = hours;
                    }
                }
            };
            HoursTextView.Text = Settings.Hours != 0 ? Settings.Hours.ToString() : string.Empty;
        }