static void Main(string[] args) { try { Application oApp = null; if (args.Length < 1) { oApp = new Application(); } else { oApp = new Application(args[0]); } //Using Utilities DIApplication.. DIApplication.DIConnect((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany()); Menu MyMenu = new Menu(); MyMenu.AddMenuItems(); oApp.RegisterMenuEventHandler(MyMenu.SBO_Application_MenuEvent); SetupService lObjSetupService = new SetupService(); lObjSetupService.InitializeTables(); EarringsRanks pObjEarringsRanks = new EarringsRanks(); Application.SBO_Application.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent); oApp.Run(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
protected override void OnStart(string[] args) { mBolProcessInProgress = false; mObjSetupService.InitializeTables(); // eventLog1.WriteEntry("In onStart."); var timer = new Timer { AutoReset = true, Interval = 900000 }; timer.Elapsed += timer_Elapsed; timer.Start(); }
static void Main(string[] pArrStrArgs) { try { LogService.Filename("FoodProduction"); LogService.WriteInfo("Inicio del addon 1.2.56"); Application lObjApplication = null; if (pArrStrArgs.Length < 1) { lObjApplication = new Application(); } else { lObjApplication = new Application(pArrStrArgs[0]); } //Prepare menu MenuManager lObjMenuManager = new MenuManager(); lObjMenuManager.Initialize(); //Prepare filters EventManager lObjEventManager = new EventManager(); UIApplication.GetApplication().SetFilter(lObjEventManager.GetItemEventFiltersByMenu(lObjMenuManager.Menu)); UIApplication.ShowSuccess(string.Format("Menu manager")); //Add menu events lObjApplication.RegisterMenuEventHandler(lObjMenuManager.GetApplicationMenuEvent); LogService.WriteSuccess("Registro del menú"); UIApplication.ShowSuccess(string.Format("Registro del menu")); //Add application events UIApplication.GetApplication().AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(GetApplicationAppEvent); DIApplication.DIConnect((SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany()); UIApplication.ShowSuccess(string.Format("DI Connect")); //Bascula ConnectRemoteAccess(); //Initialize Tables UIApplication.ShowSuccess(string.Format("Inicializar las tablas")); SetupService mObjSetupService; mObjSetupService = new SetupService(); mObjSetupService.InitializeTables(); UIApplication.ShowSuccess(string.Format("Addon Iniciado correctamente")); LogService.WriteSuccess("[AddOn FoodProduction 1.2.55 STARTED]"); //Ticket instance = (Ticket)Activator.CreateInstance(typeof(Ticket)); //Init application lObjApplication.Run(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); LogService.WriteError("[ERROR]" + ex.Message); } }