Ejemplo n.º 1
0
 private void Initialize()
 {
     this.DataContext = companyImportVM;
     listenMessage    = new ListenMessage();
     BindingOperations.SetBinding(listenMessage, ListenMessage.MessageProperty, new Binding("Message")
     {
         Source = companyImportVM
     });
     listenMessage.MessageChangedEvent += ListenMessage_MessageChangedEvent;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 初始化构造函数重载共同部分
 /// </summary>
 private void Initialize()
 {
     InitializeSmart(BodyG);
     this.DataContext = contactEditVM;
     listenMessage    = new ListenMessage();
     BindingOperations.SetBinding(listenMessage, ListenMessage.MessageProperty, new Binding("Message")
     {
         Source = contactEditVM
     });
     listenMessage.MessageChangedEvent += ListenMessage_MessageChangedEvent;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void Initialize()
        {
            this.DataContext = expressPrintVM;
            listenMessage    = new ListenMessage();
            BindingOperations.SetBinding(listenMessage, ListenMessage.MessageProperty, new Binding("Message")
            {
                Source = expressPrintVM
            });
            listenMessage.MessageChangedEvent += ListenMessage_MessageChangedEvent;

            expressGrid = new ExpressGrid(expGrid, true);
        }
Ejemplo n.º 4
0
        private void Initialize()
        {
            this.DataContext = invoiceManageVM;
            listenMessage    = new ListenMessage();
            BindingOperations.SetBinding(listenMessage, ListenMessage.MessageProperty, new Binding("Message")
            {
                Source = invoiceManageVM
            });
            listenMessage.MessageChangedEvent += ListenMessage_MessageChangedEvent;

            公司名称Smart = Global.AllCompanies.Select(_func => new SmartInfo()
            {
                Text   = _func.称,
                Letter = _func.拼音
            }).ToList();
        }
Ejemplo n.º 5
0
        public void ToPropertyList_Works()
        {
            var message = new ListenMessage()
            {
                BundleID            = "com.apple.iTunes",
                ClientVersionString = "usbmuxd-374.70",
                ConnType            = 1,
                MessageType         = MuxerMessageType.Listen,
                ProgName            = "iTunes",
                kLibUSBMuxVersion   = 3,
            };

            var dict = message.ToPropertyList();
            var xml  = dict.ToXmlPropertyList();

            Assert.Equal(File.ReadAllText("Muxer/listen.xml"), xml, ignoreLineEndingDifferences: true);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// listen message
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public async Task HandleCall(ListenMessage message)
        {
            if (this._disposed)
            {
                return;
            }
            if (this._connection != null && this._connection.IsOpen)
            {
                return;
            }

            try { this._connection = this._factory.CreateConnection(); }
            catch (Exception ex)
            {
                this.ReListen();
                Trace.TraceError(ex.ToString());
                return;
            }

            try { base.Model = this._connection.CreateModel(); }
            catch (Exception ex)
            {
                try { this._connection.Close(); }
                catch (Exception ex2) { Trace.TraceError(ex2.ToString()); }
                this._connection = null;
                this.ReListen();
                Trace.TraceError(ex.ToString());
                return;
            }

            try
            {
                base.Model.QueueDeclare(this.QueueName, false, true, true, null);
                base.Model.QueueBind(this.QueueName, this.Exchange, this.QueueName);
                base.Model.BasicConsume(this.QueueName, true, this);
            }
            catch (Exception ex)
            {
                try { this._connection.Close(); }
                catch (Exception ex2) { Trace.TraceError(ex2.ToString()); }
                this._connection = null;
                this.ReListen();
                Trace.TraceError(ex.ToString());
                return;
            }
        }
Ejemplo n.º 7
0
        private async Task Connect()
        {
            readerTokenSource = new CancellationTokenSource();
            clientWebSocket   = new ClientWebSocket();

            await clientWebSocket.ConnectAsync(websocketServerURI, generalTokenSource.Token);

            if (clientWebSocket.State != WebSocketState.Open)
            {
                communication.SendErrorMessage("Unable to connect to PubSub. ABORTING.");
                throw new Exception($"Unable to connect to PubSub. ABORTING.");
            }

            ListenMessage listenMessage = new ListenMessage(
                topics: new[] { $"channel-points-channel-v1.{botConfig.BroadcasterId}" },
                authToken: botConfig.BroadcasterAccessToken);

            await SendMessage(listenMessage);

            reconnections.Signal();
        }