示例#1
0
        private void lv_Devices_Tapped(object sender, TappedRoutedEventArgs e)
        {
            SelectedDevice = (Core.Classes.Device)lv_Devices.SelectedItem;

            if (SelectedDevice.Status == Core.Classes.Device.StatusEnum.Off)
            {
                Task.Factory.StartNew(() =>
                {
                    SelectedDevice.TurnOn();
                }).Wait(1000);
                SelectedDevice.Status = Core.Classes.Device.StatusEnum.On;
            }
            else
            {
                Task.Factory.StartNew(() =>
                {
                    SelectedDevice.TurnOff();
                }).Wait(1000);
                SelectedDevice.Status = Core.Classes.Device.StatusEnum.Off;
            }
        }