当前位置: 首页>>代码示例>>C#>>正文


C# Message.AddField方法代码示例

本文整理汇总了C#中Message.AddField方法的典型用法代码示例。如果您正苦于以下问题:C# Message.AddField方法的具体用法?C# Message.AddField怎么用?C# Message.AddField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Message的用法示例。


在下文中一共展示了Message.AddField方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            var service = "7500";
            var network = ";239.255.0.1";
            var daemon = "tcp:7500";
            var subject = "TEST.Perf";
            var sendMessages = 0;

            TIBCO.Rendezvous.Environment.Open();
            var transport = new NetTransport(service, network, daemon);
            var watch = new Stopwatch();
            watch.Start();

            while (true)
            {
                var message = new Message { SendSubject = subject };
                message.AddField("body", messageBody);
                transport.Send(message);

                sendMessages += 1;
                if (watch.ElapsedMilliseconds > 1000)
                {
                    Console.WriteLine("{0} messages per second sent.", sendMessages);
                    watch.Restart();
                    sendMessages = 0;
                }
            }
        }
开发者ID:sam-io,项目名称:dotnet-playground,代码行数:28,代码来源:Program.cs

示例2: sendImageIndex

 private void sendImageIndex(int slValue, int x, int y)
 {
     // TODO MESSAGE
     Message msg = new Message("ChangeImg");
     msg.AddField("index", slValue);
     msg.AddField("x", x);
     msg.AddField("y", y);
     if (this._server != null)
         this._server.BroadcastMessage(msg);
     Console.WriteLine(msg.ToString() + ": " + msg.GetIntField("index"));
 }
开发者ID:ase-lab,项目名称:MRI_Viz2_Intel_Server,代码行数:11,代码来源:MainWindow.xaml.cs

示例3: UpdateGrid

        public unsafe void UpdateGrid(int x, int y, int z, short maxX, short discardedX, short screenMaxX, float xRatio)
        {
            //Grid.SetColumn(marker, (int)(960 / xy.X));
            //Grid.SetRow(marker, 11-(int)(720 / xy.Y*3));
            this.coordinates0.Content = ("Raw X is " + string.Format("{0:N}", x.ToString()));
            this.coordinates1.Content = ("Raw Y is " + string.Format("{0:N}", y.ToString()));
            this.coordinates2.Content = ("Raw Z is " + string.Format("{0:N}", z.ToString()));
            this.coordinates3.Content = ("Maximum X is " + string.Format("{0:N}", maxX.ToString()));
            this.coordinates4.Content = ("Discarded X is " + string.Format("{0:N}", discardedX.ToString()));
            // not really useful
            this.coordinates5.Content = ("Screen's Max X is " + string.Format("{0:N}", screenMaxX.ToString()));
            //
            this.coordinates6.Content = ("The X ratio is " + string.Format("{0:N}", xRatio.ToString()));

            //
            // create and send location to the clients
            //
            Message newMessage = new Message("getImage");
            int zIndexValue = z - DistanceFromScreenEdge;
            newMessage.AddField("z", zIndexValue);
            this._server.BroadcastMessage(newMessage);

            setImageImageOnDisplay(zIndexValue, 0, 0);
        }
开发者ID:ase-lab,项目名称:MRI_Viz2_Intel_Server,代码行数:24,代码来源:MainWindow.xaml.cs

示例4: sendMessage

 private void sendMessage(Point oldMousePoint, Point currentMousePoint)
 {
     Message msg = new Message("draw");
     msg.AddField("from", this.cID);
     msg.AddField("oldMousePointX", oldMousePoint.X);
     msg.AddField("oldMousePointY", oldMousePoint.Y);
     msg.AddField("currentMousePointX", currentMousePoint.X);
     msg.AddField("currentMousePointY", currentMousePoint.Y);
     if (this._connection != null)
         this._connection.SendMessage(msg);
     Console.WriteLine("SENDING MESSAGE: "+msg.ToString() + ": " + msg.GetDoubleField("oldMousePointX") + ": " + msg.GetDoubleField("currentMousePointX"));
 }
开发者ID:marinhomoreira,项目名称:WhiteBoard,代码行数:12,代码来源:MainWindow.xaml.cs

示例5: OnServerConnection

        // Handles the event that a connection is made
        private void OnServerConnection(object sender, ConnectionEventArgs e)
        {
            if (e.ConnectionEvent == ConnectionEvents.Connect)
            {
                // Lock the list so that only the networking thread affects it
                lock (this._clients)
                {
                    if (!(this._clients.Contains(e.Connection)))
                    {
                        // Add to list and create event listener
                        this._clients.Add(e.Connection);
                        e.Connection.MessageReceived += new ConnectionMessageEventHandler(OnConnectionMessage);
                        Message clientID = new Message("clientId");
                        clientID.AddField("id", this.clientIndex);
                        e.Connection.SendMessage(clientID);
                        this.clientIndex++;
                        // Using the GUI thread make changes
                        this.Dispatcher.Invoke(
                            new Action(
                                delegate()
                                {
                                    this._clientsList.Items.Add(e.Connection);
                                }
                        ));
                    }
                }
            }
            else if (e.ConnectionEvent == ConnectionEvents.Disconnect)
            {
                // Lock the list so that only the networking thread affects it
                lock (this._clients)
                {
                    if (this._clients.Contains(e.Connection))
                    {
                        // Clean up --  remove from list and remove event listener
                        this._clients.Remove(e.Connection);
                        e.Connection.MessageReceived -= new ConnectionMessageEventHandler(OnConnectionMessage);

                        // Using the GUI thread make changes
                        this.Dispatcher.Invoke(
                            new Action(
                                delegate()
                                {
                                    this._clientsList.Items.Remove(e.Connection);
                                }
                        ));
                    }
                }
            }
        }
开发者ID:marinhomoreira,项目名称:WhiteBoard,代码行数:51,代码来源:MainWindow.xaml.cs

示例6: InterfaceKit_SensorChange

        private void InterfaceKit_SensorChange(object sender, SensorChangeEventArgs e)
        {
            if (e.Index == KnobIndex)
            {
                Console.WriteLine("Knob change: " + e.Value);
                if (servoMotor != null)
                {
                    // normalize knob rotation
                    double normalRot = e.Value / 1000f;
                    servoMotor.Position = CosineInterpolate(servoMotor.PositionMin, servoMotor.PositionMax, normalRot);
                    Console.WriteLine("new servo position: " + servoMotor.Position);

                    // Create a message and populate it
                    Message message = new Message("SERVO_POSITION");
                    message.AddField<double>("position", servoMotor.Position);
                    message.AddField<double>("positionMin", servoMotor.PositionMin);
                    message.AddField<double>("positionMax", servoMotor.PositionMax);

                    // Send the message
                    client.SendMessage(message);
                }
            }
        }
开发者ID:tthmok,项目名称:ToolPath,代码行数:23,代码来源:MainWindow.xaml.cs

示例7: RfidReader_Tag

        private void RfidReader_Tag(object sender, TagEventArgs e)
        {
            rfidReader.LED = true;
            Console.WriteLine("The Tag: " + e.Tag + " was found");

            // Create a message and populate it
            Message message = new Message("RFID_TAG");
            message.AddField<string>("rfidTag", e.Tag);

            // Send the message
            client.SendMessage(message);
        }
开发者ID:tthmok,项目名称:ToolPath,代码行数:12,代码来源:MainWindow.xaml.cs


注:本文中的Message.AddField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。