Inheritance: IMessage
 public static SBMessage FromBrokeredMessage(BrokeredMessage message)
 {
     SBMessage ret = new SBMessage(message.GetBody());
     foreach (var key in message.Properties.Keys)
         ret.Headers.Add(key, message.Properties[key]);
     return ret;
 }
        public static SBMessage FromBrokeredMessage(BrokeredMessage message)
        {
            SBMessage ret = new SBMessage(message.GetBody());

            foreach (var key in message.Properties.Keys)
            {
                ret.Headers.Add(key, message.Properties[key]);
            }
            return(ret);
        }
        private static List<SBMessage> generateTasks(int taskNumber)
        {
            List<SBMessage> tasks = new List<SBMessage>();

            for (int i = 1; i <= taskNumber; i++)
            {
                SBMessage msg = new SBMessage("Test task " + i);
                msg.Headers.Add(HeaderName.PressureValue, rand.Next(1000, 10000) / 1000.0);
                msg.Headers.Add("ProductType", rand.Next(0, 2) == 0 ? "Cars" : "Trucks");
                tasks.Add(msg);
            }

            return tasks;
        }
 public void Open()
 {
     myRunningState = true;
     ThreadPool.QueueUserWorkItem((obj) =>
     {
         while (myRunningState)
         {
             try
             {
                 var message = myClient.Receive(new TimeSpan(0, 0, 1));
                 if (message != null)
                 {
                     RaiseMessageReceivedEvent(this, new Infrastructure.ChannelMessageEventArgs(this, SBMessage.FromBrokeredMessage(message)));
                     message.Complete();
                 }
             }
             catch (Exception exp)
             {
                 Trace.TraceError(exp.ToString());
             }
         }
         myClient.Close();
     });
 }