ManualResetEvent m_deviceSelected; // Tells the app a device is selected

        public TestApplication()
        {
            m_threadLock = new object();
            m_inOperation = false;
            m_deviceSelected = new ManualResetEvent(false);

            ProtocolVersion version = new ProtocolVersion10();

            WS2007HttpBinding binding = new WS2007HttpBinding( new HttpTransportBindingConfig("urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b06", 15337));
            m_simpleServiceClient = new SimpleServiceClientProxy(binding, new ProtocolVersion10());

            binding = new WS2007HttpBinding(new HttpTransportBindingConfig("urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b07", 15338));
            m_eventingServiceClient = new EventingServiceClientProxy(binding, version, new EventingClientImplementation());

            binding = new WS2007HttpBinding(new HttpTransportBindingConfig("urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b08", 15339));
            m_attachmentServiceClient = new AttachmentServiceClientProxy(binding, version);

            // Turn listening to this IP on
            m_simpleServiceClient.IgnoreRequestFromThisIP = false;
            m_eventingServiceClient.IgnoreRequestFromThisIP = false;
            m_attachmentServiceClient.IgnoreRequestFromThisIP = false;

            m_discoClient = new DiscoClient(m_simpleServiceClient);

            m_random = new Random();
        }
Пример #2
0
 public static void Main()
 {
     using (SimpleServiceClientProxy client = new SimpleServiceClientProxy())
     {
         client.ServiceEndpoint = FindFirst(client.DiscoveryClient,
                                            c_serviceTypeName,
                                            c_namespaceUri);
         TwoWayRequest req = new TwoWayRequest();
         req.X = 3;
         req.Y = 4;
         TwoWayResponse resp = client.TwoWayRequest(req);
         Debug.Print("TwoWayRequest " + req.X + "+" + req.Y + "=" + resp.Sum);
     }
 }
        ManualResetEvent m_deviceSelected; // Tells the app a device is selected

        public TestApplication()
        {
            m_threadLock = new object();
            m_inOperation = false;
            m_deviceSelected = new ManualResetEvent(false);

            m_version = new ProtocolVersion11();
            // To enable WSDiscoveryApril2005 and Soap12WSAddressingAugust2004
            //m_version = new ProtocolVersion10();
            m_eventSubscriptionAddress = "";
            m_deviceEndpointAddress = "";

            m_simpleServiceClient = new SimpleServiceClientProxy(new WS2007HttpBinding(), m_version);

            // Event handling requires that we have a defined port (other than 8084)
            WS2007HttpBinding binding = new WS2007HttpBinding(new HttpTransportBindingConfig("urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b07", 15338, true));
            m_eventingServiceClient = new EventingServiceClientProxy(binding, m_version, new EventingClientImplementation());

            m_attachmentServiceClient = new AttachmentServiceClientProxy(new WS2007HttpBinding(), m_version);

            // Turn listening to this IP on
            m_simpleServiceClient.IgnoreRequestFromThisIP     = false;
            m_eventingServiceClient.IgnoreRequestFromThisIP   = false;
            m_attachmentServiceClient.IgnoreRequestFromThisIP = false;

            m_discoClient = new DiscoClient(m_simpleServiceClient);

            m_random = new Random();
        }
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // dispose managed resources
                if (m_simpleServiceClient != null)
                {
                    m_simpleServiceClient.Dispose();
                    m_simpleServiceClient = null;
                }

                if (m_eventingServiceClient != null)
                {
                    m_eventingServiceClient.Dispose();
                    m_eventingServiceClient = null;
                }

                if (m_attachmentServiceClient != null)
                {
                    m_attachmentServiceClient.Dispose();
                    m_attachmentServiceClient = null;
                }
            }
            // free native resources
        }