Пример #1
0
        public static IChatRecordChrome Create(ChatDesk desk)
        {
            IChatRecordChrome chrome = null;

            if (ChromeOperator.Connectable(desk.Hwnd.Handle))
            {
                chrome = new ChatRecordChrome(desk);
            }
            else
            {
                chrome = new ChatRecordChromeV2(desk);
            }
            return(chrome);
        }
Пример #2
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);
        }