Ejemplo n.º 1
0
        // This method is called by the timer delegate.
        public void SendEvent(Object stateInfo)
        {
            if (rentryFlag == true)
            {
                return;
            }
            rentryFlag = true;

            // Fire SimpleEvent
            try
            {
                SimpleEventRequest req = new SimpleEventRequest();
                req.Param = s_val;

                ((EventingService)m_hostedService).SimpleEvent(req);
                System.Ext.Console.Write("");
                System.Ext.Console.Write("FireEvent called SimpleEvent!");
                System.Ext.Console.Write("");
            }
            catch (Exception e)
            {
                System.Ext.Console.Write("");
                System.Ext.Console.Write("SimpleEvent FireEvent failed: " + e.Message);
                System.Ext.Console.Write("");
                rentryFlag = false;
            }

            // Fire IntegerEvent
            try
            {
                IntegerEventRequest eventReq = new IntegerEventRequest();
                eventReq.Param = s_cnt++;
                ((EventingService)m_hostedService).IntegerEvent(eventReq);
                System.Ext.Console.Write("");
                System.Ext.Console.Write("FireEvent called IntegerEvent!!! " + eventReq.Param.ToString());
                System.Ext.Console.Write("");
            }
            catch (Exception e)
            {
                System.Ext.Console.Write("");
                System.Ext.Console.Write("IntegerEvent FireEvent failed: " + e.Message);
                System.Ext.Console.Write("");
                rentryFlag = false;
            }

            rentryFlag = false;
        }
Ejemplo n.º 2
0
        public override void WriteObject(XmlWriter writer, object graph)
        {
            IntegerEventRequest IntegerEventRequestField = ((IntegerEventRequest)(graph));

            if (WriteParentElement(writer, true, true, graph))
            {
                WriteAnyAttribute(writer, IntegerEventRequestField.AnyAttr);
                if (WriteChildElement(writer, "Param", true, true, IntegerEventRequestField.Param))
                {
                    writer.WriteString(XmlConvert.ToString(IntegerEventRequestField.Param));
                    writer.WriteEndElement();
                }
                WriteAnyElement(writer, IntegerEventRequestField.Any, false);
                writer.WriteEndElement();
            }
            return;
        }
        public virtual void IntegerEvent(IntegerEventRequest eventReq)
        {

            // Create temp event source object, set the event action and create the event header
            DpwsWseEventSource eventSource;
            eventSource = EventSources["IntegerEvent"];
            String action;
            action = "http://schemas.example.org/EventingService/IntegerEvent";
            WsWsaHeader header;
            header = new WsWsaHeader(action, null, null, null, null, null);
            WsMessage msg = new WsMessage(header, eventReq, WsPrefix.Wse);

            // Create event serializer and write the event object
            IntegerEventRequestDataContractSerializer eventDcs;
            eventDcs = new IntegerEventRequestDataContractSerializer("IntegerEventRequest", "http://schemas.example.org/EventingService");
            msg.Serializer = eventDcs;

            // Fire event
            Dpws.Device.Device.SubscriptionManager.FireEvent(this, eventSource, msg);
        }
Ejemplo n.º 4
0
        public override object ReadObject(XmlReader reader)
        {
            IntegerEventRequest IntegerEventRequestField = null;

            if (IsParentStartElement(reader, false, true))
            {
                IntegerEventRequestField         = new IntegerEventRequest();
                IntegerEventRequestField.AnyAttr = ReadAnyAttribute(reader);
                reader.Read();
                if (IsChildStartElement(reader, "Param", true, true))
                {
                    reader.Read();
                    IntegerEventRequestField.Param = XmlConvert.ToInt32(reader.ReadString());
                    reader.ReadEndElement();
                }
                IntegerEventRequestField.Any = ReadAnyElement(reader, false);
                reader.ReadEndElement();
            }
            return(IntegerEventRequestField);
        }
        public virtual void IntegerEvent(IntegerEventRequest eventReq)
        {
            // Create temp event source object, set the event action and create the event header
            DpwsWseEventSource eventSource;

            eventSource = EventSources["IntegerEvent"];
            String action;

            action = "http://schemas.example.org/EventingService/IntegerEvent";
            WsWsaHeader header;

            header = new WsWsaHeader(action, null, null, null, null, null);
            WsMessage msg = new WsMessage(header, eventReq, WsPrefix.Wse);

            // Create event serializer and write the event object
            IntegerEventRequestDataContractSerializer eventDcs;

            eventDcs       = new IntegerEventRequestDataContractSerializer("IntegerEventRequest", "http://schemas.example.org/EventingService");
            msg.Serializer = eventDcs;

            // Fire event
            Dpws.Device.Device.SubscriptionManager.FireEvent(this, eventSource, msg);
        }
Ejemplo n.º 6
0
 public override object ReadObject(XmlReader reader)
 {
     IntegerEventRequest IntegerEventRequestField = null;
     if (IsParentStartElement(reader, false, true))
     {
         IntegerEventRequestField = new IntegerEventRequest();
         IntegerEventRequestField.AnyAttr = ReadAnyAttribute(reader);
         reader.Read();
         if (IsChildStartElement(reader, "Param", true, true))
         {
             reader.Read();
             IntegerEventRequestField.Param = XmlConvert.ToInt32(reader.ReadString());
             reader.ReadEndElement();
         }
         IntegerEventRequestField.Any = ReadAnyElement(reader, false);
         reader.ReadEndElement();
     }
     return IntegerEventRequestField;
 }
Ejemplo n.º 7
0
        // This method is called by the timer delegate.
        public void SendEvent(Object stateInfo)
        {
            if (rentryFlag == true)
                return;
            rentryFlag = true;

            // Fire SimpleEvent
            try
            {
                SimpleEventRequest req = new SimpleEventRequest();
                req.Param = s_val;

                ((EventingService)m_hostedService).SimpleEvent(req);
                System.Ext.Console.Write("");
                System.Ext.Console.Write("FireEvent called SimpleEvent!");
                System.Ext.Console.Write("");
            }
            catch (Exception e)
            {
                System.Ext.Console.Write("");
                System.Ext.Console.Write("SimpleEvent FireEvent failed: " + e.Message);
                System.Ext.Console.Write("");
                rentryFlag = false;
            }

            // Fire IntegerEvent
            try
            {
                IntegerEventRequest eventReq = new IntegerEventRequest();
                eventReq.Param = s_cnt++;
                ((EventingService)m_hostedService).IntegerEvent(eventReq);
                System.Ext.Console.Write("");
                System.Ext.Console.Write("FireEvent called IntegerEvent!!! " + eventReq.Param.ToString());
                System.Ext.Console.Write("");
            }
            catch (Exception e)
            {
                System.Ext.Console.Write("");
                System.Ext.Console.Write("IntegerEvent FireEvent failed: " + e.Message);
                System.Ext.Console.Write("");
                rentryFlag = false;
            }

            rentryFlag = false;
        }
 public void IntegerEvent(IntegerEventRequest req)
 {
     System.Ext.Console.Write("");
     System.Ext.Console.Write("!!IntegerEvent received. Value = " + req.Param.ToString());
 }