Exemple #1
0
 public override void Deactivate()
 {
     if (!_isActivated)
     {
         return;
     }
     _isActivated = false;
     ReceiveManager.UnregisterStreamingQuery(_query);
 }
Exemple #2
0
 public override void Activate()
 {
     if (_isActivated)
     {
         return;
     }
     _isActivated = true;
     ReceiveManager.RegisterSearchQuery(_query, _acceptIds);
 }
Exemple #3
0
 public override void Activate()
 {
     if (_isActivated)
     {
         return;
     }
     _isActivated = true;
     ReceiveManager.RegisterStreamingQuery(_query);
 }
Exemple #4
0
 public override void Deactivate()
 {
     if (!_isActivated)
     {
         return;
     }
     _isActivated = false;
     ReceiveManager.UnregisterSearchQuery(_query, _acceptIds);
 }
Exemple #5
0
 public override void EndLifecycle()
 {
     if (!_isAlive)
     {
         return;
     }
     _isAlive = false;
     _watcher.Deactivate();
     ReceiveManager.UnregisterListMember(_listInfo);
 }
Exemple #6
0
 public override void BeginLifecycle()
 {
     if (_isAlive)
     {
         return;
     }
     _isAlive = true;
     _watcher.Activate();
     ReceiveManager.RegisterListMember(_listInfo);
 }
Exemple #7
0
 public override void Deactivate()
 {
     if (!_isActivated)
     {
         return;
     }
     _isActivated = false;
     _watcher.Deactivate();
     ReceiveManager.UnregisterList(_listInfo);
 }
Exemple #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));
            }
        }
Exemple #9
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        _receiveManager = new ReceiveManager(GetComponents <IReceivable>());
        SetupSocket();
    }
Exemple #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);
     }
 }
Exemple #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();
            }
        }
Exemple #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();
        }
Exemple #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();
        }
Exemple #14
0
 public void Reconnect()
 {
     ReceiveManager.ReconnectUserStreams(this.Account.Id);
 }
Exemple #15
0
 internal void UpdateConnectionState()
 {
     this.ConnectionState = ReceiveManager.GetConnectionState(this.Account.Id);
 }
Exemple #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();
            }
        }