Ejemplo n.º 1
0
        private void AddToOnlineUserList(SynchronizationContext uiContext, IJsonContainer container)
        {
            foreach (var item in container.Persons)
            {
                UserContent temporaryUserContent = new UserContent();

                if (item.Pic != null)
                {
                    ConvertImage.ByteToImage(item.Pic, item.PersonId);

                    temporaryUserContent.UserPicture = item.PicturePath;
                }
                else
                {
                    if (item.Female == true)
                    {
                        temporaryUserContent.UserPicture = Gender.Female;
                    }
                    if (item.Male == true)
                    {
                        temporaryUserContent.UserPicture = Gender.Male;
                    }
                }

                temporaryUserContent.UserName = item.Name;
                temporaryUserContent.PersonId = item.PersonId;

                uiContext.Send(x => OnlineUsers.UserList.Insert(0, temporaryUserContent), null);
            }
        }
Ejemplo n.º 2
0
        private void ChangeOnlineUserList(SynchronizationContext uiContext, IJsonContainer container, string textFromServer)
        {
            UserContent temporaryUserContent = new UserContent();

            if (container.Persons.Count > OnlineUsers.UserList.Count)
            {
                if (container.Persons[container.Persons.Count - 1].Pic != null)
                {
                    ConvertImage.ByteToImage(container.Persons[container.Persons.Count - 1].Pic,
                                             container.Persons[container.Persons.Count - 1].PersonId);
                    temporaryUserContent.UserPicture = container.Persons[container.Persons.Count - 1].PicturePath;
                    temporaryUserContent.UserName    = container.Persons[container.Persons.Count - 1].Name;
                    temporaryUserContent.PersonId    = container.Persons[container.Persons.Count - 1].PersonId;
                }
                else
                {
                    if (container.Persons[container.Persons.Count - 1].Female == true)
                    {
                        temporaryUserContent.UserPicture = Gender.Female;
                    }
                    if (container.Persons[container.Persons.Count - 1].Male == true)
                    {
                        temporaryUserContent.UserPicture = Gender.Male;
                    }
                    temporaryUserContent.UserName = container.Persons[container.Persons.Count - 1].Name;
                    temporaryUserContent.PersonId = container.Persons[container.Persons.Count - 1].PersonId;
                }

                uiContext.Send(x => OnlineUsers.UserList.Insert(0, temporaryUserContent), null);
            }
            else
            {
                uiContext.Send(x => OnlineUsers.UserList.RemoveAt(GetIndexToRemove(container.Persons)), null);
            }
        }