Esempio n. 1
0
        private void doWork(object sender, DoWorkEventArgs e)
        {
            WorkerArg arg = (WorkerArg)e.Argument;

            listFlight.Clear();

            flight[] flights = client.searchFlight(arg.date, arg.cityFrom, arg.cityTo);

            if (flights != null && flights.Length > 0)
            {
                listFlight.AddRange(flights);
            }
        }
Esempio n. 2
0
        private void updateFlights()
        {
            DateTime jan1st1970    = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            DateTime selectedValue = new DateTime(dateFlight.Value.Year, dateFlight.Value.Month, dateFlight.Value.Day);

            long date = (long)((selectedValue - jan1st1970).TotalMilliseconds);

            city cityFrom = (city)comboCityFrom.Items[comboCityFrom.SelectedIndex];
            city cityTo   = (city)comboCityTo.Items[comboCityTo.SelectedIndex];

            WorkerArg arg = new WorkerArg();

            arg.cityFrom = cityFrom;
            arg.cityTo   = cityTo;
            arg.date     = date;

            worker.RunWorkerAsync(arg);
            picLoading.Visible = true;
        }