示例#1
0
        private void workerLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            personals = PersonalController.Get("");
            List <String> lines = personals.Select(p => p.Department).Distinct().ToList();

            cboLines.Dispatcher.Invoke((Action)(() => cboLines.ItemsSource = lines));
            int[] days = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 };
            cboDay.Dispatcher.Invoke((Action)(() => cboDay.ItemsSource = days));
            int[] months = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            cboMonth.Dispatcher.Invoke((Action)(() => cboMonth.ItemsSource = months));
            int[] years = { DateTime.Now.Year - 1, DateTime.Now.Year };
            cboYear.Dispatcher.Invoke((Action)(() => cboYear.ItemsSource = years));
        }