示例#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)
                {
                    StopControlPoint(controlPoint);
                }
                if (s == "+")
                {
                    StartControlPoint(controlPoint);
                }
                if (s == "s")
                {
                    // Simulate WeMo Switch
                    AddWeMoSwitch();
                }
            }
        }
示例#2
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;
                }
            }
        }
示例#3
0
 private static void StopControlPoint(UpnpSmartControlPoint controlPoint)
 {
     controlPoint.ShutDown();
     controlPoint.OnAddedDevice   -= controPoint_OnAddedDevice;
     controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice;
     controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired;
     controlPoint = null;
 }
示例#4
0
 private static void StartControlPoint(UpnpSmartControlPoint controlPoint)
 {
     StopControlPoint(controlPoint);
     controlPoint = new UpnpSmartControlPoint();
     controlPoint.OnAddedDevice   += controPoint_OnAddedDevice;
     controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice;
     controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired;
 }
示例#5
0
 private static void controPoint_OnRemovedDevice(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Removed " + device.FriendlyName);
 }
示例#6
0
 private static void controPoint_OnDeviceExpired(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Expired " + device.FriendlyName);
 }
示例#7
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;
                }

            }
        }
示例#8
0
 private static void controPoint_OnDeviceExpired(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Expired " + device.FriendlyName);
 }
示例#9
0
 private static void controPoint_OnRemovedDevice(UpnpSmartControlPoint sender, UPnPDevice device)
 {
     Console.WriteLine("Removed " + device.FriendlyName);
 }