private void lbRegisteredTools_SelectedIndexChanged(object sender, EventArgs e) { // get item var item = (HcToolInfo)lbRegisteredTools.SelectedItem; // check item if (item == null) { return; } // stop all sessions event monitoring HCommAir.StopAllSessionsEventMonitor(); // select session SelectedSession = HCommAir.GetSession(item); // check selected session if (SelectedSession == null) { return; } // update information lbIp.Text = $@"IP: {SelectedSession.ToolInfo.Ip}"; lbMac.Text = $@"MAC: {SelectedSession.ToolInfo.Mac}"; lbSerial.Text = $@"S/N: {SelectedSession.ToolInfo.Serial}"; lbState.Text = $@"STATE: {SelectedSession.State}"; }
private void OnChangedConnect(HcToolInfo info, ConnectionState state) { // check tool serial if (info.Serial != string.Empty) { // check mac address if (SelectedSession == null || SelectedSession.ToolInfo.Mac != info.Mac) { return; } } else { // set selected tool SelectedSession = HCommAir.GetSession(info); } Invoke(new EventHandler(delegate { // set state lbState.Text = $@"STATE: {state}"; })); }