private void PopulateProgramsList() { // Get list of programs List <string> programs = ControlSettingProgram.GetPrograms(); // Loop over list of programs foreach (string program in programs) { ControlSettingProgram control = new ControlSettingProgram(); control.Header = program; itemsPrograms.Items.Add(control); } }
public void Load(BinaryReader reader) { // Get count of program configs int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { // Get info of program config string header = reader.ReadString(); bool installed = reader.ReadBoolean(); // Search for control with header matching config ControlSettingProgram control = MainWindow.itemsPrograms.Items.Cast <ControlSettingProgram>() .FirstOrDefault(x => x.Header == header); // If no control was found if (control == null) { // Create new instance of program control = new ControlSettingProgram(); // Set properties control.Header = header; control.Installed = installed; // All written programs are scored control.IsScored = true; MainWindow.itemsPrograms.Items.Add(control); } else { // Set other configs control.IsScored = true; control.Installed = installed; } } }