Example #1
0
        static void Main(string[] Args)
        {
            // Se não foi passado nenhum argumento à aplicação, esta é finalizada
            if (Args.Length.Equals(0))
            {
                MessageBox.Show("O aplicativo deve ser iniciado dentro do SAP Business One Client.", "Add-On Default",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                Application.Exit(); //exit   teste

                return;
            }
            //

            // Nova instância do controlador
            SBOApp sboApp = new SBOApp(Args[0], Application.StartupPath + "\\View.dll");

            sboApp.InitializeApplication();

            CreateMenu();

            EventFilterController.SetDefaultEvents();

            // Gera nova instância do AppListener para realizar o gerenciamento de memória do aplicativo
            // O gerenciamento é feito em background através de uma nova thread
            ListenerController oListener = new ListenerController();

            System.Threading.Thread oThread = new System.Threading.Thread(new System.Threading.ThreadStart(oListener.startListener));
            oThread.IsBackground = true;
            oThread.Start();

            Application.Run();
        }
Example #2
0
        void PrintListenerStatus()
        {
            StringBuilder str     = new StringBuilder();
            var           modules = ModuleDatas.OfType <ListenerModuleData>();

            foreach (var data in modules)
            {
                ListenerController controller = (ListenerController)data.Controller;
                var listener = controller.Listener;
                str.Append(listener.Topic).Append(listener.Subscribed ? " (On): " : " (Off): ")
                .Append(listener.NumPublishers).Append(" publishers").AppendLine();
            }

            Logger.Info(str.ToString());
        }