/// <summary> /// Adicionar uma Formulário de Sistema a lista de formulário ouvintes /// </summary> /// <param name="pForm">Um Formulário</param> public void AddFormWath(FormSystem pForm) { //if ( pForm.FormBind == null ) //{ // if ( !Forms.Exists( // p => ( p.FormType == pForm.FormType ) ) ) // Forms.Add( pForm ); //} //else if ( !Forms.Exists( // p => ( p.FormBind.TypeEx == pForm.FormBind.TypeEx || p.FormBind.Type == p.FormBind.Type ) ) ) //{ Forms.Add(pForm); //} }
/// <summary> /// Adicionar uma Formulário de Sistema a lista de formulário já abertos /// </summary> /// <param name="pForm">Um Formulário</param> public void AddFormOpen(FormSystem pForm) { FormOpens.Add(pForm); }
/// <summary> /// Método que é excutado quando evento do SAP é disparado /// </summary> /// <param name="FormUID">ID do Formuário</param> /// <param name="pVal">Argumentos do Evento</param> /// <param name="BubbleEvent">Propagar a continuação desse evento</param> void SAPApp_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; try { var formType = pVal.FormType; var formTypeEx = pVal.FormTypeEx; var formTypeCount = pVal.FormTypeCount; if (FormSystemModal != null) { if ((pVal.FormType != FormSystemModal.Type || pVal.FormTypeEx != FormSystemModal.TypeEx)) { FormSystemModal.Select(); BubbleEvent = false; return; } } if (formType != 0 && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD && pVal.Before_Action) { var form = Forms.FirstOrDefault(f => (f.Type == formType)); if (form != null) { var newForm = form.Assemlbly.CreateInstance(form.ToString()) as FormSystem; newForm.SetFormBind(ApplicationSAP.GetInstance().SAPApp.Forms.GetFormByTypeAndCount(formType, formTypeCount) as SAPbouiCOM.Form); newForm.GetEvents(); FormOpens.Add(newForm); } } var formOpen = FormOpens.FirstOrDefault( f => ((f.Type == formType || f.TypeEx == formTypeEx) && f.TypeCount == formTypeCount)); if (formOpen == null) { formOpen = FormOpens.FirstOrDefault(f => (f.Type == formType && f.NeverRemove)); } if (formOpen != null) { try { formOpen.DoEvent(ref pVal, out BubbleEvent); } catch (Exception ex) { BubbleEvent = false; Application.GetInstance().SetTextOnStatusBar(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD && !formOpen.NeverRemove) { FormOpens.Remove(formOpen); FormSystemModal = null; } } } catch (Exception ex) { Application.GetInstance().SetTextOnStatusBar(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } }