public BridgeDetails(HueBridge hb) { InitializeComponent(); ourHueBridge = hb; populateDetails(); }
private void MainForm_Load(object sender, EventArgs e) { setupUI(); initPaths(); theHueBridge = new HueBridge(); ourIP = 0; lightIndices = new int[MAX_LIGHTS_PER_BRIDGE]; Decimal subnetNum = checkForExistingSubnet(); nudSubnet.Value = subnetNum; if (checkForExistingKey()) { btnConnect.Enabled = false; initBridge(); } else { resetApp(); } }
/// <summary> /// Populates the main bridge object with bridge details /// Also calls the Bridge details UI updater /// </summary> private void initBridge() { XmlSerializer bridgeGetter = new XmlSerializer(typeof(HueBridge)); TextReader bridgeXmlReader = new StreamReader(bridgeXmlPath); theHueBridge = (HueBridge)bridgeGetter.Deserialize(bridgeXmlReader); bridgeXmlReader.Close(); if (theHueBridge == null) { MessageBox.Show(Resources.ERROR00, "Scan Failed", MessageBoxButtons.OK); btnSearch.Enabled = true; btnBridgeDetails.Enabled = false; return; } updateBridgeDetailsUI(); populateBridgeLights(); }