public void AddUpdateRelationship(String username, Relationship relationship) { lock (_relationshipLock) { if (_userRelationshipLookup.ContainsKey(username)) { Relationships.Remove(_userRelationshipLookup[username]); _userRelationshipLookup[username] = relationship; Relationships.Add(relationship); } else { _userRelationshipLookup.Add(username,relationship); Relationships.Add(relationship); } } }
internal void UpdateRelationship(String contactUsername, Relationship relationship, String tokenId, String securityKey) { var response = GwupeClientAppContext.CurrentAppContext.ConnectionManager.Connection .Request<UpdateRelationshipRq, UpdateRelationshipRs>( new UpdateRelationshipRq() { relationshipElement = new RelationshipElement() { theyHaveUnattendedAccess = relationship.TheyHaveUnattendedAccess, ihaveUnattendedAccess = relationship.IHaveUnattendedAccess }, contactUsername = contactUsername, tokenId = tokenId, securityKey = securityKey }); AddUpdateRelationship(contactUsername,new Relationship(response.relationshipElement)); }
private void UpdateRelationship(ElevateToken token) { try { var relationship = new Relationship { IHaveUnattendedAccess = GwupeClientAppContext.CurrentAppContext.RelationshipManager.GetRelationship(_dataContext.Engagement.SecondParty.Party.Username).IHaveUnattendedAccess }; Dispatcher.Invoke(new Action(() => { relationship.TheyHaveUnattendedAccess = (UnattendedAccessCheckbox.IsChecked == true); })); GwupeClientAppContext.CurrentAppContext.RelationshipManager.UpdateRelationship( _dataContext.Engagement.SecondParty.Party.Username, relationship, token.TokenId, token.SecurityKey); _updatedRelationship = true; } catch (Exception ex) { Logger.Error("Failed to update the relationship to " + _dataContext.Engagement.SecondParty.Party.Username + " : " + ex.Message, ex); UiHelper.Validator.SetError("Failed to save changes to server"); } }