Exemplo n.º 1
0
 public override void Deactivate()
 {
     if (!_isActivated)
     {
         return;
     }
     _isActivated = false;
     ReceiveManager.UnregisterStreamingQuery(_query);
 }
Exemplo n.º 2
0
 public override void Activate()
 {
     if (_isActivated)
     {
         return;
     }
     _isActivated = true;
     ReceiveManager.RegisterSearchQuery(_query, _acceptIds);
 }
Exemplo n.º 3
0
 public override void Activate()
 {
     if (_isActivated)
     {
         return;
     }
     _isActivated = true;
     ReceiveManager.RegisterStreamingQuery(_query);
 }
Exemplo n.º 4
0
 public override void Deactivate()
 {
     if (!_isActivated)
     {
         return;
     }
     _isActivated = false;
     ReceiveManager.UnregisterSearchQuery(_query, _acceptIds);
 }
Exemplo n.º 5
0
 public override void EndLifecycle()
 {
     if (!_isAlive)
     {
         return;
     }
     _isAlive = false;
     _watcher.Deactivate();
     ReceiveManager.UnregisterListMember(_listInfo);
 }
Exemplo n.º 6
0
 public override void BeginLifecycle()
 {
     if (_isAlive)
     {
         return;
     }
     _isAlive = true;
     _watcher.Activate();
     ReceiveManager.RegisterListMember(_listInfo);
 }
Exemplo n.º 7
0
 public override void Deactivate()
 {
     if (!_isActivated)
     {
         return;
     }
     _isActivated = false;
     _watcher.Deactivate();
     ReceiveManager.UnregisterList(_listInfo);
 }
Exemplo n.º 8
0
        public void CommitChanges()
        {
            var flag = this._isConnectionPropertyHasChanged;

            // down flags
            this._isConnectionPropertyHasChanged = false;

            // if property has changed, reconnect streams
            if (flag)
            {
                Task.Run(() => ReceiveManager.ReconnectUserStreams(_account.Id));
            }
        }
Exemplo n.º 9
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        _receiveManager = new ReceiveManager(GetComponents <IReceivable>());
        SetupSocket();
    }
Exemplo n.º 10
0
 public override void Activate()
 {
     if (_isActivated)
     {
         return;
     }
     _isActivated = true;
     _watcher.Activate();
     if (!String.IsNullOrEmpty(_receiverScreenName))
     {
         ReceiveManager.RegisterList(_receiverScreenName, _listInfo);
     }
     else
     {
         ReceiveManager.RegisterList(_listInfo);
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// //接收短信的方法,供串口sp的SerialDataReceivedEventHandler事件调用
        /// 参数:object sender,SerialDataReceivedEventArgs e:是SerialDataReceivedEventHandler事件调用的委托方法所要求的参数类型
        ///
        /// 注意:这个函数由串口(收到数据后)引发的SerialDataReceivedEventHandler事件自动调用(用户不必调用),所以属性为private
        ///       由于SerialDataReceivedEventHandler事件是由串口(收到数据后)引发的,所以,短信接收是自动执行的的
        /// </summary>

        private void ReceiveMessage(object sender, SerialDataReceivedEventArgs e)
        {
            ReceiveManager receiveManager = new ReceiveManager(this.SMSDBHelper);
            ReceiveEntity  re             = new ReceiveEntity();

            string ReceiveValue = string.Empty;

            try
            {
                SMSDBHelper.Open();
                Thread.Sleep(1000);
                string str = sp.ReadCom();   // 先从串口缓存中读出字节内容并转化为string类型
                Thread.Sleep(2000);
                str = str.Replace("\r\n", "").Replace(" ", "");
                if (str.Length > 6)                       // 只有当string长度大于6时,才认为可能是收到了用户短信??
                {
                    if (str.Substring(0, 5) == "+CMTI")
                    {
                        //MessageBox.Show("收到一条短信!");
                        int    index    = str.IndexOf(",");
                        string location = str.Substring(index + 1);
                        ReceiveValue = sp.ReadMsg(location);                   // 用ReadMsg解析出具体的短信内容
                        //MessageBox.Show(value, "有新短信", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        re.Phone       = ReceiveValue.Split(',')[0];
                        re.ReceiveTime = DateTime.Parse(ReceiveValue.Split(',')[1]);
                        re.Txt         = ReceiveValue.Split(',')[2];
                        receiveManager.Add(re);
                        //读完删除
                        DelMSG(location);
                    }
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
            finally
            {
                SMSDBHelper.Close();
            }
        }
Exemplo n.º 12
0
        public static void PostInitialize()
        {
            // initialize subsystems
            StatisticsService.Initialize();
            PostLimitPredictionService.Initialize();
            MuteBlockManager.Initialize();
            StatusBroadcaster.Initialize();
            StatusInbox.Initialize();
            AutoUpdateService.StartSchedule();
            NotificationService.Initialize();
            UINotificationProxy.Initialize();

            // activate plugins
            PluginManager.LoadedPlugins.ForEach(p => p.Initialize());

            // activate scripts
            ScriptingManagerImpl.Initialize();

            // other core systems initialize
            ReceiveManager.Initialize();
            TwitterConfigurationService.Initialize();
            BackstageModel.Initialize();
        }
Exemplo n.º 13
0
        public void Arrange()
        {
            _publisherRepositoryMock = new Mock <IPublisherRepository>();
            _publisherRepositoryMock.Setup(r => r.GetPublisherAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new Publisher
            {
                Events = new[]
                {
                    new PublisherEvent
                    {
                        Name   = DefaultEventType,
                        Schema = DefaultSchema,
                    },
                },
            });

            _eventRepositoryMock = new Mock <IEventRepository>();

            _subscriptionRepositoryMock = new Mock <ISubscriptionRepository>();

            _distributionRepositoryMock = new Mock <IDistributionRepository>();

            _distributionQueueMock = new Mock <IDistributionQueue>();

            _loggerMock = new Mock <ILoggerWrapper>();

            _manager = new ReceiveManager(
                _publisherRepositoryMock.Object,
                _eventRepositoryMock.Object,
                _subscriptionRepositoryMock.Object,
                _distributionRepositoryMock.Object,
                _distributionQueueMock.Object,
                _loggerMock.Object);

            _cancellationToken = new CancellationToken();
        }
Exemplo n.º 14
0
 public void Reconnect()
 {
     ReceiveManager.ReconnectUserStreams(this.Account.Id);
 }
Exemplo n.º 15
0
 internal void UpdateConnectionState()
 {
     this.ConnectionState = ReceiveManager.GetConnectionState(this.Account.Id);
 }
Exemplo n.º 16
0
        /// <summary>
        /// //接收短信的方法,供串口sp的SerialDataReceivedEventHandler事件调用
        /// 参数:object sender,SerialDataReceivedEventArgs e:是SerialDataReceivedEventHandler事件调用的委托方法所要求的参数类型
        /// 
        /// 注意:这个函数由串口(收到数据后)引发的SerialDataReceivedEventHandler事件自动调用(用户不必调用),所以属性为private
        ///       由于SerialDataReceivedEventHandler事件是由串口(收到数据后)引发的,所以,短信接收是自动执行的的
        /// </summary>
        private void ReceiveMessage(object sender, SerialDataReceivedEventArgs e)
        {
            ReceiveManager receiveManager = new ReceiveManager(this.SMSDBHelper);
            ReceiveEntity re = new ReceiveEntity();

            string ReceiveValue = string.Empty;
            try
            {
                SMSDBHelper.Open();
                Thread.Sleep(1000);
                string str = sp.ReadCom();   // 先从串口缓存中读出字节内容并转化为string类型
                Thread.Sleep(2000);
                str = str.Replace("\r\n", "").Replace(" ", "");
                if (str.Length > 6)                       // 只有当string长度大于6时,才认为可能是收到了用户短信??
                {
                    if (str.Substring(0, 5) == "+CMTI")
                    {
                        //MessageBox.Show("收到一条短信!");
                        int index = str.IndexOf(",");
                        string location = str.Substring(index + 1);
                        ReceiveValue = sp.ReadMsg(location);                   // 用ReadMsg解析出具体的短信内容
                        //MessageBox.Show(value, "有新短信", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        re.Phone = ReceiveValue.Split(',')[0];
                        re.ReceiveTime = DateTime.Parse(ReceiveValue.Split(',')[1]);
                        re.Txt = ReceiveValue.Split(',')[2];
                        receiveManager.Add(re);
                        //读完删除
                        DelMSG(location);
                    }
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
            finally
            {
                SMSDBHelper.Close();
            }
        }