//method called after a new insumo is created. If the recipe is being edited this method is not //called private void ResetFields() { int selectedTabIndex = (this.ParentForm as mainForm).xtraTabControl.SelectedTabPageIndex; NuevoInsumo pnlInsumo = new NuevoInsumo(); pnlInsumo.Dock = DockStyle.Fill; DevExpress.XtraTab.XtraTabPage tabItem = new DevExpress.XtraTab.XtraTabPage(); tabItem.Controls.Add(pnlInsumo); tabItem.Text = "nuevo insumo"; (this.ParentForm as mainForm).xtraTabControl.TabPages.Add(tabItem); (this.ParentForm as mainForm).xtraTabControl.SelectedTabPage = tabItem; (this.ParentForm as mainForm).xtraTabControl.TabPages.RemoveAt(selectedTabIndex); }
private void barButtonAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //if ( !( this.ParentForm as mainForm ).ContextControls.ContainsKey( "NuevoInsumo" ) ) { NuevoInsumo pnlInsumo = new NuevoInsumo( ); pnlInsumo.Dock = DockStyle.Fill; DevExpress.XtraTab.XtraTabPage tabItem = new DevExpress.XtraTab.XtraTabPage( ); tabItem.Controls.Add(pnlInsumo); tabItem.Text = "nuevo insumo"; (this.ParentForm as mainForm).xtraTabControl.TabPages.Add(tabItem); (this.ParentForm as mainForm).xtraTabControl.SelectedTabPage = tabItem; // ( this.ParentForm as mainForm ).ContextControls.Add( "NuevoInsumo" , pnlInsumo ); } }
private void barButtonEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { CommonUtils.Insumo updateInsumo = (CommonUtils.Insumo)gridViewListaInsumos.GetFocusedRow();//((DevExpress.XtraGrid.Views.Grid.GridView)gridControlListaInsumos.Views[0]).GetFocusedRow(); if (updateInsumo != null) { if (!(this.ParentForm as mainForm).ContextControlsForInsumo.ContainsKey(updateInsumo.idInsumo.ToString())) { NuevoInsumo pnlInsumo = new NuevoInsumo(updateInsumo); (this.ParentForm as mainForm).ContextControlsForInsumo.Add(updateInsumo.idInsumo.ToString(), pnlInsumo); pnlInsumo.Dock = DockStyle.Fill; DevExpress.XtraTab.XtraTabPage tabItem = new DevExpress.XtraTab.XtraTabPage( ); tabItem.Controls.Add(pnlInsumo); tabItem.Text = pnlInsumo.Insumo.nombre; (this.ParentForm as mainForm).xtraTabControl.TabPages.Add(tabItem); (this.ParentForm as mainForm).xtraTabControl.SelectedTabPage = tabItem; // ( this.ParentForm as mainForm ).ContextControls.Add( updateInsumo.idInsumo.ToString() , pnlInsumo ); } } }
private void barButtonAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //if ( !( this.ParentForm as mainForm ).ContextControls.ContainsKey( "NuevoInsumo" ) ) { NuevoInsumo pnlInsumo = new NuevoInsumo( ); pnlInsumo.Dock = DockStyle.Fill; DevExpress.XtraTab.XtraTabPage tabItem = new DevExpress.XtraTab.XtraTabPage( ); tabItem.Controls.Add( pnlInsumo ); tabItem.Text = "nuevo insumo"; ( this.ParentForm as mainForm ).xtraTabControl.TabPages.Add( tabItem ); ( this.ParentForm as mainForm ).xtraTabControl.SelectedTabPage = tabItem; // ( this.ParentForm as mainForm ).ContextControls.Add( "NuevoInsumo" , pnlInsumo ); } }
private void barButtonEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { CommonUtils.Insumo updateInsumo = (CommonUtils.Insumo)gridViewListaInsumos.GetFocusedRow();//((DevExpress.XtraGrid.Views.Grid.GridView)gridControlListaInsumos.Views[0]).GetFocusedRow(); if (updateInsumo != null) { if ( !( this.ParentForm as mainForm ).ContextControlsForInsumo.ContainsKey( updateInsumo.idInsumo.ToString() ) ) { NuevoInsumo pnlInsumo = new NuevoInsumo( updateInsumo ); (this.ParentForm as mainForm).ContextControlsForInsumo.Add(updateInsumo.idInsumo.ToString(), pnlInsumo); pnlInsumo.Dock = DockStyle.Fill; DevExpress.XtraTab.XtraTabPage tabItem = new DevExpress.XtraTab.XtraTabPage( ); tabItem.Controls.Add( pnlInsumo ); tabItem.Text = pnlInsumo.Insumo.nombre; ( this.ParentForm as mainForm ).xtraTabControl.TabPages.Add( tabItem ); ( this.ParentForm as mainForm ).xtraTabControl.SelectedTabPage = tabItem; // ( this.ParentForm as mainForm ).ContextControls.Add( updateInsumo.idInsumo.ToString() , pnlInsumo ); } } }