Exemplo n.º 1
0
        public void Stop()
        {
            try
            {
				if (_bStopped)
					return;
                _bStopped = true;
                _cSMSChat.IsChatTerminating = true;
				(new Logger()).WriteNotice("Stop: IsChatTerminating = true");
                DateTime dtNow = DateTime.Now.AddSeconds(15);
				while ((_cSMSChat.IsChatTerminating || _cSMSChat.IsInfoOnAir) && DateTime.Now < dtNow)
                    Thread.Sleep(50);

				while (!_bWorkerSMSEnd && !_bWorkerEnd)
					Thread.Sleep(50);

				_cSMSChat.Release();
				(new Logger()).WriteNotice("Stop: after _cSMSChat.Release();");
				_cSMSChat = null;
				_cPreferences = null;
			}
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
			}
			_eStatus = BTL.EffectStatus.Stopped;
			_dtStatusChanged = DateTime.Now;
			if (null != Stopped)
                Plugin.EventSend(Stopped, this);
		}
Exemplo n.º 2
0
        public void Prepare()
        {
            try
            {
                DisCom.Init();
                _bStopped = true;
                _aqSMSs = new Queue<SMS>();
                (_cSMSChat = new SMSChat(_cPreferences)).Init(); 
                _eStatus = BTL.EffectStatus.Preparing;
				_dtStatusChanged = DateTime.Now;
				if (null != Prepared)
                    Plugin.EventSend(Prepared, this);
				(new Logger()).WriteDebug3("ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }