コード例 #1
0
ファイル: Party.cs プロジェクト: marcelomelofreitas/Gwupe
 public void InitParty(PartyElement partyElement)
 {
     Username     = partyElement.user;
     UniqueHandle = partyElement.uniqueHandle;
     Name         = partyElement.name;
     Email        = partyElement.email;
     Location     = partyElement.location;
     Rating       = partyElement.rating;
     Joined       = partyElement.joined;
     Supporter    = partyElement.supporter;
     Firstname    = partyElement.firstname;
     Lastname     = partyElement.lastname;
     Description  = partyElement.description;
     if (!String.IsNullOrWhiteSpace(partyElement.avatarData))
     {
         try
         {
             SetAvatarData(partyElement.avatarData);
         }
         catch (Exception e)
         {
             Logger.Error("Failed to decode avatar from avatar data", e);
         }
     }
 }
コード例 #2
0
        private void AddPartyElementToList(PartyElement partyElement, RelationshipElement relationshipElement, Presence presence = null)
        {
            var party = GwupeClientAppContext.CurrentAppContext.PartyManager.AddUpdatePartyFromElement(partyElement);

            // Make sure we update the relationship
            GwupeClientAppContext.CurrentAppContext.RelationshipManager.AddUpdateRelationship(party.Username, new Relationship(relationshipElement));
            // This is to update the party in the background (avatar)
            ThreadPool.QueueUserWorkItem(state => GwupeClientAppContext.CurrentAppContext.PartyManager.GetParty(partyElement.user, true));
            // Now add it to the list
            AddPartyToList(party, presence);
        }
コード例 #3
0
        public Party AddUpdatePartyFromElement(PartyElement partyElement)
        {
            //Logger.Debug("Updating party " + partyElement.user + " from partyElement.");
            Party party = null;

            lock (_partiesLock)
            {
                if (!_partyLookup.TryGetValue(partyElement.user, out party))
                {
                    //Logger.Debug("Party " + partyElement.user + " doesn't exist locally, creating.");
                    // create the party
                    if (partyElement is UserElement)
                    {
                        party = new Person(partyElement as UserElement);
                    }
                    else
                    {
                        party = new Team(partyElement as TeamElement);
                    }
                    _partyLookup[party.Username] = party;
                    Parties.Add(party);
                }
                else
                {
                    //Logger.Debug("Party " + partyElement.user + " does exist locally, updating.");
                    // update the party
                    if (partyElement is UserElement)
                    {
                        (party as Person)?.InitPerson(partyElement as UserElement);
                    }
                    else
                    {
                        (party as Team)?.InitTeam(partyElement as TeamElement);
                    }
                }
            }
            return(party);
        }
コード例 #4
0
ファイル: Party.cs プロジェクト: marcelomelofreitas/Gwupe
 protected Party(PartyElement partyElement)
 {
     InitParty(partyElement);
 }
コード例 #5
0
 public void AddAdHocPerson(PartyElement partyElement, String shortCode)
 {
     AddAdHocPerson(GwupeClientAppContext.CurrentAppContext.PartyManager.AddUpdatePartyFromElement(partyElement), shortCode);
 }