public void BattlEnd() { lock ( _updateBattlLock ) { if (BattlState == BattlState.Open) { if (_timer != null) { _timer.Dispose(); totalTime = 0; } if (_timerReset != null) { _timerReset.Dispose(); totalTimeReset = 0; } Database db = Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(); IRepository <IBattl> dalBattl = new BattlRepository(db); IRepositoryBLL <IBattl> battlRepoBll = new BattlRepositoryBLL(dalBattl); IRepository <IViewBattl> viewdalBattl = new ViewBattlRepository(db); IRepositoryBLL <IViewBattl> iViewbattlRepoBll = new ViewBattlRepositoryBLL(viewdalBattl); IBattlBLL battlBLL = new BattlBLL(battlRepoBll, iViewbattlRepoBll); battlBLL.EndActiveBattl(); _battl = battlBLL.CreateBattl(); BattlState = BattlState.Closed; BroadcastStateChange(BattlState.Closed); } } }
public void BattlEnd() { lock( _updateBattlLock ) { if( BattlState == BattlState.Open ) { if( _timer != null ) { _timer.Dispose(); totalTime = 0; } if( _timerReset != null ) { _timerReset.Dispose(); totalTimeReset = 0; } Database db = Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(); IRepository<IBattl> dalBattl = new BattlRepository(db); IRepositoryBLL<IBattl> battlRepoBll = new BattlRepositoryBLL(dalBattl); IRepository<IViewBattl> viewdalBattl = new ViewBattlRepository(db); IRepositoryBLL<IViewBattl> iViewbattlRepoBll = new ViewBattlRepositoryBLL(viewdalBattl); IBattlBLL battlBLL = new BattlBLL(battlRepoBll , iViewbattlRepoBll); battlBLL.EndActiveBattl(); _battl = battlBLL.CreateBattl(); BattlState = BattlState.Closed; BroadcastStateChange(BattlState.Closed); } } }