Beispiel #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var controlPoint = new UpnpSmartControlPoint();

            controlPoint.OnAddedDevice   += controPoint_OnAddedDevice;
            controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
            controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;

            while (true)
            {
                //Thread.Sleep(1000);
                //Console.WriteLine(".");
                var s = Console.ReadLine();
                if (s == "-" && controlPoint != null)
                {
                    controlPoint.ShutDown();
                    controlPoint.OnAddedDevice   -= controPoint_OnAddedDevice;
                    controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice;
                    controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired;
                    controlPoint = null;
                }
                if (s == "+")
                {
                    controlPoint = new UpnpSmartControlPoint();
                    controlPoint.OnAddedDevice   += controPoint_OnAddedDevice;
                    controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
                    controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;
                }
            }
        }
Beispiel #2
0
 private static void StopControlPoint(UpnpSmartControlPoint controlPoint)
 {
     controlPoint.ShutDown();
     controlPoint.OnAddedDevice   -= controPoint_OnAddedDevice;
     controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice;
     controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired;
     controlPoint = null;
 }
Beispiel #3
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var controlPoint = new UpnpSmartControlPoint();
            controlPoint.OnAddedDevice += controPoint_OnAddedDevice;
            controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
            controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;

            while (true)
            {
                //Thread.Sleep(1000);
                //Console.WriteLine(".");
                var s = Console.ReadLine();
                if (s == "-" && controlPoint != null)
                {
                    controlPoint.ShutDown();
                    controlPoint.OnAddedDevice -= controPoint_OnAddedDevice;
                    controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice;
                    controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired;
                    controlPoint = null;
                }
                if (s == "+")
                {
                    controlPoint = new UpnpSmartControlPoint();
                    controlPoint.OnAddedDevice += controPoint_OnAddedDevice;
                    controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
                    controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;
                }

            }
        }