public override void SearchButtonClicked (string text) { if (string.IsNullOrWhiteSpace(text)) return; if (Root.Count > 0) Root[0].Clear(); FinishSearch(); var lw = new LoadingView(); lw.Show("Searching for " + text); NSTimer.CreateScheduledTimer (TimeSpan.FromSeconds (0.2), delegate { SearchMirror.Text = text; var entries = new Section () { }; var users = AppDelegateIPhone.AIphone.UsersServ.GetAllUsersByName(SearchMirror.Text); if (users != null) { foreach (var user in users) { entries.Add (new UserElementII(user)); } } Root = new RootElement (Locale.GetText ("Search")){ entries, }; ReloadData(); lw.Hide(); if (users.Count == 0) AppDelegateIPhone.ShowMessage(View, "No match found", null, 2); }); }
public override void SearchButtonClicked (string text) { if (string.IsNullOrWhiteSpace(text)) return; if (Root.Count > 0) Root[0].Clear(); FinishSearch(); var lw = new LoadingView(); lw.Show("Searching for " + text); NSTimer.CreateScheduledTimer (TimeSpan.FromSeconds (0.1), delegate { SearchMirror.Text = text; SearchedText = text; LastTime = DateTime.MaxValue; var entries = new Section () { }; var images = SearchImages (); _foundImages = images; int rowCount = 4; for (int i = 0; i < images.Count; i += rowCount) { var imagesInfos = new List<ImageInfo>(); for (int j = 0; j < rowCount; j++) { var imgInfo = new ImageInfo() { Img = (i + j < images.Count) ? images[i + j] : null, }; imagesInfos.Add(imgInfo); } entries.Add(new Images2Element(imagesInfos, i)); } var more = new CustomLoadMoreElement (lme => { // Launch a thread to do some work ThreadPool.QueueUserWorkItem (delegate { SearchMoreKeywords(entries, lme); }); }); more.Height = 60; more.Image = Graphics.GetImgResource("more"); entries.Add(more); Root = new RootElement (Locale.GetText ("Search")){ entries, }; ReloadData(); lw.Hide(); }); }