public DemoSourceSelectLogic(ISourceList roomSources) { var availableSources = GetSources(); // Send total number of sources to UI roomSources.NumberOfSources((sig, component) => { sig.UShortValue = GetNumberOfSources(); }); _allSources = roomSources; _allSourceItems = availableSources; // On initialize clears all selected sources ClearSourceSelection(); // Loops all sources and sents serial values to UI for (int i = 0; i < 4; i++) { roomSources.Sources[i].UserObject = availableSources[i]; availableSources[i].UserSpecifiedObject = roomSources.Sources[i]; roomSources.Sources[i].NameOfSource((sig, component) => { sig.StringValue = availableSources[i].Name; }); roomSources.Sources[i].IconClassOfSource((sig, component) => { sig.StringValue = availableSources[i].IconClass; }); // Event called when a source is clicked on in UI roomSources.Sources[i].SetSourceSelected += SourceDevice_Selected; } }