コード例 #1
0
        public async void GetRecentContacts()
        {
            Mvx.Resolve <IProgressBar>().ShowProgressDialog("Getting History. ");
            var recentContacts = await RecentContactDatabase.GetRecentContacts();

            RecentContacts.Clear();
            recentContactsCopy.Clear();
            foreach (var recentContact in recentContacts)
            {
                recentContactsCopy.Add(recentContact);
            }
            foreach (RecentContact recentContact in recentContactsCopy)
            {
                if (recentContact.RequesterFullName.Equals(SearchViewModel.user) || recentContact.RespondentFullName.Equals(SearchViewModel.user))
                {
                    RecentContacts.Add(recentContact);
                }
            }
            foreach (RecentContact recentContact in RecentContacts)
            {
                if (recentContact.RequesterFullName.Equals(SearchViewModel.user))
                {
                    string copy = recentContact.RequestedAtString;
                    recentContact.RequestedAtString = "Sent " + copy;
                }
                else if (recentContact.RespondentFullName.Equals(SearchViewModel.user))
                {
                    string RespondentFullNameCopy = recentContact.RespondentFullName;
                    string RequestedAtStringcopy  = recentContact.RequestedAtString;
                    recentContact.RequestedAtString  = "Received " + RequestedAtStringcopy;
                    recentContact.RespondentFullName = recentContact.RequesterFullName;
                    recentContact.RequesterFullName  = RespondentFullNameCopy;
                }
            }
            Mvx.Resolve <IProgressBar>().HideProgressDialog();
        }