Exemple #1
0
 public LoopSaveFile(string fn, int maxFileByte, bool saveLogByDay)
 {
     this.FileName       = fn;
     this._limitFileSize = maxFileByte;
     this._saveLogByDay  = saveLogByDay;
     this.KeepFileSizeOrBackupFileByDay();
     this._timer = new NoReEnterTimer(WriteLoop, 1000, 0);
 }
Exemple #2
0
 public static void LoopSyn()
 {
     if (_timer == null)
     {
         _timer = new NoReEnterTimer(() =>
         {
             if (_preSynTime.xIsTimeElapseMoreThanMs((int)(_autoSynInterval * 0.6)))
             {
                 _preSynTime = DateTime.Now;
                 Syn(false, false, false);
             }
         }, _autoSynInterval / 2, 500);
     }
 }
Exemple #3
0
 public TaskWindowBuyerNameReader(ChatDesk chatDesk)
 {
     _isTest           = false;
     _isFrozenDetected = false;
     _preFetchTime     = DateTime.MinValue;
     _getGuestNameImageB64CacheTime = DateTime.MinValue;
     _bmpB64_buyerNameDict          = new Cache <string, string>(150, 0, null);
     _getTaskWindowSuccessOnce      = false;
     _getTaskWindowFailCount        = 0;
     _taskBuyerPt = "(?<=^benchwebctrl:.*_bench_CQNLightTaskBiz_qtask_create_).*";
     _desk        = chatDesk;
     _timer       = new NoReEnterTimer(Loop, 500, 1000);
     _frozenCache = new Cache <string, HashSet <string> >(50, 0, null);
 }
Exemple #4
0
 protected ChromeConnector(int hwnd, string logMark)
 {
     this._isDisposed = false;
     this._evslim     = new ManualResetEventSlim(false);
     this._isChromeOk = false;
     this._logMark    = "Ocr";
     this._continuousInitSessionCount = 0;
     this._logMark = logMark;
     this.ClearStateValues();
     this._hwnd  = hwnd;
     this._siUrl = ChromeOperator.GetSessionInfoUrl(hwnd);
     Task.Factory.StartNew(new Action(this.ListenService));
     this.Timer = new NoReEnterTimer(this.ReconnectLoop, 2000, 1000);
 }
Exemple #5
0
 public ChatRecordChromeV2(ChatDesk desk)
 {
     try
     {
         _latestRecieveMsgTime = DateTime.MinValue;
         _unloadTime           = DateTime.MinValue;
         _preIsConnected       = false;
         _preTryConnectTime    = DateTime.MinValue;
         _preOpenChromeDevTime = DateTime.Now;
         _desk    = desk;
         _httpSvr = MyHttpServer.HttpSvrInst;
         _httpSvr.Start();
         _httpSvr.OnRecieveMessage += httpSvr_OnRecieveMessage;
         Timer = new NoReEnterTimer(Loop, 1000, 500);
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
Exemple #6
0
 public static void LoopScan()
 {
     _timer = new NoReEnterTimer(Loop, 1000, 0);
 }
Exemple #7
0
        private ChatDesk(LoginedSeller loginedSeller, string seller)
        {
            _isBuyerRegionVisibleCacheTime          = DateTime.MinValue;
            _foregroundChangedTime                  = DateTime.MaxValue;
            _isSingleChatcloseButtonEnableCacheTime = DateTime.MinValue;
            _assistWindow               = null;
            _isGroupChatCheckTime       = DateTime.MinValue;
            _isGroupChat                = null;
            _isEvShowFinished           = true;
            _isEvHideFinished           = true;
            _preLogGroupChatNullTime    = DateTime.MinValue;
            _logGroupChatNullCount      = 0;
            _getVisiblePercentCacheTime = DateTime.MinValue;
            _getVisiblePercentCache     = 0.0;
            _isForeground               = false;
            _isVisible = true;
            _synObj    = new object();
            _preCheckCloseBuyerTime = DateTime.MinValue;
            _sameBuyerCount         = 0;
            preUpdateRectAndWindowStateIfNeedTime = DateTime.MinValue;
            _preCheckForegroundWindowTime         = DateTime.MinValue;
            _preUpdateLocationTime = DateTime.MinValue;
            _isEditorTextChanged   = false;
            _isLocationChanged     = false;
            _isAlive = true;
            Log.Info("Begin Create ChatDesk,seller=" + seller);
            Hwnd   = new HwndInfo(loginedSeller.SellerHwnd, "ChatDesk");
            Seller = seller;
            _args  = new ChatDeskEventArgs
            {
                Desk = this
            };
            Automator        = ChatDeskAutomatorFactory.Create(Hwnd, Seller);
            chatRecordChrome = ChromeDebugerCreator.Create(this);
            //chatRecordChrome.EvChromeConnected += chatRecordChrome_EvChromeConnected;
            //chatRecordChrome.EvChromeDetached += chatRecordChrome_EvChromeDetached;
            //chatRecordChrome.EvRecieveNewMessage += chatRecordChrome_EvRecieveNewMessage;
            //chatRecordChrome.EvBuyerSwitched += Contact_EvBuyerSwitched;

            //_buyerReader = new TaskWindowBuyerNameReader(this);
            //_buyerReader.EvBuyerChanged += Contact_EvBuyerChanged;

            _buyerReader = new BuyerInfoWindowNameReader(this);
            _buyerReader.EvBuyerSwitched += Contact_EvBuyerSwitched;

            Editor      = new DeskEditor(Automator.SingleChatEditorHwnd, this);
            _qnThreadId = WinApi.GetWindowThreadProcessId(loginedSeller.SellerHwnd, out _processId);

            EnterpriseHwnd                      = new HwndInfo(loginedSeller.EpHwnd, "EnterpriseRootDesk");
            _winEventHooker                     = new WinEventHooker(_qnThreadId, loginedSeller.SellerHwnd);
            _winEventHooker.EvFocused          += WinEventHooker_EvFocused;
            _winEventHooker.EvLocationChanged  += WinEventHooker_EvLocationChanged;
            _winEventHooker.EvTextChanged      += WinEventHooker_EvTextChanged;
            WinEventHooker.EvForegroundChanged += WinEventHooker_EvForegroundChanged;
            IsForeground = WinApi.IsForeground(Hwnd.Handle);
            IsVisible    = WinApi.IsVisible(Hwnd.Handle);
            UpdateRectAndWindowState();
            _timer       = new NoReEnterTimer(Loop, 100, 0);
            _sugguestion = new DeskSuggestion(this);
            DeskSet      = new HashSet <ChatDesk>(DeskSet)
            {
                this
            };
            Log.Info("ChatDesk Created.seller=" + seller);
        }
Exemple #8
0
 static BatTime()
 {
     _timer = new NoReEnterTimer(new Action(Loop), 3000, 0);
 }
Exemple #9
0
 static WndAssist()
 {
     AssistBag = new ConcurrentBag <WndAssist>();
     _preKeepMultiWndAssitZOrderRightIfNeedTime = DateTime.MinValue;
     _timer = new NoReEnterTimer(LoopForTrack, 1500, 0);
 }