TraktPlugin.GUI.GUINetwork.SendFriendsToFacade C# (CSharp) Méthode

SendFriendsToFacade() private méthode

private SendFriendsToFacade ( IEnumerable friends ) : void
friends IEnumerable
Résultat void
        private void SendFriendsToFacade(IEnumerable<TraktNetworkFriend> friends)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);
            ClearProperties();

            if (friends == null)
            {
                GUIUtils.ShowNotifyDialog(Translation.Error, Translation.ErrorGeneral);
                GUIWindowManager.ActivateWindow(GUIWindowManager.GetPreviousActiveWindow());
                return;
            }

            int friendCount = friends.Count();

            GUIUtils.SetProperty("#itemcount", friendCount.ToString());
            GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", friendCount.ToString(), friendCount > 1 ? Translation.Friends : Translation.Friend));

            if (friendCount == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoFriendsTaunt);
                if (viewButton != null)
                {
                    // let user select another view since there is nothing to show here
                    GUIControl.FocusControl(GetID, viewButton.GetID);
                }
                else
                {
                    GUIWindowManager.ShowPreviousWindow();
                }
                return;
            }

            int id = 0;

            var userImages = new List<GUITraktImage>();

            // Add each friend to the list
            foreach (var friend in friends.OrderBy(f => f.FriendsAt.FromISO8601()))
            {
                // add image to download
                var images = new GUITraktImage { UserImages = friend.User.Images };
                userImages.Add(images);

                var userItem = new GUIUserListItem(friend.User.Username, (int)TraktGUIWindows.Network);

                userItem.Label2 = friend.FriendsAt.FromISO8601().ToShortDateString();
                userItem.Images = images;
                userItem.TVTag = friend;
                userItem.User = friend.User;
                userItem.ItemId = id++;
                userItem.IsFriend = true;
                userItem.IconImage = "defaultTraktUser.png";
                userItem.IconImageBig = "defaultTraktUserBig.png";
                userItem.ThumbnailImage = "defaultTraktUserBig.png";
                userItem.OnItemSelected += OnUserSelected;
                Utils.SetDefaultIcons(userItem);
                Facade.Add(userItem);
            }

            // restore previous selection
            if (Facade.Count <= PreviousUserSelectedIndex)
                Facade.SelectedListItemIndex = 0;
            else
                Facade.SelectedListItemIndex = PreviousUserSelectedIndex;

            // Set Facade Layout
            Facade.SetCurrentLayout("List");
            GUIControl.FocusControl(GetID, Facade.GetID);

            // Download avatars Async and set to facade
            GUIUserListItem.GetImages(userImages);
        }