예제 #1
0
 private void GetKey_Button_Click(object sender, EventArgs e)
 {
     SHueConfig.AddUser();
     SetKeyText(Settings.Username);
     GetKey_Button.Enabled = false;
     Settings.Instance.SaveSettings("");
     Initialize(false);
 }
예제 #2
0
 public void Initialize()
 {
     if (BridgeIP == null)
     {
         BridgeIP = SHueConfig.DiscoverBridgeIP();
     }
     HueLights = new List <string>();
 }
예제 #3
0
 private void GetLights_Button_Click(object sender, EventArgs e)
 {
     if (Settings.Username != null)
     {
         HueLights_ListBox.Items.Clear();
         List <string> LightList = SHueConfig.GetColorableLights();
         foreach (var l in LightList)
         {
             HueLights_ListBox.Items.Add(l);
         }
     }
 }
예제 #4
0
 private void AddLight_Button_Click(object sender, EventArgs e)
 {
     if (HueLights_ListBox.SelectedItem != null && !AddedLights_ListBox.Items.Contains(HueLights_ListBox.SelectedItem))
     {
         List <string> LightToAdd = new List <string>();
         LightToAdd.Add(HueLights_ListBox.SelectedItem.ToString());
         HueLights_ListBox.Items.Add(HueLights_ListBox.SelectedItem);
         SHueConfig.TurnOnOffLights(LightToAdd, true);
         Settings.Instance.IsEnabled = true;
         Activity_LBL.Text           = HueLights_ListBox.SelectedItem.ToString() + " has been added ...";
         var TStopwatch = new Stopwatch();
         TStopwatch.Start();
         if (TStopwatch.ElapsedMilliseconds > 4000)
         {
             Activity_LBL.Text = "";
             TStopwatch.Stop();
         }
     }
 }
예제 #5
0
 private void RemoveLight_Button_Click(object sender, EventArgs e)
 {
     if (AddedLights_ListBox.SelectedItem != null)
     {
         List <string> LightToRemove = new List <string>();
         LightToRemove.Add(AddedLights_ListBox.SelectedItem.ToString());
         AddedLights_ListBox.Items.Remove(AddedLights_ListBox.SelectedItem);
         SHueConfig.TurnOnOffLights(LightToRemove, false);
         if (AddedLights_ListBox.Items.Count == 0)
         {
             Settings.Instance.IsEnabled = false;
         }
         Activity_LBL.Text = AddedLights_ListBox.SelectedItem.ToString() + " has been removed ...";
         var TStopwatch = new Stopwatch();
         TStopwatch.Start();
         if (TStopwatch.ElapsedMilliseconds > 4000)
         {
             Activity_LBL.Text = "";
             TStopwatch.Stop();
         }
     }
 }