private void listLinkageWindowControl_ItemChecked(object sender, ItemCheckedEventArgs e) { if (m_bIsLoading) { return; } CWindowControl WindowControl = (CWindowControl)ControlEl.Tag; CWindowControl wc = (CWindowControl)e.Item.Tag; if (e.Item.Checked) { List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList(); bool bHas = false; foreach (CBaseObject obj in lstLWC) { CLinkageWindowControl lwc = (CLinkageWindowControl)obj; if (lwc.SlaveID == wc.Id) { bHas = true; break; } } if (!bHas) { CLinkageWindowControl lwc = new CLinkageWindowControl(); lwc.MasterID = WindowControl.Id; lwc.SlaveID = wc.Id; lwc.Ctx = Program.Ctx; WindowControl.LinkageWindowControlMgr.AddNew(lwc); } } else { List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList(); foreach (CBaseObject obj in lstLWC) { CLinkageWindowControl lwc = (CLinkageWindowControl)obj; if (lwc.SlaveID == wc.Id) { WindowControl.LinkageWindowControlMgr.Delete(lwc); break; } } } }
void RefreshLinkageWindowControl(CWindowControl WindowControl) { List <Control> lstCtrls = new List <Control>(); foreach (Control ctrl in panelTop.Controls) { lstCtrls.Add(ctrl); } foreach (Control ctrl in panelBottom.Controls) { lstCtrls.Add(ctrl); } foreach (Control ctrl in panelLeft.Controls) { lstCtrls.Add(ctrl); } foreach (Control ctrl in panelRight.Controls) { lstCtrls.Add(ctrl); } foreach (Control ctrl in panelFill.Controls) { lstCtrls.Add(ctrl); } List <CBaseObject> lstLT = WindowControl.LinkageWindowControlMgr.GetList(); foreach (CBaseObject obj in lstLT) { CLinkageWindowControl LinkageWindowControl = (CLinkageWindowControl)obj; CWindowControl swc = (CWindowControl)WindowControl.m_ObjectMgr.Find(LinkageWindowControl.SlaveID); if (swc != null) { foreach (Control ctrl in lstCtrls) { if ((CWindowControl)(ctrl.Tag) == swc) { IWindowCtrl winCtrl = (IWindowCtrl)ctrl; if (winCtrl.GetCtrlType() == ControlType.TableGrid) { TableGrid teLT = (TableGrid)ctrl; CTableInWindowControl tiw = teLT.TableInWindowControl; string sQueryFilter = tiw.QueryFilter; if (CalcUIFormula(ref sQueryFilter)) { teLT.BaseObjectMgr.GetList(sQueryFilter); teLT.LoadData(); } } else if (winCtrl.GetCtrlType() == ControlType.TableTab) { TableTab tabLT = (TableTab)ctrl; foreach (TabPage page in tabLT.tabControl.TabPages) { TableGrid teLT = (TableGrid)page.Controls[0]; CTableInWindowControl tiw = teLT.TableInWindowControl; string sQueryFilter = tiw.QueryFilter; if (CalcUIFormula(ref sQueryFilter)) { teLT.BaseObjectMgr.GetList(sQueryFilter); teLT.LoadData(); } } } else if (winCtrl.GetCtrlType() == ControlType.ListBox) { UIListBox listBoxLT = (UIListBox)ctrl; CTableInWindowControl tiw = listBoxLT.TableInWindowControl; string sQueryFilter = tiw.QueryFilter; if (CalcUIFormula(ref sQueryFilter)) { listBoxLT.BaseObjectMgr.GetList(sQueryFilter); listBoxLT.LoadData(); } } else if (winCtrl.GetCtrlType() == ControlType.ComboBox) { UIComboBox combBoxLT = (UIComboBox)ctrl; CTableInWindowControl tiw = combBoxLT.TableInWindowControl; string sQueryFilter = tiw.QueryFilter; if (CalcUIFormula(ref sQueryFilter)) { combBoxLT.BaseObjectMgr.GetList(sQueryFilter); combBoxLT.LoadData(); } } } } } } }
public void LoadData() { if (m_AttrType == AttrType.WindowControl) { if (ControlEl == null || ControlEl.Tag == null) { return; } } else { if (WindowEl == null || WindowEl.Window == null) { return; } } m_bIsLoading = true; UpdateTabCtrl(); UpdatePropertyGrid(); if (m_AttrType == AttrType.WindowControl) { IDesignEl designEl = (IDesignEl)ControlEl; CWindowControl WindowControl = (CWindowControl)ControlEl.Tag; if (designEl.GetCtrlType() == ControlType.NavBar) { } else if (designEl.GetCtrlType() == ControlType.TableGrid) { TableGridEl tableGridEl = (TableGridEl)ControlEl; CTableInWindowControl TableInWindowControl = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj(); CTable table = (CTable)Program.Ctx.TableMgr.Find(TableInWindowControl.FW_Table_id); if (table != null) { listColumn.Items.Clear(); List <CBaseObject> lstColumn = table.ColumnMgr.GetList(); foreach (CBaseObject obj in lstColumn) { CColumn col = (CColumn)obj; ListViewItem item = new ListViewItem(); item.Text = col.Name; item.Tag = col; listColumn.Items.Add(item); List <CBaseObject> lstCIWC = TableInWindowControl.ColumnInTableInWindowControlMgr.GetList(); bool bHas = false; foreach (CBaseObject obj2 in lstCIWC) { CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj2; if (ciwc.FW_Column_id == col.Id) { item.Checked = true; if (tableGridEl.dataGridView.Columns[col.Code] == null) { tableGridEl.dataGridView.Columns.Add(col.Code, col.Name); } bHas = true; break; } } if (!bHas) { if (tableGridEl.dataGridView.Columns[col.Code] != null) { tableGridEl.dataGridView.Columns.Remove(col.Code); } } } } List <CBaseObject> lstTButton = TableInWindowControl.TButtonInTableInWindowControlMgr.GetList(); listToolBarButton.Items.Clear(); foreach (ToolStripItem tbutton in tableGridEl.toolStrip.Items) { ListViewItem item = new ListViewItem(); item.Text = tbutton.Text; listToolBarButton.Items.Add(item); bool bHas = false; foreach (CBaseObject obj in lstTButton) { CTButtonInTableInWindowControl tbiwc = (CTButtonInTableInWindowControl)obj; if (tbiwc.Title.Equals(tbutton.Text, StringComparison.OrdinalIgnoreCase)) { item.Checked = true; bHas = true; break; } } if (!bHas) { tbutton.Visible = false; } } richTextFilter.Text = TableInWindowControl.QueryFilter; List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList(); for (int i = 0; i < listLinkageWindowControl.Items.Count; i++) { listLinkageWindowControl.Items[i].Checked = false; } foreach (ListViewItem item in listLinkageWindowControl.Items) { CWindowControl wc = (CWindowControl)item.Tag; foreach (CBaseObject obj in lstLWC) { CLinkageWindowControl lwc = (CLinkageWindowControl)obj; if (lwc.SlaveID == wc.Id) { item.Checked = true; break; } } } } else if (designEl.GetCtrlType() == ControlType.TableTree) { TableTreeEl treeEl = (TableTreeEl)ControlEl; List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList(); for (int i = 0; i < listLinkageWindowControl.Items.Count; i++) { listLinkageWindowControl.Items[i].Checked = false; } foreach (ListViewItem item in listLinkageWindowControl.Items) { CWindowControl wc = (CWindowControl)item.Tag; foreach (CBaseObject obj in lstLWC) { CLinkageWindowControl lwc = (CLinkageWindowControl)obj; if (lwc.SlaveID == wc.Id) { item.Checked = true; break; } } } } else if (designEl.GetCtrlType() == ControlType.ListBox) { CTableInWindowControl TableInWindowControl = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj(); richTextFilter.Text = TableInWindowControl.QueryFilter; List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList(); for (int i = 0; i < listLinkageWindowControl.Items.Count; i++) { listLinkageWindowControl.Items[i].Checked = false; } foreach (ListViewItem item in listLinkageWindowControl.Items) { CWindowControl wc = (CWindowControl)item.Tag; foreach (CBaseObject obj in lstLWC) { CLinkageWindowControl lwc = (CLinkageWindowControl)obj; if (lwc.SlaveID == wc.Id) { item.Checked = true; break; } } } } else if (designEl.GetCtrlType() == ControlType.ComboBox) { CTableInWindowControl TableInWindowControl = (CTableInWindowControl)WindowControl.TableInWindowControlMgr.GetFirstObj(); richTextFilter.Text = TableInWindowControl.QueryFilter; List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList(); for (int i = 0; i < listLinkageWindowControl.Items.Count; i++) { listLinkageWindowControl.Items[i].Checked = false; } foreach (ListViewItem item in listLinkageWindowControl.Items) { CWindowControl wc = (CWindowControl)item.Tag; foreach (CBaseObject obj in lstLWC) { CLinkageWindowControl lwc = (CLinkageWindowControl)obj; if (lwc.SlaveID == wc.Id) { item.Checked = true; break; } } } } else if (designEl.GetCtrlType() == ControlType.TableTab) { TableTabEl tab = (TableTabEl)ControlEl; TableGridEl tableGridEl = tab.GetCurTableGridEl(); CTableInWindowControl TableInWindowControl = tableGridEl.TableInWindowControl; CTable table = (CTable)Program.Ctx.TableMgr.Find(TableInWindowControl.FW_Table_id); if (table != null) { listColumn.Items.Clear(); List <CBaseObject> lstColumn = table.ColumnMgr.GetList(); foreach (CBaseObject obj in lstColumn) { CColumn col = (CColumn)obj; ListViewItem item = new ListViewItem(); item.Text = col.Name; item.Tag = col; listColumn.Items.Add(item); bool bHas = false; List <CBaseObject> lstCIWC = TableInWindowControl.ColumnInTableInWindowControlMgr.GetList(); foreach (CBaseObject obj2 in lstCIWC) { CColumnInTableInWindowControl ciwc = (CColumnInTableInWindowControl)obj2; if (ciwc.FW_Column_id == col.Id) { item.Checked = true; bHas = true; if (tableGridEl.dataGridView.Columns[col.Code] == null) { tableGridEl.dataGridView.Columns.Add(col.Code, col.Name); } break; } } if (!bHas) { if (tableGridEl.dataGridView.Columns[col.Code] != null) { tableGridEl.dataGridView.Columns.Remove(col.Code); } } } } List <CBaseObject> lstTButton = TableInWindowControl.TButtonInTableInWindowControlMgr.GetList(); listToolBarButton.Items.Clear(); foreach (ToolStripItem tbutton in tableGridEl.toolStrip.Items) { ListViewItem item = new ListViewItem(); item.Text = tbutton.Text; listToolBarButton.Items.Add(item); bool bHas = false; foreach (CBaseObject obj in lstTButton) { CTButtonInTableInWindowControl tbiwc = (CTButtonInTableInWindowControl)obj; if (tbiwc.Title.Equals(tbutton.Text, StringComparison.OrdinalIgnoreCase)) { item.Checked = true; bHas = true; break; } } if (!bHas) { tbutton.Visible = false; } } richTextFilter.Text = TableInWindowControl.QueryFilter; List <CBaseObject> lstLWC = WindowControl.LinkageWindowControlMgr.GetList(); for (int i = 0; i < listLinkageWindowControl.Items.Count; i++) { listLinkageWindowControl.Items[i].Checked = false; } foreach (ListViewItem item in listLinkageWindowControl.Items) { CWindowControl wc = (CWindowControl)item.Tag; foreach (CBaseObject obj in lstLWC) { CLinkageWindowControl lwc = (CLinkageWindowControl)obj; if (lwc.SlaveID == wc.Id) { item.Checked = true; break; } } } } } else { } m_bIsLoading = false; }