public override void Selected(DialogViewController controller, UITableView tableView, object item, NSIndexPath indexPath) { if (ProgressButtonData.IndicatorStyle == IndicatorStyle.Hud) { var progress = new ProgressHud() { TitleText = ProgressButtonData.Title, DetailText = ProgressButtonData.DetailText, MinimumShowTime = ProgressButtonData.MinimumShowTime, GraceTime = ProgressButtonData.GraceTime }; Action asyncCompleted = null; asyncCompleted = progress.ShowWhileAsync(() => { if (DataContext != null) { InvokeOnMainThread(() => { ExecuteMethod(asyncCompleted); }); } }, true); } else { base.Selected(controller, tableView, item, indexPath); } tableView.DeselectRow(indexPath, true); }
public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { tableView.DeselectRow(path, true); if (ShowHud) { _ProgressHud = new ProgressHud() { TitleText = Title, DetailText = DetailsText, Mode = HudProgressMode.Indeterminate }; if (Command != null && Command.CanExecute(CommandParameter)) { _ProgressHud.ShowWhileExecuting(()=>Command.Execute(CommandParameter), true); } } else { ShowIndicator(()=>Command.Execute(CommandParameter)); } }
public void PerformFilter(string text) { if (_OriginalSections == null) return; var progress = new ProgressHud() { TitleText = string.Format("Searching for {0}", text) , GraceTime = 0.5f }; progress.ShowWhileExecuting(()=> { var index = 0; foreach(var section in _OriginalSections.Values) { section.DataContext = _OriginalDataContext[index++] as IList; } OnSearchTextChanged(text); var newSections = new Dictionary<int, Section>(); var searchable = TableView.Source as ISearchBar; if (searchable != null) { if (searchable.SearchCommand == null) { index = 0; foreach(var section in _OriginalSections.Values) { if (TableView.Source is ListSource) { var newList = new List<object>(); var list = section.DataContext as IEnumerable; if (list != null) { foreach(var item in list) { var caption = item as ICaption; var searchableItem = item as ISearchable; if ((searchableItem != null && searchableItem.Matches(text)) || (caption != null && !string.IsNullOrEmpty(caption.Caption)) || item.ToString().ToLower().Contains(text.ToLower())) { newList.Add(item); if (!newSections.ContainsKey(index)) { newSections.Add(index, section); } } } } section.DataContext = newList; } index++; } } else { newSections = searchable.SearchCommand.Execute(_OriginalSections, text); } } ((BaseDialogViewSource)TableView.Source).Sections = newSections; InvokeOnMainThread(()=>ReloadData()); }, true); }
public void PerformFilter(string text) { if (_OriginalSections == null) { return; } var progress = new ProgressHud() { TitleText = string.Format("Searching for {0}", text), GraceTime = 0.5f }; progress.ShowWhileExecuting(() => { var index = 0; foreach (var section in _OriginalSections.Values) { section.DataContext = _OriginalDataContext[index++] as IList; } OnSearchTextChanged(text); var newSections = new Dictionary <int, Section>(); var searchable = TableView.Source as ISearchBar; if (searchable != null) { if (searchable.SearchCommand == null) { index = 0; foreach (var section in _OriginalSections.Values) { if (TableView.Source is ListSource) { var newList = new List <object>(); var list = section.DataContext as IEnumerable; if (list != null) { foreach (var item in list) { var caption = item as ICaption; var searchableItem = item as ISearchable; if ((searchableItem != null && searchableItem.Matches(text)) || (caption != null && !string.IsNullOrEmpty(caption.Caption)) || item.ToString().ToLower().Contains(text.ToLower())) { newList.Add(item); if (!newSections.ContainsKey(index)) { newSections.Add(index, section); } } } } section.DataContext = newList; } index++; } } else { newSections = searchable.SearchCommand.Execute(_OriginalSections, text); } } ((BaseDialogViewSource)TableView.Source).Sections = newSections; InvokeOnMainThread(() => ReloadData()); }, true); }