public virtual void FinishSearch(bool hide)
{
if (_Searchbar == null) return;
if (_OriginalSections != null)
{
var index = 0;
foreach(var section in _OriginalSections.Values)
{
var list = section.DataContext as IEnumerable;
if (list != null)
{
section.DataContext = _OriginalDataContext[index++] as IList;
}
}
((BaseDialogViewSource)TableView.Source).Sections = _OriginalSections;
_OriginalSections = null;
ReloadData();
}
if (hide)
{
UIView.BeginAnimations(null);
UIView.SetAnimationDuration(0.3);
// we need to perform some post operations after the animation is complete
UIView.SetAnimationDelegate(this);
UIView.SetAnimationDidStopSelector(new Selector("fadeOutDidFinish"));
if (_Searchbar != null)
_Searchbar.Frame = new RectangleF(0, -45, _Searchbar.Frame.Width, 45);
TableView.ContentOffset = new PointF(0, 45);
UIView.CommitAnimations();
}
_Searchbar.ResignFirstResponder();
_Searchbar.Text = string.Empty;
}