void ReleaseDesignerOutlets () { if (searchDisplayController != null) { searchDisplayController.Dispose (); searchDisplayController = null; } }
public override void ViewDidLoad() { base.ViewDidLoad (); this.Title = title; var frame = new CGRect (0, 0, 0, 0); TableView.TableFooterView = new UIView (frame); TableView.AutoresizingMask = UIViewAutoresizing.All; TableView.RowHeight = UITableView.AutomaticDimension; TableView.EstimatedRowHeight = 200f; UISearchBar searchBar = new UISearchBar (); searchBar.SizeToFit (); TableView.TableHeaderView = searchBar; UISearchDisplayController searchDisplayController = new UISearchDisplayController(searchBar, this); var phraseSource = new PhraseSource (this); TableView.Source = phraseSource; searchDisplayController.SearchResultsSource = phraseSource; searchDisplayController.SearchBar.TextChanged += (sender, e) => { string text = e.SearchText.Trim (); filteredPhrases = (from phrase in phrases where phrase.sourcePhrase.ToUpper ().Contains (text.ToUpper ()) select phrase).ToList (); }; searchDisplayController.SearchResultsTableView.RowHeight = UITableView.AutomaticDimension; searchDisplayController.SearchResultsTableView.EstimatedRowHeight = 200f; LoadDataForDisplay (); }
public override void ViewDidLoad() { base.ViewDidLoad(); if (CanSearch) { searchBar = CreateSearchBar(); if (SearchPlaceholder != null) { searchBar.Placeholder = SearchPlaceholder; } searchDisplayController = new UISearchDisplayController(searchBar, this); SearchDisplayController.SearchResultsWeakDataSource = this; SearchDisplayController.SearchResultsWeakDelegate = this; SearchDisplayController.WeakDelegate = this; TableView.TableHeaderView = searchBar; } TableView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; TableView.AutosizesSubviews = true; TableView.WeakDataSource = this; TableView.WeakDelegate = this; if (rowHeight > 0) { TableView.RowHeight = rowHeight; } loaded = true; }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); if (searchBar == null) { Songs.querySongs(); this.Title = String.Format("Songs"); searchBar = new UISearchBar(new CGRect(0, 0, 320, 44)) { Placeholder = "Search", AutocorrectionType = UITextAutocorrectionType.No, AutocapitalizationType = UITextAutocapitalizationType.None }; searchBar.SizeToFit(); TableView.TableHeaderView = searchBar; searchController = new UISearchDisplayController(searchBar, this); searchController.WeakDelegate = this; searchController.SearchResultsDelegate = this; searchController.SearchResultsDataSource = this; loading = false; TableView.ReloadData(); searchBar.UserInteractionEnabled = true; } // Register for receiving controls from lock screen and controlscreen UIApplication.SharedApplication.BeginReceivingRemoteControlEvents(); this.BecomeFirstResponder(); }
/// <summary> /// Sets ISearchSource.SearchText and reloads the UITableView /// </summary> public override bool ShouldReloadForSearchString(UISearchDisplayController controller, string forSearchString) { dataSource.SearchText = forSearchString.ToLower (); tableView.ReloadData (); return true; }
public override void ViewDidLoad() { base.ViewDidLoad (); FoundCoords += (object sender, CoordEventArgs e) => { storageScreenContent.SetCoords(e.Latitude,e.Longitude); }; map = new MKMapView (UIScreen.MainScreen.Bounds); View = map; // create search controller searchBar = new UISearchBar (new RectangleF (0, 0, View.Frame.Width, 50)) { Placeholder = "Enter a search query" }; searchController = new UISearchDisplayController (searchBar, this); searchController.Delegate = new SearchDelegate (map); SearchSource source = new SearchSource (searchController, map); searchController.SearchResultsSource = source; source.FoundCoords += (object sender, CoordEventArgs e) => { var handler = FoundCoords; if(handler != null){ handler(this,e); } this.DismissViewController(true,null); }; View.AddSubview (searchBar); }
public override void LoadView() { base.LoadView(); InfosTableView = new UITableView(RectangleF.Empty, UITableViewStyle.Plain) { Frame = this.ContentFrame(), Source = new InfosTableSource(), RowHeight = 60 }; View.AddSubview(InfosTableView); var searchBar = new UISearchBar(RectangleF.Empty) { ShowsCancelButton = true, Placeholder = "Find Currency", KeyboardType = UIKeyboardType.ASCIICapable }; searchBar.SizeToFit(); InfosTableView.TableHeaderView = searchBar; SearchController = new UISearchDisplayController(searchBar, this) { Delegate = new SearchDisplayDelegate(), SearchResultsSource = new InfosTableSource() }; SearchController.SearchResultsTableView.RowHeight = 60; }
public SearchSource(UISearchDisplayController searchController, MKMapView map) { this.searchController = searchController; this.map = map; MapItems = new List <MKMapItem> (); }
/// <summary> /// Sets ISearchSource.SearchText and reloads the UITableView /// </summary> public override bool ShouldReloadForSearchString(UISearchDisplayController controller, string forSearchString) { dataSource.SearchText = forSearchString.ToLower(); tableView.ReloadData(); return(true); }
void ReleaseDesignerOutlets() { if (searchDisplayController != null) { searchDisplayController.Dispose(); searchDisplayController = null; } }
public CategoryTableSource(Category[] items, Category[] filteredItems, CategoryScreen owner) { tableItems = items; this.filteredItems = filteredItems; this.categoryScreenController = owner; this.search = owner.SearchDisplayController; }
public MyphraseTableSource(List<Phrase> items, List<Phrase> filteredItems, MyPhraseScreen owner) { tableItems = items; this.filteredItems = filteredItems; this.myPhraseScreenController = owner; this.search = owner.SearchDisplayController; }
public TableSourceSearch(ViewController_Stock owner, string sSearchType) { //this.models = models; //this.modelsSearch = this.models; this.owner = owner; search = owner.searchDisplayController; this.sSearchType = sSearchType; }
public override bool ShouldReloadForSearchString(UISearchDisplayController controller, string forSearchString) { if (_searchText != forSearchString) { _searchText = forSearchString; //Send message to wipe out TableView _hub.Publish(new SearchMessage(this, null, 0)); } return false; }
void ReleaseDesignerOutlets() { if (AddressSearchBar != null) { AddressSearchBar.Dispose (); AddressSearchBar = null; } if (searchDisplayController != null) { searchDisplayController.Dispose (); searchDisplayController = null; } }
public override bool ShouldReloadForSearchString (UISearchDisplayController controller, string forSearchString) { if (string.IsNullOrWhiteSpace (forSearchString)) { return true; } else { searchViewModel.SearchText = forSearchString; BeginSearch (controller); return false; // We'll search asynchronously } }
public override bool ShouldReloadForSearchString(UISearchDisplayController controller, string forSearchString) { if (_searchText != forSearchString) { _searchText = forSearchString; //Send message to wipe out TableView _hub.Publish(new SearchMessage(this, null, 0)); } return(false); }
protected virtual void DidLoadSearchResults(UISearchDisplayController controller, UITableView tableView) { tableView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; tableView.AutosizesSubviews = true; if (rowHeight > 0) { tableView.RowHeight = rowHeight; } searchLoaded = true; }
public override void WillBeginSearch(UISearchDisplayController controller) { if (_controller == null) { //Has to be stored in a member variable, GC collects and breaks something _controller = controller; _controller.SearchBar.SearchButtonClicked += (sender, e) => { _hub.Publish(new SearchMessage(this, _searchText, _searchScope)); }; } }
void ReleaseDesignerOutlets() { if (ContentView != null) { ContentView.Dispose(); ContentView = null; } if (searchDisplayController != null) { searchDisplayController.Dispose(); searchDisplayController = null; } }
public override bool ShouldReloadForSearchString(UISearchDisplayController controller, string forSearchString) { if (string.IsNullOrWhiteSpace(forSearchString)) { return(true); } else { searchViewModel.SearchText = forSearchString; BeginSearch(controller); return(false); // We'll search asynchronously } }
public override void ViewDidLoad() { base.ViewDidLoad(); locationManager.RequestWhenInUseAuthorization(); // set map type and show user location map.MapType = MKMapType.Standard; map.ShowsUserLocation = true; map.Bounds = View.Bounds; // set map center and region double lat = 42.374260; double lon = -71.120824; var mapCenter = new CLLocationCoordinate2D(lat, lon); var mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 2000, 2000); map.CenterCoordinate = mapCenter; map.Region = mapRegion; // add an annotation map.AddAnnotation(new MKPointAnnotation() { Title = "MyAnnotation", Coordinate = new CLLocationCoordinate2D(42.364260, -71.120824) }); // set the map delegate mapDel = new MyMapDelegate(); map.Delegate = mapDel; // add a custom annotation map.AddAnnotation(new MonkeyAnnotation("Xamarin", mapCenter)); // add an overlay var circleOverlay = MKCircle.Circle(mapCenter, 1000); map.AddOverlay(circleOverlay); // create search controller searchBar = new UISearchBar(new CGRect(0, 20, View.Frame.Width, 50)) { Placeholder = "Enter a search query" }; searchController = new UISearchDisplayController(searchBar, this); searchController.Delegate = new SearchDelegate(map); searchController.SearchResultsSource = new SearchSource(searchController, map); View.AddSubview(searchBar); }
public FavoritesViewController(IFavoritesRepository favoritesRepository, IDirectoryService service, Search savedSearch) { this.favoritesRepository = favoritesRepository; Title = "Favorites"; viewModel = new FavoritesViewModel(favoritesRepository, groupByLastName: true); viewModel.PropertyChanged += HandleViewModelPropertyChanged; searchViewModel = new SearchViewModel(service, savedSearch); // // Configure this view // var favoritesDelegate = new PeopleGroupsDelegate(TableView); favoritesDelegate.PersonSelected += HandlePersonSelected; TableView.DataSource = new PeopleGroupsDataSource(viewModel.Groups); TableView.Delegate = favoritesDelegate; TableView.SectionIndexMinimumDisplayRowCount = 10; // // Configure the search bar // searchBar = new UISearchBar(new CGRect(0, 0, 320, 44)) { ShowsScopeBar = true, }; searchBar.ScopeButtonTitles = new[] { "Name", "Title", "Dept", "All" }; searchBar.SelectedScopeButtonIndex = (int)savedSearch.Property; searchController = new UISearchDisplayController(searchBar, this) { SearchResultsDataSource = new PeopleGroupsDataSource(searchViewModel.Groups), Delegate = new SearchDisplayDelegate(searchViewModel) }; var searchDelegate = new PeopleGroupsDelegate(searchController.SearchResultsTableView); searchController.SearchResultsTableView.SectionIndexMinimumDisplayRowCount = 10; searchDelegate.PersonSelected += HandleSearchPersonSelected; searchController.SearchResultsDelegate = searchDelegate; TableView.TableHeaderView = searchBar; }
public override void ViewDidLoad () { base.ViewDidLoad (); locationManager.RequestWhenInUseAuthorization (); // set map type and show user location map.MapType = MKMapType.Standard; map.ShowsUserLocation = true; map.Bounds = View.Bounds; // set map center and region double lat = 42.374260; double lon = -71.120824; var mapCenter = new CLLocationCoordinate2D (lat, lon); var mapRegion = MKCoordinateRegion.FromDistance (mapCenter, 2000, 2000); map.CenterCoordinate = mapCenter; map.Region = mapRegion; // add an annotation map.AddAnnotation (new MKPointAnnotation () { Title = "MyAnnotation", Coordinate = new CLLocationCoordinate2D (42.364260, -71.120824) }); // set the map delegate mapDel = new MyMapDelegate (); map.Delegate = mapDel; // add a custom annotation map.AddAnnotation (new MonkeyAnnotation ("Xamarin", mapCenter)); // add an overlay var circleOverlay = MKCircle.Circle (mapCenter, 1000); map.AddOverlay (circleOverlay); // create search controller searchBar = new UISearchBar (new CGRect (0, 20, View.Frame.Width, 50)) { Placeholder = "Enter a search query" }; searchController = new UISearchDisplayController (searchBar, this); searchController.Delegate = new SearchDelegate (map); searchController.SearchResultsSource = new SearchSource (searchController, map); View.AddSubview (searchBar); }
void ReleaseDesignerOutlets () { if (clearColors != null) { clearColors.Dispose (); clearColors = null; } if (loadColors != null) { loadColors.Dispose (); loadColors = null; } if (searchBar != null) { searchBar.Dispose (); searchBar = null; } if (searchDisplayController != null) { searchDisplayController.Dispose (); searchDisplayController = null; } }
public FavoritesViewController(IFavoritesRepository favoritesRepository, IDirectoryService service, Search savedSearch) { this.favoritesRepository = favoritesRepository; Title = "Favorites"; viewModel = new FavoritesViewModel (favoritesRepository, groupByLastName: true); viewModel.PropertyChanged += HandleViewModelPropertyChanged; searchViewModel = new SearchViewModel (service, savedSearch); // // Configure this view // var favoritesDelegate = new PeopleGroupsDelegate (TableView); favoritesDelegate.PersonSelected += HandlePersonSelected; TableView.DataSource = new PeopleGroupsDataSource (viewModel.Groups); TableView.Delegate = favoritesDelegate; TableView.SectionIndexMinimumDisplayRowCount = 10; // // Configure the search bar // searchBar = new UISearchBar (new CGRect (0f, 0f, 320f, 44f)) { ShowsScopeBar = true, }; searchBar.ScopeButtonTitles = new[] { "Name", "Title", "Dept", "All" }; searchBar.SelectedScopeButtonIndex = (int)savedSearch.Property; searchController = new UISearchDisplayController (searchBar, this) { SearchResultsDataSource = new PeopleGroupsDataSource (searchViewModel.Groups), Delegate = new SearchDisplayDelegate (searchViewModel) }; var searchDelegate = new PeopleGroupsDelegate (searchController.SearchResultsTableView); searchController.SearchResultsTableView.SectionIndexMinimumDisplayRowCount = 10; searchDelegate.PersonSelected += HandleSearchPersonSelected; searchController.SearchResultsDelegate = searchDelegate; TableView.TableHeaderView = searchBar; }
void BeginSearch(UISearchDisplayController controller) { // Remember the search criteria so we can respond only to relevant events lastTableView = controller.SearchResultsTableView; lastSearchText = searchViewModel.SearchText; lastSearchProperty = searchViewModel.SearchProperty; // Display an activity indicator if (lastTableView != null) { if (!activity.Value.IsRunning) { activity.Value.StartInView(lastTableView); } lastTableView.BringSubviewToFront(activity.Value); } // Begin the search searchViewModel.Search(); }
public override bool ShouldReloadForSearchScope (UISearchDisplayController controller, int forSearchOption) { switch (forSearchOption) { case 0: searchViewModel.SearchProperty = SearchProperty.Name; break; case 1: searchViewModel.SearchProperty = SearchProperty.Title; break; case 2: searchViewModel.SearchProperty = SearchProperty.Department; break; case 3: searchViewModel.SearchProperty = SearchProperty.All; break; } BeginSearch (controller); return false; // We'll search asynchronously }
protected void DisplayCategories(UISearchBar searchBar) { categories = new List<Category> (); foreach (var phrase in CategoryManager.GetCategories()) { categories.Add (phrase); } // Bind to search display controller UISearchDisplayController searchDisplayController = new UISearchDisplayController(searchBar, this); CategoryTableSource source = new CategoryTableSource (categories.ToArray(), filteredCategories.ToArray(), this); table.Source = source; searchDisplayController.SearchResultsSource = source; searchDisplayController.SearchBar.TextChanged += (sender, e) => { string text = e.SearchText.Trim (); filteredCategories = (from category in categories where category.Name.ToUpper ().Contains (text.ToUpper ()) select category).ToList (); source.filteredItems = filteredCategories.ToArray (); }; }
void ReleaseDesignerOutlets() { if (clearColors != null) { clearColors.Dispose(); clearColors = null; } if (loadColors != null) { loadColors.Dispose(); loadColors = null; } if (searchBar != null) { searchBar.Dispose(); searchBar = null; } if (searchDisplayController != null) { searchDisplayController.Dispose(); searchDisplayController = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); // searchBar searchBar = new CustomSearchBar(); searchBar.Frame = new CGRect(0, 0, RESULT_WIDTH, searchBar.Frame.Height); searchBar.Placeholder = "Search for Books"; searchBar.Text = searchString; this.View.AddSubview(searchBar); // searchDelegate BookSearchDisplayDelegate searchDelegate = new BookSearchDisplayDelegate(this); searchDelegate.DidBeginEvent += HandleDidBeginEvent; // searchDisplayController searchDisplayController = new UISearchDisplayController(searchBar, this); searchDisplayController.Delegate = searchDelegate; this.View.AutoresizingMask = UIViewAutoresizing.None; this.View.Frame = new CGRect(0, 0, searchBar.Frame.Width, 600); }
public override bool ShouldReloadForSearchScope(UISearchDisplayController controller, nint forSearchOption) { switch (forSearchOption) { case 0: searchViewModel.SearchProperty = SearchProperty.Name; break; case 1: searchViewModel.SearchProperty = SearchProperty.Title; break; case 2: searchViewModel.SearchProperty = SearchProperty.Department; break; case 3: searchViewModel.SearchProperty = SearchProperty.All; break; } BeginSearch(controller); return(false); // We'll search asynchronously }
public override bool ShouldReloadForSearchString(UISearchDisplayController controller, string forSearchString) { // create search request var searchRequest = new MKLocalSearchRequest(); searchRequest.NaturalLanguageQuery = forSearchString; searchRequest.Region = new MKCoordinateRegion(map.UserLocation.Coordinate, new MKCoordinateSpan(0.25, 0.25)); // perform search var localSearch = new MKLocalSearch(searchRequest); localSearch.Start(delegate(MKLocalSearchResponse response, NSError error) { if (response != null && error == null) { ((SearchSource)controller.SearchResultsSource).MapItems = response.MapItems.ToList(); controller.SearchResultsTableView.ReloadData(); } else { Console.WriteLine("local search error: {0}", error); // In "MKTypes.h" in the MapKit framework, the following is defined: // // Error constants for the Map Kit framework. // // enum MKErrorCode { // MKErrorUnknown = 1, // MKErrorServerFailure, // MKErrorLoadingThrottled, // MKErrorPlacemarkNotFound, // }; } }); return(true); }
protected virtual void DidHideSearchResults (UISearchDisplayController controller, UITableView tableView) { }
public override bool ShouldReloadForSearchString(UISearchDisplayController controller, string forSearchString) { // create search request var searchRequest = new MKLocalSearchRequest (); searchRequest.NaturalLanguageQuery = forSearchString; searchRequest.Region = new MKCoordinateRegion (map.UserLocation.Coordinate, new MKCoordinateSpan (0.25, 0.25)); // perform search var localSearch = new MKLocalSearch (searchRequest); localSearch.Start (delegate (MKLocalSearchResponse response, NSError error) { if (response != null && error == null) { ((SearchSource)controller.SearchResultsSource).MapItems = GetList(response.MapItems); controller.SearchResultsTableView.ReloadData(); } else { Console.WriteLine ("local search error: {0}", error); } }); return true; }
public AccountSource(AccountVC brandController) { this.accountController = brandController; search = brandController.searchDisplayController; }
protected virtual void DidLoadSearchResults (UISearchDisplayController controller, UITableView tableView) { tableView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; tableView.AutosizesSubviews = true; if (rowHeight > 0) tableView.RowHeight = rowHeight; searchLoaded = true; }
public override bool ShouldReloadForSearchScope(UISearchDisplayController controller, int forSearchOption) { return true; }
protected virtual void WillUnloadSearchResults (UISearchDisplayController controller, UITableView tableView) { searchLoaded = false; }
protected virtual void DidEndSearch(UISearchDisplayController controller) { }
protected virtual void WillBeginSearch(UISearchDisplayController controller) { }
protected virtual bool ShouldReloadForSearchString (UISearchDisplayController controller, string search) { return true; }
public virtual bool ShouldReloadForSearchScope(UISearchDisplayController controller, int searchOption) { FilterContent(controller.SearchBar.Text, controller.SearchBar.ScopeButtonTitles[searchOption]); return true; }
public virtual bool ShouldReloadForSearchString(UISearchDisplayController controller, string searchText) { FilterContent(searchText, controller.SearchBar.ScopeButtonTitles[controller.SearchBar.SelectedScopeButtonIndex]); return true; }
protected override bool ShouldReloadForSearchString(UISearchDisplayController controller, string search) { SearchModel.SearchText = search; return(true); }
public SearchSource(UISearchDisplayController searchController, MKMapView map) { this.searchController = searchController; this.map = map; MapItems = new List<MKMapItem> (); }
protected virtual bool ShouldReloadForSearchScope (UISearchDisplayController controller, int scope) { return true; }
protected virtual void WillShowSearchResults (UISearchDisplayController controller, UITableView tableView) { }
protected virtual void WillUnloadSearchResults(UISearchDisplayController controller, UITableView tableView) { searchLoaded = false; }
public AgendaSearchSource(AgendaSearchViewController searchViewController) { this.searchViewController = searchViewController; _search = searchViewController.searchDisplayController; }
protected virtual void WillShowSearchResults(UISearchDisplayController controller, UITableView tableView) { }
public override bool ShouldReloadForSearchString(UISearchDisplayController controller, string forSearchString) { if (!string.IsNullOrWhiteSpace(forSearchString)) { var searchText = forSearchString.ToUpper(); var searchInfos = Infos.Where(i => i.Code.StartsWith(searchText) || i.Name.ToUpper().StartsWith(searchText)); (controller.SearchResultsTableView.Source as InfosTableSource).UpdateAll(searchInfos); } return true; }
protected virtual void DidHideSearchResults(UISearchDisplayController controller, UITableView tableView) { }
protected virtual void DidEndSearch (UISearchDisplayController controller) { }
protected virtual bool ShouldReloadForSearchScope(UISearchDisplayController controller, int scope) { return(true); }
void BeginSearch (UISearchDisplayController controller) { // Remember the search criteria so we can respond only to relevant events lastTableView = controller.SearchResultsTableView; lastSearchText = searchViewModel.SearchText; lastSearchProperty = searchViewModel.SearchProperty; // Display an activity indicator if (lastTableView != null) { if (!activity.Value.IsRunning) { activity.Value.StartInView (lastTableView); } lastTableView.BringSubviewToFront (activity.Value); } // Begin the search searchViewModel.Search (); }
protected virtual bool ShouldReloadForSearchString(UISearchDisplayController controller, string search) { return(true); }
protected override void DidEndSearch(UISearchDisplayController controller) { selectedRow[1] = null; searching = false; }
protected override void DidBeginSearch(UISearchDisplayController controller) { searching = true; }