コード例 #1
0
 public static void StorePanController(LifxPanController newPanController)
 {
     if (!panControllers.ContainsKey(newPanController.MACAddress))
     {
         panControllers.Add(newPanController.MACAddress, newPanController);
         SaveToStorage();
     }
 }
コード例 #2
0
        async void Instance_PanControllerFound(object sender, LifxPanController e)
        {
            StorageHelper.StorePanController(e);

            foreach (LifxBulb bulb in e.Bulbs)
            {
                LifxLightStatusMessage lightstatusmessage = await StorageHelper.GetBulb(bulb.UID).GetLightStatusCommand();

                if (lightstatusmessage != null)
                {
                    StorageHelper.GetBulb(lightstatusmessage.ReceivedData.TargetMac).Label  = lightstatusmessage.Label;
                    StorageHelper.GetBulb(lightstatusmessage.ReceivedData.TargetMac).Tags   = lightstatusmessage.Tags;
                    StorageHelper.GetBulb(lightstatusmessage.ReceivedData.TargetMac).IsOn   = lightstatusmessage.PowerState;
                    StorageHelper.GetBulb(lightstatusmessage.ReceivedData.TargetMac).Colour = new LifxColour()
                    {
                        Hue        = lightstatusmessage.Hue,
                        Luminosity = lightstatusmessage.Lumnosity,
                        Saturation = lightstatusmessage.Saturation,
                        Kelvin     = lightstatusmessage.Kelvin
                    };

                    await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        NextPageButton.IsEnabled      = true;
                        LooksGoodTextBlock.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        BulbListBox.Visibility        = Windows.UI.Xaml.Visibility.Visible;
                        BulbListBox.Items.Add(new ListBoxItem()
                        {
                            Content = (lightstatusmessage.Label + " - " + LifxHelper.ByteArrayToString(lightstatusmessage.ReceivedData.TargetMac)) as string
                        });
                    });
                }
            }

            StorageHelper.SaveToStorage();

            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                Helper.HideProgressIndicator();
            });
        }
コード例 #3
0
 void Instance_PanControllerFound(object sender, LifxPanController e)
 {
     throw new NotImplementedException();
 }