private void UpdateUsers(IEnumerable <User> users) { var newUsers = new List <UserContainer>(); foreach (var user in users) { var container = _users.FromId(user.CustId); if (container == null) { container = new UserContainer(user); } else { container.User = user; } newUsers.Add(container); } _users.Clear(); if (this.Status == ConnectionStatus.Connected) { foreach (var user in newUsers) { _users.Add(user); } } else { _users.Add(new UserContainer(_offlineUser)); } this.OnUsersUpdated(); }
private SyncManager(Dispatcher dispatcher) { _dispatcher = dispatcher; _offlineUser = new User(); _offlineUser.IsRegistered = true; _offlineUser.CustId = 0; _offlineUser.Name = "Local"; _offlineUser.ShortName = "L"; _offlineUser.UserColor = UserColor.Offline; _offlineUser.IsHost = true; _status = ConnectionStatus.Disconnected; _state = new SyncState(0); _users = new UserContainerCollection(); _users.Add(new UserContainer(_offlineUser)); }
private SyncManager(Dispatcher dispatcher) { _dispatcher = dispatcher; _offlineUser = new User(); _offlineUser.IsRegistered = true; _offlineUser.CustId = 0; _offlineUser.Name = "Local"; _offlineUser.ShortName = "L"; _offlineUser.UserColor = UserColor.Offline; _offlineUser.IsHost = true; _status = ConnectionStatus.Disconnected; _state = new SyncState(0); _users = new UserContainerCollection(); _users.Add(new UserContainer(_offlineUser)); }