Beispiel #1
0
        public static void Init(FrmMain uiform)
        {
            //Init Thread Name
            Thread.CurrentThread.Name = "UI";

            //Init WebBrowser Pool
            CWBPool.Init(uiform);

            //Init PerformanceBalancer
            PerformanceBalancer.Init(false);

            //Init FetionTimer
            uiform.timerMain.Enabled = true;

            //Init TaskManager & TaskTransmissionManager
            ms_FetionSendingTime = new Dictionary <int, bool>();
            for (int i = 0; i < 24; i++)
            {
                ms_FetionSendingTime.Add(i, false);
            }
            LoadManagerFromFile(uiform);
            m_tms.TaskTransmissionManager = m_ttm;
            m_ttm.TaskManagerServer       = m_tms;

            //open tcp server
            try
            {
                ConnectionManagerServer.RegisterTcpChannel(ms_socketport);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + Environment.NewLine + "请重新配置端口号", "注册端口错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                log.Error("注册端口错误: ", e);
            }

            //Test Log DB
            string errmessage = null;

            if (LogDatabaseManager.TestConnection(ref errmessage) == false)
            {
                MessageBox.Show(errmessage, "日志数据库", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //Start Tcp Service
            string errormessage = null;

            if (!ConnectionManagerServer.StartTcpServer(m_ttm, ref errormessage))
            {
                MessageBox.Show(errormessage, "启动服务错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
        public static void Init(FrmMain uiform)
        {
            Thread.CurrentThread.Name = "UI";
            ms_ui = uiform;

            //Init PerformanceBalancer
            PerformanceBalancer.Init(true);

            //Init Web Browser Warehouse
            log.Info("Init Web Browser Pool...");
            CWBPool.Init(ms_ui);

            //Init Channel
            RegisterTcpChannelForClient();

            //Init TaskManager & TaskTransmissionManager
            LoadManagerFromFile(uiform);
        }
        public static void Dispose(FrmMain uiform)
        {
            if (ms_IsClientRunning)
            {
                Stop();
            }

            Thread.Sleep(500);

            ConnectionManagerClient.UnregisterChannel();

            StoreManagerIntoFile(uiform);

            ms_tmc.Dispose();

            //Static Manager Disposing...
            VBAStaticEngine.DisposeAll();
            CWBPool.Dispose();
            PerformanceBalancer.Dispose();
        }
Beispiel #4
0
        public static void Dispose(FrmMain uiform)
        {
            if (ms_IsServerRunning)
            {
                Stop();
            }

            Thread.Sleep(500);

            //Stop Tcp Service
            ConnectionManagerServer.StopServer();

            ConnectionManagerServer.UnregisterChannel();

            StoreManagerIntoFile(uiform);

            m_tms.Dispose();
            m_ttm.Dispose();

            //Static Manager Disposing...
            VBAStaticEngine.DisposeAll();
            CWBPool.Dispose();
            PerformanceBalancer.Dispose();
        }