private void UpdateSplitters(ABMCommonRoutines.enModes mode) { bool updateVerticalSplitter = false; bool updateHorizontalSplitter = false; switch (mode) { case ABMCommonRoutines.enModes.Normal: updateHorizontalSplitter = !HorizontalSplitter.ControlToHide.Visible; updateVerticalSplitter = !VerticalSplitter.ControlToHide.Visible; break; case ABMCommonRoutines.enModes.New: case ABMCommonRoutines.enModes.Edition: updateHorizontalSplitter = HorizontalSplitter.ControlToHide.Visible; break; case ABMCommonRoutines.enModes.Query: case ABMCommonRoutines.enModes.Search: updateVerticalSplitter = VerticalSplitter.ControlToHide.Visible; updateHorizontalSplitter = HorizontalSplitter.ControlToHide.Visible; break; } if (updateVerticalSplitter) { VerticalSplitter.ToggleState(); } if (updateHorizontalSplitter) { HorizontalSplitter.ToggleState(); } }
private void ChangeCurrentMode(ABMCommonRoutines.enModes newMode) { Delegate eventHandler; object[] paramsList = null; switch (newMode) { case ABMCommonRoutines.enModes.Normal: eventHandler = EnterNormalMode; break; case ABMCommonRoutines.enModes.Edition: eventHandler = EnterEditingMode; break; case ABMCommonRoutines.enModes.New: eventHandler = EnterNewMode; break; case ABMCommonRoutines.enModes.Query: eventHandler = EnterQueryMode; break; case ABMCommonRoutines.enModes.Search: eventHandler = EnterSearchMode; break; default: eventHandler = EnterNormalMode; break; } FireEvent(eventHandler, paramsList); }
private void EnableABMButton(ABMCommonRoutines.enModes pModo, ButtonBase oCtl) { string ctlName = oCtl.Name.ToLower(); if (ctlName == CMDNuevo.Name.ToLower()) { oCtl.Enabled = (pModo == ABMCommonRoutines.enModes.Normal | pModo == ABMCommonRoutines.enModes.New | pModo == ABMCommonRoutines.enModes.Search); } else if (ctlName == CMDCancelar.Name.ToLower()) { oCtl.Enabled = (pModo == ABMCommonRoutines.enModes.Edition | pModo == ABMCommonRoutines.enModes.New | pModo == ABMCommonRoutines.enModes.Query | pModo == ABMCommonRoutines.enModes.Search); } else if (ctlName == CMDConsultar.Name.ToLower()) { oCtl.Enabled = (pModo == ABMCommonRoutines.enModes.Normal | pModo == ABMCommonRoutines.enModes.Search); } else if (ctlName == CMDEditar.Name.ToLower()) { oCtl.Enabled = (pModo == ABMCommonRoutines.enModes.Normal | pModo == ABMCommonRoutines.enModes.Edition | pModo == ABMCommonRoutines.enModes.Search); } else if (ctlName == CMDBuscar.Name.ToLower()) { oCtl.Enabled = (pModo == ABMCommonRoutines.enModes.Normal | pModo == ABMCommonRoutines.enModes.Query | pModo == ABMCommonRoutines.enModes.Search); } else if (ctlName == CMDEliminar.Name.ToLower()) { oCtl.Enabled = (pModo == ABMCommonRoutines.enModes.Normal | pModo == ABMCommonRoutines.enModes.Query | pModo == ABMCommonRoutines.enModes.Search); } }
protected void CMDNuevo_Click(object sender, System.EventArgs e) { bool actionCancelled = false; if (modoActual != ABMCommonRoutines.enModes.New) { modoActual = ABMCommonRoutines.enModes.New; } else { var paramList = new object[] { true, actionCancelled }; FireEvent(SavingItem, paramList); actionCancelled = (bool)paramList[1]; if (!actionCancelled) { modoActual = ABMCommonRoutines.enModes.Normal; } } if (!actionCancelled) { UpdateControls(modoActual); ChangeCurrentMode(modoActual); } }
protected virtual void CMDBuscar_Click(object sender, System.EventArgs e) { modoActual = ABMCommonRoutines.enModes.Search; UpdateControls(modoActual); ChangeCurrentMode(modoActual); }
protected virtual void CMDEliminar_Click(object sender, System.EventArgs e) { FireEvent(DeletingItem, null); modoActual = ABMCommonRoutines.enModes.Normal; UpdateControls(modoActual); ChangeCurrentMode(modoActual); }
protected virtual void CMDCancelar_Click(object sender, System.EventArgs e) { FireEvent(Cancelling, new object[] { modoActual }); modoActual = ABMCommonRoutines.enModes.Normal; UpdateControls(modoActual); ChangeCurrentMode(modoActual); }
protected virtual void UpdateControls(ABMCommonRoutines.enModes pModo) { switch (pModo) { case ABMCommonRoutines.enModes.Search: SetSearchMode(); break; case ABMCommonRoutines.enModes.Query: SetQueryMode(); break; case ABMCommonRoutines.enModes.Edition: SetEditMode(); CMDEditar.Text = "&Guardar"; CMDEditar.Image = Resources.font_awesome_4_7_0_save_16_0_000000_none; break; case ABMCommonRoutines.enModes.Normal: SetNormalMode(); CMDNuevo.Text = "&Nuevo"; CMDNuevo.Image = Resources.font_awesome_4_7_0_plus_16_0_000000_none1; CMDEditar.Text = "&Editar"; CMDEditar.Image = Resources.material_icons_3_0_1_mode_edit_16_0_000000_none; PBar.Value = PBar.Minimum; break; case ABMCommonRoutines.enModes.New: SetNewMode(); CMDNuevo.Text = "&Guardar"; CMDNuevo.Image = Resources.font_awesome_4_7_0_save_16_0_000000_none; break; } bool enableDisplayControls = (pModo == ABMCommonRoutines.enModes.Normal | pModo == ABMCommonRoutines.enModes.Query | pModo == ABMCommonRoutines.enModes.Search); TViewCategorias.Enabled = enableDisplayControls; if (ChangeItemsListState != null) { ChangeItemsListState(enableDisplayControls); } SPCDatosCargados.Panel2.Enabled = enableDisplayControls; if (enhanceDisplayArea) { UpdateSplitters(pModo); } }
private void EnableABMButtons(ABMCommonRoutines.enModes pModo) { List <ButtonBase> oList = null; ButtonBase oCtl = null; moABMRoutines.CreateControlList <ButtonBase>(PNLToolBar, ref oList); foreach (ButtonBase oCtl_loopVariable in oList) { oCtl = oCtl_loopVariable; EnableABMButton(pModo, oCtl); } }
protected virtual void ABMForm_Load(object sender, System.EventArgs e) { moABMRoutines = new ABMCommonRoutines(); modoActual = ABMCommonRoutines.enModes.Normal; var _with1 = moABMRoutines; _with1.currentForm = this; _with1.cmdSearchName = CMDBuscar.Name; _with1.cmdCancelName = CMDCancelar.Name; _with1.cmdQueryName = CMDConsultar.Name; _with1.cmdEditName = CMDEditar.Name; _with1.cmdNewName = CMDNuevo.Name; _with1.cmdDeleteName = CMDEliminar.Name; UpdateControls(modoActual); }
protected virtual void CMDConsultar_Click(System.Object sender, System.EventArgs e) { modoActual = ABMCommonRoutines.enModes.Query; UpdateControls(modoActual); ChangeCurrentMode(modoActual); }