コード例 #1
0
ファイル: BattlTimer.cs プロジェクト: iondrimba/musicbattl
        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);
                }
            }
        }
コード例 #2
0
ファイル: BattlTimer.cs プロジェクト: iondrimba/musicbattl
        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);
                }
            }
        }