Inheritance: Party
Esempio n. 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;
 }
Esempio n. 2
0
 internal AddPerson(GwupeClientAppContext appContext, Person person)
 {
     _appContext = appContext;
     _person = person;
 }
Esempio n. 3
0
 private void SubscribePersonResponseHandler(SubscribeRq request, SubscribeRs response, Exception e, Person person)
 {
     if (e == null)
     {
         person.SubscriptionStatus = "subscribe";
         Logger.Debug("Succeeded in sending subscribe request for " + person.Username);
     }
     else
     {
         Logger.Error("Failed to subscribe to " + person.Username + " : " + e.Message, e);
     }
 }
Esempio n. 4
0
 public void SubscribePerson(Person person)
 {
     // Lets add this person to the roster
     Logger.Debug("Attempting to add " + person + " to " + _appContext.CurrentUserManager.CurrentUser.Username + "'s Team");
     if (ServicePartyAttendanceLookup.ContainsKey(person.Username))
     {
         Logger.Error("Will not add " + person.Username + " to list, he/she already exists");
     }
     else
     {
         _appContext.ConnectionManager.Connection.RequestAsync<SubscribeRq, SubscribeRs>(new SubscribeRq() { username = person.Username, subscribe = true },
                                                               (request, response, ex) =>
                                                               SubscribePersonResponseHandler(request, response, ex, person));
     }
 }
Esempio n. 5
0
 public void Reset()
 {
     Logger.Debug("Resetting Current User Manager, clearing current user and presence");
     _currentUser = null;
     _currentUserPresence = null;
 }
Esempio n. 6
0
 internal void SetUser(UserElement userElement, String shortCode)
 {
     CurrentUser = new Person(userElement);
     ActiveShortCode = shortCode;
     if(CurrentUserPresence == null)
     {
         CurrentUserPresence = new Presence();
     }
     CurrentUserPresence.SetIdleState(_appContext.IdleState);
     UpdatePresence(true);
     OnCurrentUserChanged(EventArgs.Empty);
 }