public override Task OnOpened() { if (this.HasParameterKey("ctx")) { this.Context = Guid.Parse(this.GetParameter("ctx")); } else { this.Context = Guid.NewGuid(); } // If there is no FakePeer, create a new one... if (this.Peer == null) { this.Peer = new FakePeerModel(); this.Peer.Id = Guid.NewGuid(); this.Peer.UserName = "******"; this.Peer.Context = this.Context; this.Peer.GroupName = "Global"; _persistenceModel.AddPeerModel(Peer); } this.Invoke(new { Id = this.Id, Context = this.Context, UserName = this.UserName, GroupName = this.GroupName }, "onContext"); return(base.OnOpened()); }
public void UpdatePeerModel(FakePeerModel peermodel) { FakePeerModel result = this.PeerModels.Find(item => item.Id == peermodel.Id); if (result != null) { result.UserName = peermodel.UserName; result.GroupName = peermodel.GroupName; } }
// use fake peer model as the user model...... public async Task SetUserNameAndGroupName(FakePeerModel peermodel) { this.Peer.UserName = peermodel.UserName; this.Peer.GroupName = peermodel.GroupName; if (peermodel.Id != Guid.Empty) { this.Peer.Id = peermodel.Id; } _persistenceModel.UpdatePeerModel(this.Peer); await this.Invoke(this.Peer, "usernamegroupnameChange"); }
public void AddPeerModel(FakePeerModel peermodel) { //UserModel result = this.PeerModels.Find(item => item.Id == usermodel.Id); //if (result != null) //{ // result.UserName = usermodel.UserName; // result.GroupName = usermodel.GroupName; // // if (usermodel.VideoId != Guid.Empty) // { // result.VideoId = usermodel.VideoId; // } //} else //{ this.PeerModels.Add(peermodel); //} }