Пример #1
0
        #pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        async void GetAutosuggestLocation(UITextField textField)
        #pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
        {
            NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus();

            if (remoteHostStatus == NetworkStatus.NotReachable)
            {
                var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(alert, animated: true, completionHandler: null);

                return;
            }
            activityIndicatorLocation.Hidden = false;


            ServiceManager jobService = new ServiceManager();

            activityIndicatorLocation.StartAnimating();

            List <string> locations = await jobService.AsyncJobGetLocations(textField.Text.Trim());

            if (locations != null)
            {
                if (locations.Count == 0)
                {
                    locations.Add("geen resultaten gevoden");
                }

                AutoCompleteTextFieldManager.Add(this, textField, locations);
                activityIndicatorLocation.StopAnimating();
            }
        }
Пример #2
0
        public override void ViewDidDisappear(bool animated)
        {
            base.ViewDidDisappear(animated);

            AutoCompleteTextFieldManager.RemoveTable();

            //AutoCompleteTextFieldManager.RemoveAll();
        }
Пример #3
0
        private bool TextFieldShoulClear(UITextField textfield)
        {
            textfield.Text = "";

            if (textfield == txtLocation)
            {
                AutoCompleteTextFieldManager.RemoveTable();
            }

            return(true);
        }
Пример #4
0
        private bool TextFieldShouldReturn(UITextField textfield)
        {
            textfield.ResignFirstResponder();

            if (textfield == txtLocation)
            {
                AutoCompleteTextFieldManager.RemoveTable();
            }

            return(true);
        }
Пример #5
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            View.EndEditing(true);

            AutoCompleteTextFieldManager.RemoveTable();
            AutoCompleteTextFieldManager.RemoveAll();

            this.Title = "Branch Locator";
        }
Пример #6
0
        private bool TextFieldShoulClear(UITextField textfield)
        {
            //if(textfield == txtKeyword)
            //	AutoCompleteTextFieldManager.RemoveTable(1, 0);

            //if (textfield == txtLocation)
            //	AutoCompleteTextFieldManager.RemoveTable(2, 1);

            AutoCompleteTextFieldManager.RemoveTable();
            AutoCompleteTextFieldManager.RemoveAll();

            return(true);
        }
Пример #7
0
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);
            UITouch touch = touches.AnyObject as UITouch;

            if (touch.View == View)
            {
                txtLocation.ResignFirstResponder();
                txtDistance.ResignFirstResponder();
                AutoCompleteTextFieldManager.RemoveTable();
                txtLocation.TouchDown += delegate
                {
                    AutoCompleteTextFieldManager.RemoveTable();
                };
            }
        }
Пример #8
0
        private bool TextFieldShouldReturn(UITextField textfield)
        {
            int         nextTag       = (int)textfield.Tag + 1;
            UIResponder nextResponder = this.View.ViewWithTag(nextTag);

            if (nextResponder != null)
            {
                nextResponder.BecomeFirstResponder();
                AutoCompleteTextFieldManager.RemoveTable();
            }
            else
            {
                // Not found, so remove keyboard.
                textfield.ResignFirstResponder();
            }

            return(false);            // We do not want UITextField to insert line-breaks.
        }
Пример #9
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            if (jobList != null)
            {
                tblView.ReloadData();
            }

            View.EndEditing(true);
            this.FavoriteButtonWithCount(NavigationItem);
            tblView.AllowsSelection = true;

            AutoCompleteTextFieldManager.RemoveTable();
            AutoCompleteTextFieldManager.RemoveAll();


            // clear filetr url used for refine
            Constants.FilterURL         = "";
            Constants.jobSearchResponse = new Dictionary <string, dynamic>();

            AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

            appDelegate.SidebarController.Disabled = false;


            // Now Get latest jobs if config file changed
            if (Constants.isConigurationChanged)
            {
                this.txtKeyword.Text  = "";
                this.txtLocation.Text = "";

                btnJobSearch.SetTitle(Translations.job_search, UIControlState.Normal);
                btnJobSearch.SetTitle(Translations.job_search, UIControlState.Highlighted);

                segmentCtrl.RemoveAllSegments();
                segmentCtrl.InsertSegment(Translations.latest_job, 0, false);
                segmentCtrl.InsertSegment(Translations.recent_search, 1, false);
                segmentCtrl.SelectedSegment = 0;

                this.txtKeyword.AttributedPlaceholder = new NSAttributedString(
                    Translations.keyword_title,
                    font: UIFont.SystemFontOfSize(15),
                    foregroundColor: UIColor.White,
                    strokeWidth: 0
                    );

                this.txtLocation.AttributedPlaceholder = new NSAttributedString(
                    Translations.location_title,
                    font: UIFont.SystemFontOfSize(15),
                    foregroundColor: UIColor.White,
                    strokeWidth: 0
                    );

                DbHelper.ResetDatabase();
                DbHelper.CreateDatabaseAndTables();

                _recentSearchs = DbHelper.GetRecentSearches();

                this.FavoriteButtonWithCount(NavigationItem);

                GetJobSearchData("", "");

                Constants.isConigurationChanged = false;
            }
        }