private void RefreshItemsFromTable()
        {
            try
            {
                _adapter.Flag   = false;
                _text_view.Text = "Loading..";

                // Get the items that weren't marked as completed and add them in the adapter
                var list = ((MainActivity)Activity).List;
                var favs = ((MainApplication)Activity.Application).FavoriteRepository.GetAllFavorites();
                _adapter.Clear();
                HashSet <string> set = new HashSet <string>();
                foreach (var i in favs)
                {
                    set.Add(i.ToString());
                }
                foreach (var current in list)
                {
                    if (set.Contains(current.Id))
                    {
                        _adapter.Add(current);
                    }
                }

                _adapter.Flag   = true;
                _text_view.Text = GetString(Resource.String.your_favorites);
            }
            catch (Exception e)
            {
                HelpMe.CreateAndShowDialog(e.Message, "Error", Activity);
            }
        }
Exemple #2
0
        //Refresh the list with the items in the local store.
        private void RefreshItemsFromTable()
        {
            try
            {
                //_adapter.Flag = false;
                //_listView.Clickable = false;
                _listView.Enabled = false;
                _textView.Text    = "Loading..";
                // Get the items that weren't marked as completed and add them in the adapter
                var list = ((MainActivity)Activity).List;
                _adapter.Clear();

                foreach (Arrangement current in list)
                {
                    if (current.Author == MainActivity.MyUsername)
                    {
                        _adapter.Add(current);
                    }
                }

                _listView.Enabled = true;
                _adapter.Flag     = true;
                _textView.Text    = GetString(Resource.String.my_plans);
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e.Message, "Error");
            }
        }
        //Refresh the list.
        private void RefreshItemsFromTable()
        {
            try
            {
                _adapter.Flag = false;
                var tmp = _mDateEditext.Text;
                _mDateEditext.Text = "Loading..";

                // Get the items and add them in the adapter
                var list = ((MainActivity)Activity).List;
                _adapter.Clear();

                if (MainActivity.byDateFilter)
                {
                    if (MainActivity.byAuthorFilter)
                    {
                        foreach (var current in list)
                        {
                            if (current.Date.Date == MainActivity.dateFilter.Date && current.Author == MainActivity.Author)
                            {
                                _adapter.Add(current);
                            }
                        }
                    }
                    else
                    {
                        foreach (var current in list)
                        {
                            if (current.Date.Date == MainActivity.dateFilter.Date)
                            {
                                _adapter.Add(current);
                            }
                        }
                    }
                }
                else if (MainActivity.byAuthorFilter)
                {
                    foreach (var current in list)
                    {
                        if (current.Author == MainActivity.Author)
                        {
                            _adapter.Add(current);
                        }
                    }
                }
                else
                {
                    foreach (var current in list)
                    {
                        _adapter.Add(current);
                    }
                }

                if (_adapter.Count == 0 && list.Count != 0)
                {
                    Toast.MakeText(this.Activity, "Not Found", ToastLength.Short).Show();
                }
                _adapter.Flag      = true;
                _mDateEditext.Text = tmp;
            }
            catch (Exception e)
            {
                HelpMe.CreateAndShowDialog(e.Message, "Error", Activity);
            }
        }