Ejemplo n.º 1
0
    private void FightTimerCallBack(System.Object parameter)
    {
        float elapseTime = (float)((TimeHelper.GetCurrentRealTimestamp() - _fightStartTimestamp) / 1000.0f);

        if (elapseTime >= BATTLE_ROUND_TIME)
        {
            _fightTimer.Stop();
        }

        UpdateFightTime(Mathf.FloorToInt(elapseTime));
    }
Ejemplo n.º 2
0
 public void StopTimer()
 {
     if (productionTimer != null)
     {
         productionTimer.Stop();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="stack">Owner SIP stack.</param>
        /// <param name="server">Registrar server URI. For example: sip:domain.com.</param>
        /// <param name="aor">Address of record. For example: [email protected].</param>
        /// <param name="contact">Contact URI.</param>
        /// <param name="expires">Gets after how many seconds reigisration expires.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>ua</b>,<b>server</b>,<b>transport</b>,<b>aor</b> or <b>contact</b> is null reference.</exception>
        /// <exception cref="ArgumentException">Is raised when any of the arguments contains invalid value.</exception>
        internal SIP_UA_Registration(SIP_Stack stack, SIP_Uri server, string aor, AbsoluteUri contact, int expires)
        {
            if (stack == null)
            {
                throw new ArgumentNullException("stack");
            }
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }
            if (aor == null)
            {
                throw new ArgumentNullException("aor");
            }
            if (aor == string.Empty)
            {
                throw new ArgumentException("Argument 'aor' value must be specified.");
            }
            if (contact == null)
            {
                throw new ArgumentNullException("contact");
            }

            m_pStack          = stack;
            m_pServer         = server;
            m_AOR             = aor;
            m_pContact        = contact;
            m_RefreshInterval = expires;

            m_pContacts = new List <AbsoluteUri>();

            m_pTimer = new TimerEx(m_pTimer_Elapsed, (m_RefreshInterval - 15) * 1000, false);
            m_pTimer.Stop();
        }
Ejemplo n.º 4
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            #region タイマーの停止

            _baseTimer.Stop();
            _photoTimer.Stop();

            #endregion
        }
Ejemplo n.º 5
0
        public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            IsDisposed = true;

            ClearTimer.Stop();
            ClearTimer = null;

            ItemsByKey.Clear();
            ItemsByKey = null;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Starts unregistering.
        /// </summary>
        /// <param name="dispose">If true, registration will be disposed after unregister.</param>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and and this method is accessed.</exception>
        public void BeginUnregister(bool dispose)
        {
            if (m_IsDisposed)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }

            m_AutoDispose = dispose;

            // Stop register timer, otherwise we may get register and unregister race condition.
            m_pTimer.Stop();

            if (m_State == SIP_UA_RegistrationState.Registered)
            {
                /* RFC 3261 10.1 Constructing the REGISTER Request.
                 *  Request-URI: The Request-URI names the domain of the location service for which the registration is meant (for example,
                 *               "sip:chicago.com").  The "userinfo" and "@" components of the SIP URI MUST NOT be present.
                 */

                SIP_Request unregister = m_pStack.CreateRequest(SIP_Methods.REGISTER, new SIP_t_NameAddress(m_pServer.Scheme + ":" + m_AOR), new SIP_t_NameAddress(m_pServer.Scheme + ":" + m_AOR));
                unregister.RequestLine.Uri = SIP_Uri.Parse(m_pServer.Scheme + ":" + m_AOR.Substring(m_AOR.IndexOf('@') + 1));
                unregister.Route.Add(m_pServer.ToString());
                unregister.Contact.Add("<" + this.Contact + ">;expires=0");

                m_pUnregisterSender = m_pStack.CreateRequestSender(unregister, m_pFlow);
                m_pUnregisterSender.ResponseReceived += new EventHandler <SIP_ResponseReceivedEventArgs>(m_pUnregisterSender_ResponseReceived);
                m_pUnregisterSender.Start();
            }
            else
            {
                SetState(SIP_UA_RegistrationState.Unregistered);
                OnUnregistered();

                if (m_AutoDispose)
                {
                    Dispose();
                }

                m_pUnregisterSender = null;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Stops this server, all active connections will be terminated.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and this property is accessed.</exception>
        public void Stop()
        {
            ThrowIfObjectDisposed();

            if (!m_IsRunning)
            {
                return;
            }

            m_IsRunning = false;

            // Dispose all old TCP acceptors.
            foreach (var acceptor in m_pConnectionAcceptors.ToArray())
            {
                try
                { acceptor.Dispose(); }
                catch (Exception ex)
                { OnError(ex); }
            }
            m_pConnectionAcceptors.Clear();


            // Dispose all old binds.
            foreach (var listeningPoint in m_pListeningPoints.ToArray())
            {
                try
                { listeningPoint.Socket.Dispose(); }
                catch (Exception ex)
                { OnError(ex); }
            }
            m_pListeningPoints.Clear();


            m_pTimer_IdleTimeout.Stop();
            m_pTimer_IdleTimeout.Dispose();
            m_pTimer_IdleTimeout = null;

            OnStopped();
        }
Ejemplo n.º 8
0
 public void Stop()
 {
     _timer.Stop();
 }