private static void InitData() { // get dictionary of all avaiable bands and their specification from the web service // this is done first so we can use them with the entries data ResistorCalculatorService.ResistorCalculatorServiceClient service = new ResistorCalculatorService.ResistorCalculatorServiceClient(); Dictionary <int, ResistorCalculatorService.BandDetail> bandColors = service.GetBandList(); List <Band> bands = new List <Band>(); foreach (KeyValuePair <int, ResistorCalculatorService.BandDetail> band in bandColors) { ResistorCalculatorService.BandDetail bandItem = (ResistorCalculatorService.BandDetail)band.Value; Band bandColor = new Band(band.Key, bandItem); bands.Add(bandColor); } // get dictionary of all avaiable bands and their specification from the web service Dictionary <int, ResistorCalculatorService.EntryDetail> entryList = service.GetEntryList(); List <Entry> entries = new List <Entry>(); foreach (KeyValuePair <int, ResistorCalculatorService.EntryDetail> entry in entryList) { ResistorCalculatorService.EntryDetail entryItem = (ResistorCalculatorService.EntryDetail)entry.Value; Entry entryData = new Entry(entryItem.ID, entryItem); entries.Add(entryData); } // set the static lists Bands = bands; Entries = entries; }
// Constructors a band for the provided band specification public Band(int key, ResistorCalculatorService.BandDetail band) { // set the id to the key value provided ID = key; // set the band sepcification to the object provided Specification = band; }