Example #1
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;
 }
Example #2
0
 public void AddAdHocPerson(PartyElement partyElement, String shortCode)
 {
     AddAdHocPerson(GwupeClientAppContext.CurrentAppContext.PartyManager.AddUpdatePartyFromElement(partyElement), shortCode);
 }
Example #3
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);
 }
Example #4
0
File: Party.cs Project: gwupe/Gwupe
 protected Party(PartyElement partyElement)
 {
     InitParty(partyElement);
 }
Example #5
0
File: Party.cs Project: gwupe/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);
         }
     }
 }