public void LoadGridData()
        {
            Action workAction = () =>
            {
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (o, args) =>
                {
                    args.Result = from a in _fService.GetAllAirports()
                                  select new { ID = a.airportID, Navn = a.name, Lokation = a.location };
                };
                worker.RunWorkerCompleted += (o, args) => { dgAirports.ItemsSource = (IEnumerable)args.Result; };
                worker.RunWorkerAsync();
            };

            dgAirports.Dispatcher.BeginInvoke(DispatcherPriority.Background, workAction);
        }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        FlightServiceClient fService = new FlightServiceClient();

        repAirport.DataSource = fService.GetAllAirports();
        repAirport.DataBind();
    }
Beispiel #3
0
 public static List <ListItem> AirportItems()
 {
     return(fService.GetAllAirports().Select(a => new ListItem
     {
         Text = a.name + " " + a.location,
         Value = Convert.ToString(a.airportID),
     }).ToList());
 }
 public static List <ComboBoxItem> AirportItems()
 {
     return(FService.GetAllAirports().Select(a => new ComboBoxItem
     {
         Content = a.name + " " + a.location,
         Name = "ComboBoxAirports",
         Tag = a.airportID,
         HorizontalContentAlignment = HorizontalAlignment.Left,
         VerticalContentAlignment = VerticalAlignment.Center
     }).ToList());
 }
    public void comboboxSource()
    {
        //airportFrom.DataSource = ListItems.AirportItems();
        //airportTo.DataSource = ListItems.AirportItems();


        foreach (var a in fService.GetAllAirports())
        {
            string text  = a.name + " " + a.location;
            string value = a.airportID.ToString();

            airportFrom.Items.Add(new ListItem(text, value));
            airportTo.Items.Add(new ListItem(text, value));
        }
        airportFrom.DataBind();
        airportTo.DataBind();
    }