/// <summary> /// /// </summary> /// <param name="menuKey"></param> /// <param name="form"></param> /// <returns></returns> protected override FormBase ShowChildForm(FormBase form) { this.SuspendDrawing(); form.Left = 0; form.Top = 0; form.Size = form.ChildSize; this.ChildContainer.Size = form.ChildSize; int hideIndex = m_inSaleMode ? 0 : this.ChildContainer.Controls.Count - 1; if (this.ChildContainer.Controls.Count > 0) { FormBase lastForm = (FormBase)this.ChildContainer.Controls[hideIndex]; lastForm.PerformDeactivated(); lastForm.Visible = false; } this.ChildContainer.Controls.Add(form); // set main menu state EnableMainMenu(!form.IsModal, !form.HideMainMenu); FrameBaseData.Current.OnDataChanged(FrameBaseDataItem.ActiveTitle, form.Text); this.ResumeDrawing(); // activated form form.PerformActivated(); return(form); }
/// <summary> /// Hide 1st, and show sale form /// </summary> private void ShowLastHiddenForm() { this.SuspendDrawing(); FormBase form = (FormBase)this.ChildContainer.Controls[0]; form.PerformDeactivated(); form.Visible = false; //Application.DoEvents(); if (m_saleFormIndex.InRange(0, this.ChildContainer.Controls.Count)) { form = (FormBase)this.ChildContainer.Controls[m_saleFormIndex]; form.PerformActivated(); form.Visible = true; } FrameBaseData.Current.OnDataChanged(FrameBaseDataItem.ActiveTitle, form.Text); ChildContainer.Size = form.ChildSize; EnableMainMenu(!form.IsModal, !form.HideMainMenu); mainMenu1.ModeSingleMenu = false; m_inSaleMode = false; this.ResumeDrawing(); }
FormBase _ShowForm(string formText, string formAssembly, string formClass, bool showProgress, params object[] constructorParams) { // Loading //if (showProgress) ShowProgress(true); FormBase newForm = null; try { string menuKey = formClass.Trim(); if (!string.IsNullOrEmpty(menuKey)) { Object genericInstance = ClassLoader(formAssembly, menuKey, constructorParams); if (genericInstance == null) { return(null); } newForm = genericInstance is FormBase ? (FormBase)genericInstance : null; newForm.Name = menuKey; if (!string.IsNullOrEmpty(formText)) { newForm.Text = formText; } ShowChildForm(newForm); } this.Cursor = Cursors.Default; } catch (Exception ex) { throw ex; } finally { //if (showProgress) ShowProgress(false); this.Cursor = Cursors.Default; } return(newForm); }
/// <summary> /// Show menu with empty left in container /// Hide all /// 1) hiden current menu (판매들록) /// 2) show right menu /// - set mode of menu to SinggleMode /// - Prev click; reshow menu /// /// </summary> /// <param name="menuKey"></param> public override void ShowMenu(string menuKey, bool modeSale) { /* * - hide current sale - index of control * - show main previous * - set mode to menu * - show menu * - prev menu; show back */ m_inSaleMode = modeSale; if (modeSale) { m_saleFormIndex = this.ChildContainer.Controls.Count - 1; this.SuspendDrawing(); // hide Sale and show first form FormBase form = (FormBase)this.ChildContainer.Controls[m_saleFormIndex]; form.PerformDeactivated(); form.Visible = false; //Application.DoEvents(); // show first form form = (FormBase)this.ChildContainer.Controls[0]; form.PerformActivated(); form.Visible = true; ChildContainer.Size = form.ChildSize; FrameBaseData.Current.OnDataChanged(FrameBaseDataItem.ActiveTitle, form.Text); EnableMainMenu(!form.IsModal, !form.HideMainMenu); // show only menu mainMenu1.ModeSingleMenu = true; this.ResumeDrawing(); } // show menu mainMenu1.ShowMenu(menuKey); }
protected virtual FormBase ShowChildForm(FormBase form) { return(null); }
public virtual void OnChildFormClosed(FormBase form) { }
/// <summary> /// On ChildForm close, remove from list /// </summary> /// <param name="form"></param> public override void OnChildFormClosed(FormBase form) { this.SuspendDrawing(); #region 현재폼 닫기 try { form.PerformDeactivated(); } catch { } int idx = this.ChildContainer.Controls.IndexOf(form); if (idx >= 0) { this.ChildContainer.Controls.Remove(form); form.Dispose(); } else { var cs = this.ChildContainer.Controls.Find(form.Name, true); if (cs.Length > 0) { if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate() { this.ChildContainer.Controls.Remove(cs[0]); }); } else { this.ChildContainer.Controls.Remove(cs[0]); } form.Dispose(); } } #endregion bool enableMainMenu = true; bool showMainMenu = true; string activeTitle = string.Empty; FormBase lastForm = null; if (this.ChildContainer.Controls.Count > 0) { if (m_inSaleMode) { lastForm = (FormBase)this.ChildContainer.Controls[0]; } else { lastForm = (FormBase)this.ChildContainer.Controls[this.ChildContainer.Controls.Count - 1]; } lastForm.Visible = true; ChildContainer.Size = lastForm.ChildSize; enableMainMenu = !lastForm.IsModal; showMainMenu = !lastForm.HideMainMenu; activeTitle = lastForm.Text; } EnableMainMenu(enableMainMenu, showMainMenu); FrameBaseData.Current.OnDataChanged(FrameBaseDataItem.ActiveTitle, activeTitle); this.ResumeDrawing(); // activate form if (lastForm != null) { lastForm.PerformActivated(); } }