private void OnGetPresenceOfFriendsSuccess(string in_stringData, object in_obj)
        {
            GStateManager.Instance.EnableLoadingSpinner(false);
            GDebug.Log(string.Format("OnGetPresenceOfFriends Success | {0}", in_stringData));

            Friends.Clear();

            Dictionary <string, object> jsonMessage = (Dictionary <string, object>)JsonReader.Deserialize(in_stringData);
            Dictionary <string, object> jsonData    = (Dictionary <string, object>)jsonMessage[BrainCloudConsts.JSON_DATA];

            if (jsonData.ContainsKey(BrainCloudConsts.JSON_PRESENCE))
            {
                PlayerData pData   = null;
                object[]   friends = ((object[])jsonData[BrainCloudConsts.JSON_PRESENCE]);
                if (friends.Length > 0)
                {
                    for (int it = 0; it < friends.Length; ++it)
                    {
                        pData = new PlayerData();
                        pData.ReadPresencePlayerData(friends[it]);
                        Friends.Add(pData);
                    }
                }
            }

            GEventManager.TriggerEvent(ON_FRIENDS_LIST_UPDATED);
        }
        private void refreshListsOfFriends()
        {
            Friends.Clear();

            using (var db = new GoalMasterDatabaseContext())
            {
                var user      = db.Users.FirstOrDefault(x => x.ID == User.ID);
                var relations = db.Relationships.Where(x => x.UserOne.ID == user.ID ||
                                                       x.UserTwo.ID == user.ID);
                var relatedUsers = new List <User>();

                var friends = new List <Tuple <string, string> >();

                foreach (var relation in relations)
                {
                    if (relation.UserOne != user)
                    {
                        relatedUsers.Add(relation.UserOne);
                        friends.Add(new Tuple <string, string>(relation.UserOne.Login, relation.Status.Description));
                    }

                    if (relation.UserTwo != user)
                    {
                        relatedUsers.Add(relation.UserTwo);
                        friends.Add(new Tuple <string, string>(relation.UserTwo.Login, relation.Status.Description));
                    }
                }
                _users = db.Users.Where(x => x.Login != User.Login).ToList();

                _users = _users.Except(relatedUsers).ToList();

                PossibleFriends = new ObservableCollection <User>(_users);
                Friends         = new ObservableCollection <Tuple <string, string> >(friends);
            }
        }
        public void Load()
        {
            var friends = _friendDataService.GetAll();

            Friends.Clear();
            Friends = new ObservableCollection <Friend>(friends);
        }
        public async Task LoadAsync()
        {
            Friends.Clear();

            var lookup = await _friendLookupDataService.GetFriendLookupAsync();

            foreach (var friend in lookup)
            {
                Friends.Add(new NavigationItemViewModel(friend.Id, friend.DisplayMember,
                                                        nameof(FriendDetailViewModel),
                                                        _eventAggregator));
            }



            Meetings.Clear();

            lookup = await _meetingLookUpService.GetMeetingLookupAsync();

            foreach (var meeting in lookup)
            {
                Meetings.Add(new NavigationItemViewModel(meeting.Id, meeting.DisplayMember,
                                                         nameof(MeetingDetailViewModel),
                                                         _eventAggregator));
            }
        }
        public async Task LoadAsync()
        {
            //lookup - contained friends list
            var lookup = await _friendLookupDataService.GetFriendLookupAsync();

            Friends.Clear();
            foreach (var item in lookup)
            {
                Friends.Add(new NavigationItemViewModel(item.Id,
                                                        item.DisplayMember,
                                                        nameof(FriendDetailViewModel),
                                                        _eventAggregator));
            }

            //lookup - contained friends list
            lookup = await _meetingLookupDataService.GetMeetingLookupAsync();

            Meetings.Clear();
            foreach (var item in lookup)
            {
                Meetings.Add(new NavigationItemViewModel(item.Id,
                                                         item.DisplayMember,
                                                         nameof(MeetingDetailViewModel),
                                                         _eventAggregator));
            }
        }
Esempio n. 6
0
 public async Task ClearFriends()
 {
     CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
     {
         Friends.Clear();
     });
 }
Esempio n. 7
0
        private void refreshListsOfFriends()
        {
            Friends.Clear();

            using (var db = new GoalMasterDatabaseContext())
            {
                var user      = db.Users.FirstOrDefault(x => x.ID == User.ID);
                var relations = db.Relationships.Where(x => (x.UserOne.ID == user.ID ||
                                                             x.UserTwo.ID == user.ID) &&
                                                       x.Status.ID == (int)RelationshipStatusDefined.Accepted
                                                       );

                var invitedUsers = db.GoalDefinitions.FirstOrDefault(x => x.ID == _goalDefinition.ID).Users.Where(x => x.ID != User.ID);
                var relatedUsers = new List <User>();

                var friends = new List <User>();

                foreach (var relation in relations)
                {
                    if (relation.UserOne != user)
                    {
                        friends.Add(relation.UserOne);
                    }

                    if (relation.UserTwo != user)
                    {
                        friends.Add(relation.UserTwo);
                    }
                }
                friends        = friends.Except(invitedUsers).ToList();
                Friends        = new ObservableCollection <User>(friends);
                InvitedFriends = new ObservableCollection <User>(invitedUsers);
            }
        }
 public void Load()
 {
     Friends.Clear();
     foreach (var item in _dataProvider.GetAllFriends())
     {
         Friends.Add(item);
     }
 }
 public void Load()
 {
     Friends.Clear();
     foreach (var friend in _dataProvider.GetAllFriends())
     {
         Friends.Add(friend);
     }
 }
 public void Load()
 {
     Friends.Clear();
     foreach (var friend in _dataProvider.GetAllFriends())
     {
         Friends.Add(new NavigationItemViewModel(friend.Id, friend.DisplayMember, _eventAggregator));
     }
 }
Esempio n. 11
0
 private void ClearProperties()
 {
     Athlete = null;
     StarredSegments.Clear();
     Followers.Clear();
     Friends.Clear();
     BothFollowing.Clear();
     Koms.Clear();
 }
Esempio n. 12
0
 //更新friends
 public List <User> FriendsChange(List <User> users)
 {
     Friends.Clear();
     foreach (User user in users)
     {
         Friends.Add(user);
     }
     return(users);
 }
Esempio n. 13
0
        public override void Dispose()
        {
            base.Dispose();

            ResetCancellationTokenSource(ref _getFriendsCancellationTokenSource);

            Friends?.ForEach(f => f.Dispose());
            Friends?.Clear();
        }
Esempio n. 14
0
        public void Load()
        {
            var friends = _friendDataService.GetAll();

            Friends.Clear();
            foreach (var friend in friends)
            {
                Friends.Add(friend);
            }
        }
        public async Task LoadAsync()
        {
            var lookup = await _friendLookupService.GetFriendLookupAsync();

            Friends.Clear();
            foreach (var item in lookup)
            {
                Friends.Add(new NavigationItemViewModel(item.Id, item.DisplayMember));
            }
        }
        private async Task LoadFriends()
        {
            var lookup = await _lookupDataService.GetFriendLookupAsync();

            Friends.Clear();
            foreach (var friend in lookup)
            {
                Friends.Add(new NavigationItemViewModel(friend.Id, friend.DisplayMember, _eventAggregator, nameof(FriendDetailViewModel)));
            }
        }
Esempio n. 17
0
        public async Task LoadAsync()
        {
            var lstFriend = await _friendLookupDataService.GetLstFriendLookupAsync();

            Friends.Clear();
            foreach (var friend in lstFriend)
            {
                Friends.Add(new NavigationItemViewModel(friend.Id, friend.DisplayMember));
            }
        }
Esempio n. 18
0
        public async Task LoadAsync()
        {
            var friends = await _friendDataService.GetAllAsync();

            Friends.Clear();
            foreach (var friend in friends)
            {
                Friends.Add(friend);
            }
        }
Esempio n. 19
0
        private async Task Refresh()
        {
            Friends.Clear();
            var friends = await _friendSerice.Refresh();

            foreach (var friend in friends)
            {
                Friends.Add(friend);
            }
        }
Esempio n. 20
0
        public async Task LoadAsync()
        {
            var lookup = await _lookupDataService.GetFriendLookupAsync();

            Friends.Clear();
            foreach (var item in lookup)
            {
                Friends.Add(item);
            }
        }
Esempio n. 21
0
        public async Task LoadAsync()
        {
            IEnumerable <LookupItem> lookups = await _friendLookupDataService.GetFriendLookupAsync();

            Friends.Clear();

            foreach (var item in lookups)
            {
                Friends.Add(new NavigationItemViewModel(item.Id, item.DisplayMember));
            }
        }
Esempio n. 22
0
        async Task LoadToCollection(IEnumerable <Friend> friends)
        {
            await FriendsSemaphore.WaitAsync().ConfigureAwait(false);

            using (Friends.UpdatesBlock()) {
                Friends.Clear();
                Friends.AddRange(friends);
            }

            FriendsSemaphore.Release();
        }
Esempio n. 23
0
        public async Task LoadAsync()
        {
            var friends = await _friendDataService.GetAllAsync();

            Friends.Clear();
            foreach (var friend in friends)
            {
                Friends.Add(friend);
            }
            clientsCollection.Source  = Friends;
            clientsCollection.Filter += usersCollection_Filter;
        }
Esempio n. 24
0
        public void Load()
        {
            clientsCollection = new CollectionViewSource();
            var friends = _friendDataService.GetAllAsync().Result;

            Friends.Clear();
            foreach (var friend in friends)
            {
                Friends.Add(friend);
            }
            clientsCollection.Source  = Friends;
            clientsCollection.Filter += usersCollection_Filter;
        }
        public async Task LoadAsync()
        {
            Friends.Clear();
            var lookup = await _friendDataService.GetFriendLookupAsync();

            lookup.ToList().ForEach(x =>
                                    Friends.Add(new NavigationItemViewModel(x.Id, x.DisplayMember, nameof(FriendDetailViewModel), _eventAggregator)));

            Meetings.Clear();
            lookup = await _meetingDataService.GetMeetingLookupAsync();

            lookup.ToList().ForEach(x =>
                                    Meetings.Add(new NavigationItemViewModel(x.Id, x.DisplayMember, nameof(MeetingDetailViewModel), _eventAggregator)));
        }
Esempio n. 26
0
        public async Task LoadAsync()
        {
            var lookup = await _dataService.GetFriendLookupAsync();

            Friends.Clear();

            foreach (var item in lookup)
            {
                Friends.Add(
                    new NavigationItemViewModel(item.Id, item.DisplayMember,
                                                nameof(FriendDetailViewModel),
                                                _eventAggregator));
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Load the friends from the Friends Data Service
        /// </summary>
        public void Load()
        {
            //Gets all the friends from the data Service
            //implement the IFriendDataService interface
            var friends = _friendDataService.GetAll();

            //To ensure that the load method can be called multiple times
            //so as not to have duplicates
            Friends.Clear();

            //get all the friends from friends
            foreach (var friend in friends)
            {
                Friends.Add(friend);
            }
        }
Esempio n. 28
0
        public async Task LoadAsync()
        {
            var lookup = await _LookUpService.GetFriendLookUpAsync();

            Friends.Clear();
            foreach (var look in lookup)
            {
                Friends.Add(new NavigationItemViewModel(look.Id, look.FirstName, _eventAggregator, nameof(FriendDetailViewModel)));
            }
            lookup = await _meetingLookUpDataService.GetMeetingLookUpAsync();

            Meetings.Clear();
            foreach (var look in lookup)
            {
                Meetings.Add(new NavigationItemViewModel(look.Id, look.FirstName, _eventAggregator, nameof(MeetingDetailViewModel)));
            }
        }
Esempio n. 29
0
        private async Task LoadNavigationFriends()
        {
            var friendsLookupServiceCall = await this._friendService
                                           .GetAllAsync();

            Friends.Clear();

            foreach (var friend in friendsLookupServiceCall)
            {
                Friends.Add(
                    new NavigationViewItemModel(
                        friend.Id,
                        friend.FullName(),
                        this._eventAggregator,
                        nameof(FriendDetailViewModel)));
            }
        }
Esempio n. 30
0
        public async Task RefreshFriendsList()
        {
            using (var handler = new ZumoAuthHeaderHandler())
            {
                using (var client = MobileServiceClientFactory.CreateClient(handler))
                {
                    var dictionary = new Dictionary <string, string> ();
                    dictionary.Add("getFriends", "true");
                    dictionary.Add("userId", AccountService.Instance.Account.UserId);

                    Friends.Clear();
                    var friends = await client.InvokeApiAsync <List <User> > ("friends", System.Net.Http.HttpMethod.Get, dictionary);

                    var sortedFriends = friends.OrderBy(user => user.Name).ToList();
                    sortedFriends.ForEach(user => Friends.Add(user));
                }
            }
        }