private void comboBoxProject_SelectedIndexChanged(object sender, EventArgs e) { this.project = ((ComboBoxItem)this.comboBoxProject.SelectedItem).Value as Project; GlobalData.ProjectID = this.project.ID; this.panelRight.Controls.Clear(); if (this.Run1 == true) { FormSupplyRemind.RemindStockinfo(); } this.treeViewLeft.SelectedNode = null; this.Run1 = true; }
private void comboBoxWarehouse_SelectedIndexChanged(object sender, EventArgs e) { this.warehouse = ((ComboBoxItem)this.comboBoxWarehouse.SelectedItem).Value as Warehouse; GlobalData.WarehouseID = this.warehouse.ID; this.panelRight.Controls.Clear(); if (this.Run == true) { FormSupplyRemind.RemindStockinfo(); } this.Run = true; this.treeViewLeft.SelectedNode = null; }
private void FormMain_Load(object sender, EventArgs e) { if (this.supplierid == -1) { FormSupplyRemind.SetFormHidedCallback(() => { this.button2.Visible = true; }); FormSupplyRemind.SetFormShowCallback(() => { this.button2.Visible = false; }); FormSupplyRemind.RemindStockinfo(); } else if (this.supplierid != -1) { this.button2.Visible = false; } //刷新左边树形框 this.RefreshTreeView(); //刷新顶部 this.labelUsername.Text = this.user.Username; this.labelAuth.Text = this.user.AuthorityName + " :"; //窗体大小根据显示屏改变 int DeskWidth = Screen.PrimaryScreen.WorkingArea.Width; int DeskHeight = Screen.PrimaryScreen.WorkingArea.Height; this.Width = Convert.ToInt32(DeskWidth * 0.8); this.Height = Convert.ToInt32(DeskHeight * 0.8); new Thread(() => { //下拉栏显示仓库 WMSEntities wms = new WMSEntities(); var allWarehouses = (from s in wms.Warehouse select s).ToArray(); var allProjects = (from s in wms.Project select s).ToArray(); if (this.IsDisposed) { return; } this.Invoke(new Action(() => { this.comboBoxWarehouse.Items.AddRange((from w in allWarehouses select new ComboBoxItem(w.Name, w)).ToArray()); for (int i = 0; i < this.comboBoxWarehouse.Items.Count; i++) { if (((Warehouse)(((ComboBoxItem)this.comboBoxWarehouse.Items[i]).Value)).ID == this.warehouse.ID) { this.comboBoxWarehouse.SelectedIndex = i; break; } } this.comboBoxProject.Items.AddRange((from p in allProjects select new ComboBoxItem(p.Name, p)).ToArray()); for (int i = 0; i < this.comboBoxWarehouse.Items.Count; i++) { if (((Project)(((ComboBoxItem)this.comboBoxProject.Items[i]).Value)).ID == this.project.ID) { this.comboBoxProject.SelectedIndex = i; break; } } })); }).Start(); }