Exemplo n.º 1
0
        /// <summary>
        /// Report a status field to the RTD Support accross the channel
        /// </summary>
        /// <param name="myHeader"></param>
        /// <param name="myValue"></param>
        private void RTDStatusReport(string myHeader, string myValue)
        {
            try
            {
                System.Collections.Generic.List<Field> myList = new System.Collections.Generic.List<Field>();
                K2RHField myField = new K2RHField(myHeader, myValue);
                myList.Add(myField);
                //(m_RTDStatus as Subscriber).OnImage(this myList);
            }
            catch (Exception myE)
            {

            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// publish an array of int values
        /// </summary>
        /// <param name="subject">subject that you want to publish data against - e.g. IBM</param>
        /// <param name="values">array of int values</param>
        public void Publish(string subject, int[] values)
        {
            try
            {
                IPublisher myPub = K2RTDRequestHandler.PublisherMgr.Instance().GetPublisher("Publisher", subject, true);
                List<Field> fieldList = new List<Field>();
                int i = 0;
                foreach (int v in values)
                {
                    Field field = new K2RHField(i++.ToString(), v.ToString());
                    fieldList.Add(field);
                }

                if (myPub != null)
                {
                    myPub.OnUpdate(fieldList);

                }
            }
            catch (Exception myE)
            {
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Add a field into the image
 /// </summary>
 /// <param name="myID"></param>
 /// <param name="myValue"></param>
 protected void setImageField(string myID, string myValue)
 {
     try
     {
         Field myField;
         if (m_Fields.ContainsKey(myID))
         {
             myField = m_Fields[myID];
             myField.Value = myValue;
         }
         else
         {
             myField = new K2RHField(myID, myValue);
             m_Fields.Add(myID, myField);
         }
     }
     catch (Exception myE)
     {
         m_Log.Error("setImageField", myE);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Update a field, this adds/updates the feilds awaiting an update
        /// and updates the corresponding image field
        /// </summary>
        /// <param name="myID"></param>
        /// <param name="myValue"></param>
        protected virtual void updateField(string myID, string myValue)
        {
            try
            {
                // first set the field in the iamge
                setImageField(myID, myValue);

                // Now add/update the set of updated fields
                Field myField;
                if (m_UpdateFields.ContainsKey(myID))
                {
                    myField = m_UpdateFields[myID];
                    myField.Value = myValue;
                }
                else
                {
                    myField = new K2RHField(myID, myValue);
                    m_UpdateFields.Add(myID, myField);
                }
            }
            catch (Exception myE)
            {
                m_Log.Error("updateField", myE);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// send the updated fields to our client observers
        /// </summary>
        protected void doUpdate()
        {
            try
            {
                // if we have some observers
                if (m_Subscribers.Count > 0)
                {
                    // add the current time as the update time to the list
                    this.updateField("UPDTIME", System.Environment.TickCount.ToString());
                    K2RHField myUpdTimeField;
                    myUpdTimeField = new K2RHField("UPDTIME", System.Environment.TickCount.ToString());

                    // create a list of changed fields with their current values
                    System.Collections.Generic.List<Field> myFieldList;
                    this.getUpdateFields(out myFieldList);
                    // clear out our list of updates
                    m_UpdateFields.Clear();

                    // send the update to all our observers
                    foreach (ISubscriber mySubscriber in m_Subscribers)
                    {
                        try
                        {
                            mySubscriber.OnUpdate(this, myFieldList);
                        }
                        catch (Exception myE)
                        {
                            m_Log.Error("doUpdate - invoke", myE);
                        }
                    }
                }
            }
            catch (Exception myE)
            {
                m_Log.Error("doUpdate", myE);
            }
        }