Пример #1
0
        private async void FriendListChangedHandler(object sender, FriendListChangedEventArgs e)
        {
            await _dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                () =>
                {
                    switch (e.Action)
                    {
                        case FriendListChangedAction.Add:
                            Friends.Add(new FriendViewModel(e.FriendNumber));
                            return;

                        case FriendListChangedAction.Remove:
                            Friends.Remove(FindFriend(e.FriendNumber));
                            return;

                        case FriendListChangedAction.Reset:
                            Friends.Clear();
                            foreach (var friendN in ToxModel.Instance.Friends)
                            {
                                Friends.Add(new FriendViewModel(friendN));
                            }
                            return;
                    }
                });
        }
Пример #2
0
        private async void FriendListChangedHandler(object sender, FriendListChangedEventArgs e)
        {
            await SaveDataAsync();

            if (FriendListChanged != null)
                FriendListChanged(this, e);
        }
Пример #3
0
        private async void FriendListChangedHandler(object sender, FriendListChangedEventArgs e)
        {
            await SaveDataAsync();

            FriendListChanged?.Invoke(this, e);
        }