public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear (animated);

            TableView.Source = new SearchTableSource(this);
            mSearchBar = TableView.TableHeaderView as UISearchBar;

            mSearchBar.Placeholder = "Enter Search Word";
            mSearchBar.SizeToFit();
            mSearchBar.AutocorrectionType = UITextAutocorrectionType.Yes;
            mSearchBar.AutocapitalizationType = UITextAutocapitalizationType.None;
            mSearchBar.SearchButtonClicked += (sender, e) =>
            {
                AddWord(mSearchBar.Text);
            };
            mSearchBar.TextChanged += (sender, e) =>
            {
                mSuggestionModel.NewSuggestion(mSearchBar.Text);
            };

            mSuggestionModel.SuggestionChanged += (sender, e) =>
            {
                this.InvokeOnMainThread(delegate
                {
                    TableView.ReloadData();
                });
            };

            mSearchBar.BecomeFirstResponder ();
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			if (cloudManager != null)
				cloudManager.FetchRecords ("SearchRequest", results => {
					previousSearchRequests = results;
					TableView.ReloadData ();
				});

			NavigationItem.HidesBackButton = true;
			TableView.Source = new TableSource (this);
			TableView.AllowsMultipleSelectionDuringEditing = false;

			searchBar = new UISearchBar {
				Placeholder = "search_hint".LocalizedString ("Search text field placeholder"),
				AutocorrectionType = UITextAutocorrectionType.No,
				AutocapitalizationType = UITextAutocapitalizationType.None,
				ShowsCancelButton = true
			};

			searchBar.SizeToFit ();
			searchBar.SearchButtonClicked += (sender, e) => {
				if (cloudManager != null && 
					!previousSearchRequests.Where (record => (NSString)record ["value"] == searchBar.Text).Any ())
					SaveSearchRequest (searchBar.Text);
				
				Search ();
			};

			searchBar.CancelButtonClicked += (sender, e) => NavigationController.PopViewController (false);

			NavigationItem.TitleView = searchBar;
			searchBar.BecomeFirstResponder ();
		}
        public override void ViewDidLoad()
        {
            try
            {
                //View = new UniversalView();

                base.ViewDidLoad();
                this.Title = "Derby Events";

                View.Frame = UIScreen.MainScreen.Bounds;
                View.BackgroundColor = UIColor.White;
                View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
                table = new UITableView(new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height));

                Action<EventsJson> skaters = new Action<EventsJson>(UpdateAdapter);
                Calendar.PullEvents(lastPagePulled, PAGE_COUNT, skaters);
                // Perform any additional setup after loading the view
                loading = new LoadingView();
                loading.ShowActivity("loading events");
                source = new EventsTableView(initialArray.Events, this.NavigationController);
                source.GotCell += source_GotCell;
                table.Source = source;
                table.RowHeight = 80;


                searchBar = new UISearchBar(new RectangleF(0, 0, 200, 44));
                searchBar.SetShowsCancelButton(true, false);
                searchBar.CancelButtonClicked += searchBar_CancelButtonClicked;
                searchBar.SearchButtonClicked += searchBar_SearchButtonClicked;


                this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Search, (sender, args) =>
    {
        searchBar.BecomeFirstResponder();
        UIView searchBarView = new UIView(new RectangleF(0, 0, 250, 44));
        searchBarView.AddSubview(searchBar);
        this.NavigationItem.TitleView = searchBarView;
    })
, true);

                this.NavigationItem.BackBarButtonItem = new UIBarButtonItem();
                this.NavigationItem.BackBarButtonItem.Title = "Events";

                View.Add(table);
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.iPhone);
            }

        }
示例#4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (cloudManager != null)
            {
                cloudManager.FetchRecords("SearchRequest", results => {
                    previousSearchRequests = results;
                    TableView.ReloadData();
                });
            }

            NavigationItem.HidesBackButton = true;
            TableView.Source = new TableSource(this);
            TableView.AllowsMultipleSelectionDuringEditing = false;

            searchBar = new UISearchBar {
                Placeholder            = "search_hint".LocalizedString("Search text field placeholder"),
                AutocorrectionType     = UITextAutocorrectionType.No,
                AutocapitalizationType = UITextAutocapitalizationType.None,
                ShowsCancelButton      = true
            };

            searchBar.SizeToFit();
            searchBar.SearchButtonClicked += (sender, e) => {
                if (cloudManager != null &&
                    !previousSearchRequests.Where(record => (NSString)record ["value"] == searchBar.Text).Any())
                {
                    SaveSearchRequest(searchBar.Text);
                }

                Search();
            };

            searchBar.CancelButtonClicked += (sender, e) => NavigationController.PopViewController(false);

            NavigationItem.TitleView = searchBar;
            searchBar.BecomeFirstResponder();
        }
        public void ToggleSearchbar()
        {
            var searchbar = Root as ISearchBar;

            if (searchbar != null)
            {
                if (!searchbar.IsSearchbarHidden)
                {
                    FinishSearch(true);

                    _Searchbar.ResignFirstResponder();
                    _Searchbar.Text             = string.Empty;
                    searchbar.IsSearchbarHidden = true;
                }
                else
                {
                    StartSearch();
                    searchbar.IsSearchbarHidden = false;
                    _Searchbar.BecomeFirstResponder();
                }
            }
        }
示例#6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            View.Layer.Frame = new CoreGraphics.CGRect (0, 0, uvWidth, uvheight);
            NavBar=new UINavigationBar(new CoreGraphics.CGRect (0, 0, uvWidth, 44));
            utListView = new UITableView (new CoreGraphics.CGRect (0, 44, uvWidth, uvheight));
            //			UIBarButtonItem TrashBtn = new UIBarButtonItem (UIBarButtonSystemItem.Cancel, TrashBtnClicked);

            UIButton btnCancel = new UIButton (new CGRect (0, 0, 80, 30));
            btnCancel.SetTitleColor (UIColor.Blue, UIControlState.Normal);
            btnCancel.SetTitle ("Cancel", UIControlState.Normal);
            btnCancel.TouchUpInside += (object sender, EventArgs e) => {
                if(popover!=null)
                    popover.Dismiss(false);
            };
            UIBarButtonItem TrashBtn = new UIBarButtonItem (btnCancel);

            UINavigationItem navgitem = new UINavigationItem ("Select");
            navgitem.SetLeftBarButtonItem (TrashBtn, true);
            NavBar.PushNavigationItem(navgitem,true);
            searchBar=new UISearchBar(new CoreGraphics.CGRect (100, 0, uvWidth-100, 44));
            this.View.Add (NavBar);
            this.View.AddSubview(utListView);
            this.View.AddSubview(searchBar);
            this.utListView.Source =new CodePickerSource(this);
            searchBar.BecomeFirstResponder ();
            searchBar.Text = searchkey;
            searchBar.TextChanged+= async (object sender, UISearchBarTextChangedEventArgs e) => {
                if(!string.IsNullOrEmpty(searchBar.Text))
                {
                    AppDelegate.pb.Start(this.View,"Searching...");
                    var webClient = new WebClient();
                    string url =  "http://reference.iprocedures.com/"+type+"/"+searchBar.Text.Trim()+"/20";
                    string procData = webClient.DownloadString (url);
                    procedureItems = (ProcedureDiagnosticMaster)JsonConvert.DeserializeObject (procData, typeof(ProcedureDiagnosticMaster));
                    int uwidth = 0;
                    DataSource = SetProcedureDataSource(out uwidth);
                    this.utListView.Source =new CodePickerSource(this);
                    this.utListView.ReloadData();
                    AppDelegate.pb.Stop();
                }

                    //RectangleF fillrect = new RectangleF(0,0,uwidth,uvheight);
                    //this.View.Frame=fillrect;

            };

            // Perform any additional setup after loading the view, typically from a nib.
        }