예제 #1
0
        public void PopulateComboBoxes()
        {
            if( ! ShouldCollectDestinationAirportCode() ) return;

            JwSet<String> airportCodes = new JwSet<String>();
            _airports = airportCodes;
            airportCodes.AddRange( VmAccountData.Default.GetAirportCodes() );

            if( Engine.Cart != null && ! JwUtility.IsEmpty( Engine.Cart.DestinationAirportCode ) )
                airportCodes.Add(Engine.Cart.DestinationAirportCode);

            if( Engine.HasLocationCode() && VmProperties.Default.ShouldNestCartDefaultTagDestination() )
                airportCodes.Add(Engine.LocationCode);

            if( ! VmProperties.Default.IsCartDestinationAirportRequired() ) airportCodes.Add("");

            if( ShouldCollectFlightNumber() )
            {
                _scheduledFlights = VmAirportData.Default.GetScheduledFlights();
                _flightNumberCB.ClearValues();
            }

            _destinationAirportCodeCB.SetValues(airportCodes.GetSortedList());

            if( airportCodes.Count == 1 ) _destinationAirportCodeCB.SelectedItem = airportCodes.GetAny();

            if( Engine.HasLocationCode() && VmProperties.Default.ShouldNestCartDefaultTagDestination() )
                _destinationAirportCodeCB.SelectedItem = Engine.LocationCode;
        }
예제 #2
0
        public void PopulateComboBoxes(IEnumerable valuesx, String defaultValue)
        {
            JwSet<String> valueSet = new JwSet<String>();
            valueSet.AddRange( valuesx );
            _values = valueSet.GetCopy();

            if( ! JwUtility.IsEmpty(defaultValue)  )
                valueSet.Add(defaultValue);

            _valuesCB.SetValues(valueSet.GetSortedList());

            if( valueSet.Count == 1 ) _valuesCB.SelectedItem = valueSet.GetAny();

            AssignDefaultValue(defaultValue);
        }