Advertisement
Guest User

item event

a guest
Apr 5th, 2012
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.18 KB | None | 0 0
  1.  private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
  2.         {
  3.             BubbleEvent = true;
  4.             _form = _sboApplication.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
  5.             try
  6.             {
  7.                 if (pVal.FormType == 134 && pVal.FormTypeEx == "134") //Business Partner Master Data
  8.                 {
  9.  
  10.                     //write log
  11.                     _count++;
  12.                     _log.Add("(" + _count.ToString() + ") event: " + pVal.EventType.ToString() + " - before action: " + pVal.BeforeAction + " - ItemUID: " + pVal.ItemUID);
  13.  
  14.                     if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_COMBO_SELECT && false) //used to check id of the combo box item
  15.                     {
  16.                         string id = pVal.ItemUID;
  17.                     }
  18.  
  19.                     if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD && pVal.ActionSuccess)
  20.                     {
  21.                         _formLoaded = true;
  22.                     }
  23.  
  24.                     if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_GOT_FOCUS && pVal.ActionSuccess)
  25.                     {
  26.                         _hasFocus = true;
  27.                     }
  28.  
  29.                     if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE && pVal.ActionSuccess)
  30.                     {
  31.                         _isActive = true;
  32.                     }
  33.  
  34.                     _form = _sboApplication.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
  35.  
  36.                    
  37.                     if (_formLoaded && _hasFocus && _isActive)
  38.                     {
  39.                         // get the event sending form
  40.                         FormLoad();
  41.                         _hasFocus = false;
  42.                         //_isActive = false;
  43.                     }
  44.                     else if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED && !pVal.Before_Action && pVal.ItemUID == "1")
  45.                     {
  46.                         add = true; //check if add business partner button has been pressed
  47.                     }
  48.  
  49.                     else if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_CLOSE && !pVal.Before_Action)
  50.                     {
  51.                         if (!add)
  52.                         {
  53.                             //if not, adding has been canceled -> try to return new code
  54.                             bool rolledBack = NumberPool.TryRollbackNumber("BUSPARTNER", newCode);
  55.                         }
  56.  
  57.  
  58.                         //WriteLog();
  59.                     }
  60.                     else if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD)
  61.                     {
  62.                         try
  63.                         {
  64.  
  65.                         }
  66.                         catch (Exception ex) //trying to catch an exception that is only displayed in SBO but not in VS
  67.                         {
  68.                             Console.WriteLine("BusinessPartnerView.SBO_Application_ItemEvent() form unload Error:");
  69.                             Console.WriteLine(ex.Message);
  70.                         }
  71.  
  72.                     }
  73.                 }
  74.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement