public virtual void LoadData() { //m_tblInfo = s_config.getTable(m_tblName); m_tblInfo.LoadData(); #if manual_crt_dgv_columns m_dataGridView.AutoGenerateColumns = false; lConfigMng.CrtColumns(m_dataGridView, m_tblInfo); #endif m_dataContent = appConfig.s_contentProvider.CreateDataContent(m_tblInfo.m_tblName); #if !use_bg_work m_dataContent.FillTableCompleted += M_dataContent_FillTableCompleted; m_dataContent.UpdateTableCompleted += M_dataContent_FillTableCompleted; #endif #if !init_datatable_cols m_dataContent.Load(); #endif m_dataGridView.DataSource = m_dataContent.m_bindingSource; DataTable tbl = (DataTable)m_dataContent.m_bindingSource.DataSource; if (tbl != null) { update(); } else { Debug.Assert(false, "tbl not created!"); } #if use_bg_work m_wkr = myWorker.getWorker(); m_wkr.BgProcess += M_wkr_BgProcess; m_wkr.FgProcess += M_wkr_FgProcess; #endif }
public static myWorker getWorker() { if (s_worker == null) { s_worker = new myWorker(); } return(s_worker); }
public virtual void LoadData() { foreach (SearchCtrl ctrl in m_searchCtrls) { ctrl.LoadData(); } #if use_bg_work m_wkr = myWorker.getWorker(); #endif }
public Form1() { //this.Font = lConfigMng.getFont(); InitializeComponent(); //init config & load config appConfig.s_config = lConfigMng.crtInstance(); if (appConfig.s_config.m_dbSchema == null) { #if use_sqlite appConfig.s_config.m_dbSchema = new lSQLiteDbSchema(); #else appConfig.s_config.m_dbSchema = new lSqlDbSchema(); #endif //use_sqlite appConfig.s_config.m_panels = new List <lBasePanel> { new lReceiptsPanel(), new lInterPaymentPanel(), new lExternalPaymentPanel(), new lSalaryPanel(), //new lAdvancePanel(), }; #if save_config appConfig.s_config.UpdateConfig(); #endif } //init content provider #if use_sqlite appConfig.s_contentProvider = lSQLiteContentProvider.getInstance(this); #else appConfig.s_contentProvider = lSqlContentProvider.getInstance(this); #endif //use_sqlite //menu var mn = crtMenu(); //tab control m_tabCtrl = new TabControl(); //Controls.Add(m_tabCtrl); //m_tabCtrl.Anchor = AnchorStyles.Top | AnchorStyles.Left |AnchorStyles.Right|AnchorStyles.Bottom; m_tabCtrl.Dock = DockStyle.Fill; #if crtnew_panel List <lBasePanel> newPanels = new List <lBasePanel>(); foreach (lBasePanel panel in m_panels) { lBasePanel newPanel = lBasePanel.crtPanel(panel); newPanels.Add(newPanel); TabPage newTab = crtTab(newPanel); m_tabCtrl.TabPages.Add(newTab); } m_panels = newPanels; #else foreach (lBasePanel panel in m_panels) { panel.Restore(); TabPage newTab = crtTab(panel); m_tabCtrl.TabPages.Add(newTab); } #endif //crtnew_panel m_tabCtrl.SelectedIndex = 0; Load += new System.EventHandler(Form1_Load); #if tab_header_blue //set tab header blue m_tabCtrl.DrawMode = TabDrawMode.OwnerDrawFixed; m_tabCtrl.DrawItem += tabControl1_DrawItem; #endif //set font //this.Font = lConfigMng.getFont(); m_tabCtrl.Font = lConfigMng.getFont(); Label tmpLbl = new Label(); //tmpLbl.BorderStyle = BorderStyle.FixedSingle; tmpLbl.Anchor = AnchorStyles.Right; tmpLbl.Text = "© 2017 BAN TRI KHÁCH CHÙA BA VÀNG"; tmpLbl.AutoSize = true; tmpLbl.BackColor = Color.Transparent; TableLayoutPanel tmpTbl = new TableLayoutPanel(); tmpTbl.Dock = DockStyle.Fill; tmpTbl.RowCount = 3; tmpTbl.RowStyles.Add(new RowStyle()); tmpTbl.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); tmpTbl.RowStyles.Add(new RowStyle()); if (mn != null) { tmpTbl.Controls.Add((MenuStrip)mn, 0, 0); } tmpTbl.Controls.Add(tmpLbl, 1, 0); tmpTbl.Controls.Add(m_tabCtrl, 0, 1); tmpTbl.SetColumnSpan(m_tabCtrl, 2); #if use_bg_work sts = new StatusStrip(); sts.Dock = DockStyle.Bottom; stsLbl = new ToolStripStatusLabel(); stsLbl.Dock = DockStyle.Left; prg = new ToolStripProgressBar(); prg.Dock = DockStyle.Right; prg.Maximum = 100; prg.Visible = false; sts.Items.AddRange(new ToolStripItem[] { stsLbl, prg }); tmpTbl.Controls.Add(sts, 0, 2); tmpTbl.SetColumnSpan(sts, 2); #endif Controls.Add(tmpTbl); #if use_bg_work //background work m_bgwork = myWorker.getWorker(); m_bgwork.BgProcess += bg_process; m_bgwork.FgProcess += fg_process; #endif }