void IEntityControl.InitNavigator(IUINavigator Navigator) { BindingSource MainBs = BaseWinFramework.FindMainBindingSource( this, typeof(ParentEntity)); if (MainBs == null) { throw new ApplicationException("Main BindingSource not found !"); } if (MainBs.DataSource as ParentEntity == null) { Type EntityType = ((Type)MainBs.DataSource).UnderlyingSystemType; MainBs.DataSource = BaseFactory.CreateInstance(EntityType); } BaseWinFramework.WinForm.AutoFormat .AutoFormatForm(this, false); if (Navigator != null) { Navigator.BindingSource = MainBs; InitNavigator(Navigator); ((IRuleInitUI)MainBs.DataSource).AfterInitNavigator(Navigator); Navigator.SetAutoFormMode(); if (!ShowNavigator) { Navigator.Visible = false; } } }
protected void InitFilterForm(Form Frm, XtraScrollableControl xtraScrollableControl1, SplitContainerControl splitContainerControl1) { Frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; Frm.Height = Frm.ClientSize.Height; Frm.TopLevel = false; Frm.Parent = xtraScrollableControl1; Frm.Dock = DockStyle.Top; splitContainerControl1.SplitterPosition = Frm.Height + 7; //Find DataSource BindingSource bs = BaseWinFramework .FindMainBindingSource(Frm, typeof(ReportEntity)); if (bs != null && bs.DataSource as ReportEntity == null) { Type EntityType = ((Type)bs.DataSource).UnderlyingSystemType; re = (ReportEntity)BaseFactory.CreateInstance(EntityType); _Evaluator = BaseFactory.CreateInstance <Evaluator>(); TableDef td = MetaData.GetTableDef(EntityType); td.SetDefault((BaseEntity)re); re.InitUI(); re.SetReportRefresh(ReportRefresh); re.SetFormChanged(OnFormChanged); bs.DataSource = re; } Frm.Show(); }
ShowDialog(Type ControlType, string ModuleName) { using (new WaitCursor(true)) { if (ControlType.IsSubclassOf(typeof(DocumentForm))) { ParentEntity orig; frmSingletonEntity frm = new frmSingletonEntity(); Control FormCtrl = (Control)BaseFactory .CreateInstance(ControlType); BindingSource bnd = BaseWinFramework.FindMainBindingSource( (Form)FormCtrl, typeof(ParentEntity)); orig = bnd.DataSource as ParentEntity; if (orig == null) { orig = (ParentEntity) BaseFactory.CreateInstance((Type)bnd.DataSource); } if (!orig.LoadEntity()) { orig.SetDefaultValue(); } frm.pe = (ParentEntity)MetaData.CloneAll(orig); frm.pe.SetOriginal(orig); ((IRuleInitUI)frm.pe).InitUI(); DocumentForm frmc = (DocumentForm)FormCtrl; frm.frmc = frmc; bnd.DataSource = frm.pe; IEntityControl df = FormCtrl as IEntityControl; if (df != null) { df.InitNavigator(null); } ((IRuleInitUI)frm.pe).AfterInitNavigator(null); BaseWinFramework.WinForm.AutoFormat .AutoFormatForm(FormCtrl, false); BaseWinFramework.WinForm.AutoLockEntity.LockForm(frm.pe, MetaData.GetTableDef(frm.pe.GetType()), FormCtrl); frm.ep = new DXErrorProvider(frm); frm.ep.DataSource = bnd; if (frmc != null) { frmc.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; frmc.FormClosed += new FormClosedEventHandler(frmc_FormClosed); frmc.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; frmc.TopLevel = false; frmc.Parent = frm; frm.Width = frmc.Width + frm.Width - frm.DisplayRectangle.Width; if (frmc.ShowConfirmButton) { frm.Height = frmc.Height + 70; } else { frm.Height = frmc.Height + frm.Height - frm.DisplayRectangle.Height; frm.simpleButton1.Visible = false; frm.simpleButton2.Visible = false; } frmc.Show(); } else { frm.Width = FormCtrl.Width + frm.Width - frm.DisplayRectangle.Width; frm.Height = FormCtrl.Height + 70; frm.Controls.Add(FormCtrl); } if (frmc != null && frmc.Text.Length > 0) { frm.Text = frmc.Text; } else { frm.Text = BaseUtility.SplitName(ModuleName.Length == 0 ? orig.GetType().Name : ModuleName); } ((Control)frmc).TabIndex = 0; return(frm.ShowForm(BaseWinFramework.MdiParent)); } else { XtraForm frm = (XtraForm)BaseFactory.CreateInstance(ControlType); return(frm.ShowDialog(BaseWinFramework.MdiParent)); } } }
protected override void OnLoad(EventArgs e) { ep.ContainerControl = this; ep.DataSource = BaseWinFramework.FindMainBindingSource(this, typeof(ReportEntity)); FindGridAndLookup(Controls); }