private void GetKey_Button_Click(object sender, EventArgs e) { SHueConfig.AddUser(); SetKeyText(Settings.Username); GetKey_Button.Enabled = false; Settings.Instance.SaveSettings(""); Initialize(false); }
public void Initialize() { if (BridgeIP == null) { BridgeIP = SHueConfig.DiscoverBridgeIP(); } HueLights = new List <string>(); }
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); } } }
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(); } } }
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(); } } }