private void AddAutoComp() { Task <List <Maticsoft.Model.component> > ff_task = new Task <List <Maticsoft.Model.component> >(() => { List <Maticsoft.Model.component> ret_list = new List <Maticsoft.Model.component>(); Maticsoft.BLL.component part_bll = new Maticsoft.BLL.component(); ret_list = part_bll.GetModelList(" "); return(ret_list); }); ff_task.ContinueWith((ret_list) => { var datasou = new AutoCompleteStringCollection(); List <Maticsoft.Model.component> local_ret_list = ret_list.Result; //ret_list.ConvertAll(); List <string> pn_list = local_ret_list.ConvertAll <string>((temp_obj) => { return(temp_obj.componentId.ToString()); }); datasou.AddRange(pn_list.ToArray()); textBox_ljhao.BeginInvoke(new Action(() => { textBox_ljhao.AutoCompleteCustomSource = datasou; textBox_ljhao.AutoCompleteMode = AutoCompleteMode.SuggestAppend; textBox_ljhao.AutoCompleteSource = AutoCompleteSource.CustomSource; })); }); ff_task.Start(); }
private void addparts_Load(object sender, EventArgs e) { Maticsoft.BLL.component component_bll = new Maticsoft.BLL.component(); comp_list = component_bll.GetModelList(""); if (comp_list.Count > 0) { List <string> com_strlist = comp_list.ConvertAll <string>(x => x.componentId.ToString()); this.comboBox1.Items.AddRange(com_strlist.ToArray()); } }
private void DevSt_Load(object sender, EventArgs e) { this.get_lingjian(); //where 1 = 1 GROUP BY pn LIMIT 10 //global.CurActive = "DevSt"; //this.TopMost = true; //this.Activate(); this.last_flp.Controls.Clear(); //Maticsoft.BLL.test test_bll = new Maticsoft.BLL.test(); //List<Maticsoft.Model.test> test_lists = test_bll.GetModelList(" 1=1 GROUP BY pn LIMIT 10"); Maticsoft.BLL.component com_bll = new Maticsoft.BLL.component(); List <Maticsoft.Model.component> com_list = com_bll.GetModelList(""); foreach (var test_obj in com_list) { Button a = new Button(); a.Text = test_obj.name.ToString(); a.Tag = test_obj.componentId.ToString(); a.Click += new System.EventHandler(this.button_Click); this.last_flp.Controls.Add(a); } }