/// <summary> /// Aciona evento no Form /// </summary> /// <param name="formId">Id do Form - Exemplos: 150 / 2000002001</param> /// <param name="eventType">Tipo do evento</param> public static void SetFormEvent(string formId, BoEventTypes eventType) { EventFilter filter; // Busca o evento na lista de eventos for (int i = 0; i < events.Count; i++) { filter = events.Item(i); if (filter.EventType == eventType) { try { filter.AddEx(formId); } catch { } SBOApp.Application.SetFilter(events); return; } } // Se não encontrar o evento, adiciona filter = events.Add(eventType); filter.AddEx(formId); SBOApp.Application.SetFilter(events); }
/// <summary> /// Initializes a new instance of the <see cref="HandlerAddedEventArgs" /> class. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="formType">Type of the form.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown when formType is null. /// </exception> public HandlerAddedEventArgs(BoEventTypes eventType, string formType) { if (formType == null) { throw new ArgumentNullException(nameof(formType)); } EventType = eventType; FormType = formType; }
/// <summary> /// Adds a new form tag to the forms tag with the given form type. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="formType">Type of the form.</param> public void AddFormTypeToEvent(BoEventTypes eventType, string formType) { var eventElement = FindEventElement(eventType); var formsElement = CreateOrGet(eventElement, "forms"); var formTypeElement = new XElement("form"); var formTypeAttribute = new XAttribute("form_id", formType); formTypeElement.Add(formTypeAttribute); formsElement.Add(formTypeElement); }
/// <summary> /// Includes the specified event type on the sending list. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="formType">Type of the form.</param> public static void Include(BoEventTypes eventType, string formType) { if (XmlFilter.IsEventTypeMissing(eventType)) { XmlFilter.AddEventType(eventType); } if (XmlFilter.IsFormTypeMissing(eventType, formType)) { XmlFilter.AddFormTypeToEvent(eventType, formType); SetEventSending(); } }
private void OApplication_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; if (pVal.FormType != 0) { BoEventTypes EventEnum = 0; EventEnum = pVal.EventType; oApplication.SetStatusBarMessage(string.Format( "Evento: {0} ,FormType{1}, FormId :{2}, Before : {3}, ItemUID :{4}" , EventEnum.ToString() , pVal.FormType.ToString() , FormUID , pVal.BeforeAction.ToString() , pVal.ItemUID )); } }
public ItemEventHandlerAttribute(string itemId, BoEventTypes eventType, bool beforeAction = false) { BeforeAction = beforeAction; ItemId = itemId; EventType = eventType; }
public ItemEventHandlerAttribute(BoEventTypes eventType, bool before = false) : this(string.Empty, eventType, before) { }
public SAPUI_DataEventAttribute(BoEventTypes boEventTypes) { this.boEventTypes = boEventTypes; }
/// <summary> /// Determines whether a form with the given type already exists. /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="formType">Type of the form.</param> /// <returns>True when a form with the type exists, false otherwise.</returns> public bool IsFormTypeMissing(BoEventTypes eventType, string formType) { var eventElement = FindEventElement(eventType); return(!eventElement.Descendants("form").Any(WithFormType(formType))); }
/// <summary> /// Adds a new event tag to the events tag with the given event type. /// </summary> /// <param name="eventType">Type of the event.</param> public void AddEventType(BoEventTypes eventType) { var events = xmlEventsStructure.Descendants("events").First(); events.Add(CreateEventOfType(eventType)); }
/// <summary> /// Checks if the attribute matches the given type. /// </summary> /// <param name="eventType">Type of the event.</param> /// <returns>True when it matches, false otherwise.</returns> private Func <XElement, bool> WithType(BoEventTypes eventType) { return(element => element.Attribute("type").Value == EventTypeAsString(eventType)); }
/// <summary> /// Finds the event element with the type attribute that matches <paramref name="eventType" />. /// </summary> /// <param name="eventType">Type of the event.</param> /// <returns>The <see cref="XElement" /> that represents the found event.</returns> private XElement FindEventElement(BoEventTypes eventType) { return(xmlEventsStructure.Descendants("event").First(WithType(eventType))); }
/// <summary> /// Converts the given event type to a string. /// </summary> /// <param name="eventType">Type of the event.</param> /// <returns>A string that represents the given event type.</returns> private string EventTypeAsString(BoEventTypes eventType) { return(((int)eventType).ToString()); }
/// <summary> /// Creates an event tag with the given type on the type attribute. /// </summary> /// <param name="eventType">Type of the event.</param> /// <returns>An <see cref="XElement" /> that represents the created tag.</returns> private XElement CreateEventOfType(BoEventTypes eventType) { var typeAttribute = new XAttribute("type", EventTypeAsString(eventType)); return(new XElement("event", typeAttribute)); }
/// <summary> /// Determines whether an event with the given type exists. /// </summary> /// <param name="eventType">Type of the event.</param> /// <returns>True when an event with the given type exists, false otherwise.</returns> public bool IsEventTypeMissing(BoEventTypes eventType) { var allEvents = xmlEventsStructure.Descendants("event"); return(!allEvents.Any(WithType(eventType))); }
public FormDataEventHandlerAttribute(BoEventTypes eventType, bool before = false) { Before = before; EventType = eventType; }
//recebe os eventos do SAP, para que sejam tratados, eh necessario //adicionar os filtros para os eventos no metodo Init() public virtual bool EventReceiver(string container, string componentID, bool before, ItemEvent pVal = null, IBusinessObjectInfo objectInfo = null) { bubbleEvent = true; try { log.pushOperation("EventReceiver"); BoEventTypes evnt = BoEventTypes.et_MENU_CLICK; if (pVal == null && objectInfo != null) { evnt = objectInfo.EventType; } else if (pVal != null) { evnt = pVal.EventType; } #region events switch (evnt) { case BoEventTypes.et_ALL_EVENTS: if (before) { bubbleEvent = beforeALL_EVENTS(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterALL_EVENTS(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_ITEM_PRESSED: if (before) { bubbleEvent = beforeITEM_PRESSED(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterITEM_PRESSED(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_KEY_DOWN: if (before) { bubbleEvent = beforeKEY_DOWN(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterKEY_DOWN(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_GOT_FOCUS: if (before) { bubbleEvent = beforeGOT_FOCUS(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterGOT_FOCUS(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_LOST_FOCUS: if (before) { bubbleEvent = beforeLOST_FOCUS(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterLOST_FOCUS(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_COMBO_SELECT: if (before) { bubbleEvent = beforeCOMBO_SELECT(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterCOMBO_SELECT(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_CLICK: if (before) { bubbleEvent = beforeCLICK(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterCLICK(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_DOUBLE_CLICK: if (before) { bubbleEvent = beforeDOUBLE_CLICK(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterDOUBLE_CLICK(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_MATRIX_LINK_PRESSED: if (before) { bubbleEvent = beforeMATRIX_LINK_PRESSED(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterMATRIX_LINK_PRESSED(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_MATRIX_COLLAPSE_PRESSED: if (before) { bubbleEvent = beforeMATRIX_COLLAPSE_PRESSED(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterMATRIX_COLLAPSE_PRESSED(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_VALIDATE: if (before) { bubbleEvent = beforeVALIDATE(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterVALIDATE(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_MATRIX_LOAD: if (before) { bubbleEvent = beforeMATRIX_LOAD(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterMATRIX_LOAD(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_DATASOURCE_LOAD: if (before) { bubbleEvent = beforeDATASOURCE_LOAD(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterDATASOURCE_LOAD(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_LOAD: if (before) { bubbleEvent = beforeFORM_LOAD(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_LOAD(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_UNLOAD: if (before) { bubbleEvent = beforeFORM_UNLOAD(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_UNLOAD(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_ACTIVATE: if (before) { bubbleEvent = beforeFORM_ACTIVATE(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_ACTIVATE(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_DEACTIVATE: if (before) { bubbleEvent = beforeFORM_DEACTIVATE(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_DEACTIVATE(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_CLOSE: if (before) { bubbleEvent = beforeFORM_CLOSE(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_CLOSE(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_RESIZE: if (before) { bubbleEvent = beforeFORM_RESIZE(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_RESIZE(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_KEY_DOWN: if (before) { bubbleEvent = beforeFORM_KEY_DOWN(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_KEY_DOWN(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_MENU_HILIGHT: if (before) { bubbleEvent = beforeFORM_MENU_HILIGHT(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_MENU_HILIGHT(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_PRINT: if (before) { bubbleEvent = beforePRINT(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterPRINT(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_PRINT_DATA: if (before) { bubbleEvent = beforePRINT_DATA(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterPRINT_DATA(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_EDIT_REPORT: if (before) { bubbleEvent = beforeEDIT_REPORT(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterEDIT_REPORT(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_CHOOSE_FROM_LIST: if (before) { bubbleEvent = beforeCHOOSE_FROM_LIST(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterCHOOSE_FROM_LIST(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_RIGHT_CLICK: if (before) { bubbleEvent = beforeRIGHT_CLICK(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterRIGHT_CLICK(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_MENU_CLICK: if (before) { bubbleEvent = beforeMENU_CLICK(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterMENU_CLICK(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_DATA_ADD: if (before) { bubbleEvent = beforeFORM_DATA_ADD(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_DATA_ADD(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_DATA_UPDATE: if (before) { bubbleEvent = beforeFORM_DATA_UPDATE(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_DATA_UPDATE(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_DATA_DELETE: if (before) { bubbleEvent = beforeFORM_DATA_DELETE(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_DATA_DELETE(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_FORM_DATA_LOAD: if (before) { bubbleEvent = beforeFORM_DATA_LOAD(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterFORM_DATA_LOAD(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_PICKER_CLICKED: if (before) { bubbleEvent = beforePICKER_CLICKED(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterPICKER_CLICKED(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_GRID_SORT: if (before) { bubbleEvent = beforeGRID_SORT(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterGRID_SORT(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_Drag: if (before) { bubbleEvent = beforeDrag(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterDrag(container, componentID, before, pVal, objectInfo); } break; case BoEventTypes.et_PRINT_LAYOUT_KEY: if (before) { bubbleEvent = beforePRINT_LAYOUT_KEY(container, componentID, before, pVal, objectInfo); } else { bubbleEvent = afterPRINT_LAYOUT_KEY(container, componentID, before, pVal, objectInfo); } break; } #endregion }catch (Exception e) { bubbleEvent = false; SB1ControlException.SB1ControlException.Save(e); } log.releaseOperation(); return(bubbleEvent); }