Beispiel #1
0
 public UserDetail(string name, string id)
 {
     connectionId = id;
        userName = name;
        allObjects firstObject = new allObjects();
        MyObjects.Add(firstObject);
 }
Beispiel #2
0
        public void connect(string userName)
        {
            var id = Context.ConnectionId;

               if (ConnectedUsers.Count(x => x.userName == userName) == 0)
               {

               var user_character = new allObjects();
               var lista_objct  = new List<allObjects>();
               lista_objct.Add(user_character);

               ConnectedUsers.Add(new UserDetail { connectionId = id, userName = userName , objects = lista_objct });
               Clients.Others.onNewUserConnected(id, userName , user_character);
               Clients.Caller.onConnected(ConnectedUsers, CurrentMessages , user_character);

               }
               else {

                var user = ConnectedUsers.Find(x => x.userName == userName);
                ConnectedUsers.Remove(user);
                user.connectionId = id;
                ConnectedUsers.Add(user);
               }
        }