/// <summary> /// Legt eine Auswahl an. /// </summary> /// <param name="information">Die zugehörigen Informationen.</param> public DecoderItem( IDeviceOrFilterInformation information ) { // Remember Information = information; }
/// <summary> /// Erzeugt eine neue Auswahl. /// </summary> /// <param name="information">Das zugehörige Gerät.</param> public DeviceSelector(IDeviceOrFilterInformation information) { // Remember Information = information; }
/// <summary> /// Legt eine Auswahl an. /// </summary> /// <param name="information">Die zugehörigen Informationen.</param> public DecoderItem(IDeviceOrFilterInformation information) { // Remember Information = information; }
/// <summary> /// Erzeugt eine neue Auswahl. /// </summary> /// <param name="information">Das zugehörige Gerät.</param> public DeviceSelector( IDeviceOrFilterInformation information ) { // Remember Information = information; }
/// <summary> /// Füllt eine Auswahlliste mit Decodern. /// </summary> /// <param name="list">Die zu befüllende Liste.</param> /// <param name="items">Die Liste der Decoder in willkürlicher Reihenfolge.</param> /// <param name="selected">Der vorab ausgewählte Eintrag der Liste.</param> private void LoadList( ComboBox list, IDeviceOrFilterInformation[] items, string selected ) { // Fill the list list.Items.AddRange( items.Select( i => new DecoderItem( i ) ).ToArray() ); // Disable sorting list.Sorted = false; // Finally add the empty selector list.Items.Insert( 0, Properties.Resources.DefaultDecoder ); // Check for selected item if (null != selected) if (selected.StartsWith( DecoderMonikerPrefix )) try { // Rest should be a guid string test = selected.Substring( DecoderMonikerPrefix.Length ); // Find it for (int i = list.Items.Count; i-- > 1; ) { // Attach to the item var info = (DecoderItem) list.Items[i]; // Test if (0 == string.Compare( test, info.Information.UniqueName, true )) { // Select list.SelectedIndex = i; // Done return; } } } catch { // Ignore any error } // Use default list.SelectedIndex = 0; }