コード例 #1
0
ファイル: Data.xaml.cs プロジェクト: weizhonzhen/FastEtl
        /// <summary>
        /// 显示业务配置详情
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Bussiness_Selected(object sender, RoutedEventArgs e)
        {
            var item = (sender as DataGrid).SelectedItem as Data_Business;

            if (item != null)
            {
                var list = AppCache.GetBusinessDetails(item.Id);

                if (list.Count == 0)
                {
                    list.Add(new Data_Business_Details());
                }

                BussinessDetails.ItemsSource = list;
                Common.UpdateWindow();
                var taskList = new List <Task>();
                foreach (var temp in BussinessDetails.Items)
                {
                    taskList.Add(Task.Factory.StartNew(() =>
                    {
                        BindComboBox(temp, BussinessDetails);
                    }));
                }
                Task.WaitAll(taskList.ToArray());

                foreach (var temp in BussinessDetails.Items)
                {
                    BussinessDetails.SelectedItem = temp;
                }
            }
            else
            {
                var list = new List <Data_Business_Details>();
                list.Add(new Data_Business_Details());
                BussinessDetails.ItemsSource = list;
            }
        }