Esempio n. 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;
            }
        }
Esempio n. 2
0
        public static void Stop()
        {
            if (ms_IsServerRunning)
            {
                //Stop TaskTransmissionManager
                m_ttm.Stop();

                //Stop TaskManager
                m_tms.Stop();

                ms_IsServerRunning = false;
            }

            //clear log!
            LogDatabaseManager.ClearLogByDate(DateTime.Now.AddDays(-1 * ms_LogReservedDay));
        }
Esempio n. 3
0
 /// <summary>
 /// 将VBALog中的日志写入数据库, 只在服务器端执行
 /// </summary>
 public virtual void DoDBLogging()
 {
     //保存log到数据库
     LogDatabaseManager.WriteVBALogIntoDB(m_domainGUID, m_taskchainGUID, this.Name, GetLogger());
 }