public Client(IFactory factory) { if (factory == null) throw new ArgumentNullException("factory"); _factory = factory; _actionQueue = factory.CreateActionQueue(); _clients = new List<ClientData>(); _gameClients = new List<ClientData>(); _games = new List<GameData>(); _pieceBag = factory.CreatePieceBag(32); _inventory = factory.CreateInventory(10); Assembly entryAssembly = Assembly.GetEntryAssembly(); if (entryAssembly != null) { Version version = entryAssembly.GetName().Version; Version = new Versioning { Major = version.Major, Minor = version.Minor, }; }// else, we suppose SetVersion will be called later, before connecting _state = States.Created; _clientId = Guid.Empty; _lastActionFromServer = DateTime.Now; _timeoutCount = 0; _pieceIndex = 0; _gameTimer = new System.Timers.Timer { Interval = GameTimerIntervalStartValue }; _gameTimer.Elapsed += GameTimerOnElapsed; _cancellationTokenSource = new CancellationTokenSource(); _timeoutTask = Task.Factory.StartNew(TimeoutTask, _cancellationTokenSource.Token); _actionQueue.Start(_cancellationTokenSource); }