Exemple #1
0
        private bool BattlHasExperied(IViewBattl pBattl)
        {
            bool retorno = false;

            TimeSpan difference = (TimeSpan)(DateTime.Now - pBattl.StartTime);

            if (difference.Minutes > 10 && difference.Seconds > 0)
            {
                retorno = true;
            }

            return(retorno);
        }
Exemple #2
0
        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);
                }
            }
        }
Exemple #3
0
        private bool BattlHasExperied(IViewBattl pBattl)
        {
            bool retorno = false;

            TimeSpan difference = (TimeSpan)(DateTime.Now - pBattl.StartTime);

            if (difference.Minutes > 10 && difference.Seconds > 0)
             {
                retorno = true;
            }

            return retorno;
        }
Exemple #4
0
        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);
                }
            }
        }