示例#1
0
        //author: Michael Kath (n9293833)
        //Displays all the outstanding requests



        public async void RetrieveRequests()
        {
            ListOutStandingReq = new ObservableCollection <AddRequest>();

            //Get current find Requests
            var curerntReq = await UsersDatabase.SelectViaUser(currentUser);

            AddRequests(curerntReq);

            //meanwhile push from the database and check to see if they have changed
            var newRequests = await UsersDatabase.SelectViaUser(currentUser, true);

            //if the counts are different then there must be a database change
            if (newRequests.Count() != curerntReq.Count())
            {
                //update the list
                AddRequests(newRequests);
            }
            else
            {
                var newReq = newRequests.ToList();
                var curReq = newRequests.ToList();
                // compare every new request received from DB against the current DB
                for (int i = 0; i < newRequests.Count(); i++)
                {
                    // if there is a change
                    if (newReq[i] != curReq[i])
                    {
                        //Update the entire list
                        AddRequests(newRequests);
                        break;
                    }
                }
            }
        }