Пример #1
0
            public static Dictionary <string, LoginedSeller> Update(Dictionary <string, LoginedSeller> sellers, out HashSet <string> closed)
            {
                closed = new HashSet <string>();
                var newNicks = new Dictionary <string, LoginedSeller>();

                foreach (var skv in sellers)
                {
                    if (!_cachedSellers.ContainsKey(skv.Key))
                    {
                        var chatDesk = ChatDesk.GetDeskFromCache(skv.Key);
                        if (chatDesk != null)
                        {
                            chatDesk.CheckAlive();
                            closed.Add(skv.Key);
                            Log.Error("Detected, 检测到异常的ChatDesk");
                        }
                        else
                        {
                            newNicks[skv.Key] = skv.Value;
                        }
                    }
                    QnHelper.Detected._sellerHistory[skv.Key] = DateTime.Now;
                }
                foreach (var oldNick in _cachedSellers)
                {
                    if (!sellers.ContainsKey(oldNick.Key))
                    {
                        closed.Add(oldNick.Key);
                    }
                }
                _cachedSellers = sellers;
                return(newNicks);
            }
Пример #2
0
 private static void SetOrSendShortcut(this ShortcutEntity shortcut, ChatDesk desk, bool isSend, bool focusEditor)
 {
     if (shortcut == null)
     {
         return;
     }
     if (string.IsNullOrEmpty(shortcut.ImageName))
     {
         if (isSend)
         {
             desk.Editor.SendPlainText(shortcut.Text);
             desk.Editor.FocusEditor(true);
         }
         else
         {
             desk.Editor.SetPlainText(shortcut.Text, true, focusEditor);
         }
     }
     else
     {
         ShortcutImageHelper.UseImage(shortcut.ImageName, image =>
         {
             if (isSend)
             {
                 desk.Editor.SendPlainTextAndImage(shortcut.Text, image);
                 desk.Editor.FocusEditor(true);
             }
             else
             {
                 desk.Editor.SetPlainTextAndImage(shortcut.Text, image, focusEditor);
             }
         });
     }
 }
Пример #3
0
        private static int GetExistChromeDevTools(ChatDesk desk)
        {
            int chromeDevHwnd = GetExistChromeDevTools(desk.AliappProcessId, 5);

            if (chromeDevHwnd == 0)
            {
                chromeDevHwnd = OpenNewChromeDevTools(desk);
            }
            return(chromeDevHwnd);
        }
Пример #4
0
 public WndAssist(ChatDesk desk)
 {
     _handle                     = 0;
     _hasOwner                   = false;
     IsWakeUp                    = false;
     _closingHwndBag             = new ConcurrentBag <int>();
     _unDealMessageTipDialogClue = new List <WinApi.WindowClue>
     {
         new WinApi.WindowClue(WinApi.ClsNameEnum.StandardWindow, null, 1),
         new WinApi.WindowClue(WinApi.ClsNameEnum.StandardButton, "确定", -1)
     };
     _prePopTime       = DateTime.MinValue;
     _closeDialogCount = 0;
     _popTooMany       = false;
     _isTracking       = false;
     _isFirstTrack     = true;
     _ratio            = null;
     IsShowRightPanel  = true;
     _preMouseDownTime = DateTime.MinValue;
     InitializeComponent();
     if (!DesignerProperties.GetIsInDesignMode(this))
     {
         try
         {
             try
             {
                 string text = "微软雅黑";
                 if (IsFontFamilyExist(text))
                 {
                     base.FontFamily = new System.Windows.Media.FontFamily(text);
                 }
             }
             catch (Exception e)
             {
                 Log.Exception(e);
             }
             FontSize = (double)Params.Other.FontSize;
             Desk     = desk;
             this.xHideToAltTab();
             Left   = 0.0;
             Top    = 0.0;
             Width  = SystemParameters.VirtualScreenWidth;
             Height = SystemParameters.WorkArea.Height;
             InitDeskEvent();
             Closed += WndAssist_Closed;
             HiddenControls();
             InitControls();
             Loaded += WndAssist_Loaded;
         }
         catch (Exception e2)
         {
             Log.Exception(e2);
         }
     }
 }
Пример #5
0
 public static void SetOrSendShortcutAsync(this ShortcutEntity shortcut, ChatDesk desk, bool isSend, bool focusEditor)
 {
     if (shortcut == null)
     {
         MsgBox.ShowErrTip("没有选中短语", null);
         return;
     }
     Task.Factory.StartNew(() =>
     {
         SetOrSendShortcut(shortcut, desk, isSend, focusEditor);
     });
 }
Пример #6
0
        public static void Close(string nick)
        {
            var desk = ChatDesk.GetDeskFromCache(nick);

            if (desk == null)
            {
                Log.Error("AssistModeHelper.Close,desk不存在,nick=" + nick);
            }
            else
            {
                desk.Dispose();
            }
        }
Пример #7
0
 public ChatRecordChrome(ChatDesk desk)
     : base(desk.Hwnd.Handle, "ocr_" + desk.Seller)
 {
     this._chatRecordChromeTitle = new HashSet <string>
     {
         "当前聊天窗口",
         "IMKIT.CLIENT.QIANNIU",
         "聊天窗口",
         "imkit.qianniu",
         "千牛聊天消息"
     };
     this._preListeningTime = DateTime.Now;
     this.Timer.AddAction(FetchRecordLoop, 300, 300);
 }
Пример #8
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);
 }
Пример #9
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);
        }
Пример #10
0
 public CtlShortcut(ChatDesk desk, RightPanel rp)
 {
     this._isDoubleClick          = false;
     this._doubleClickTime        = DateTime.MinValue;
     this._needInitTvSearch       = true;
     this._prvSearchMouseDownTime = DateTime.MinValue;
     this._pubSearchMouseDownTime = DateTime.MinValue;
     this.InitializeComponent();
     this._desk       = desk;
     this._rightPanel = rp;
     this._seller     = this._desk.Seller;
     this.SetContentVisible();
     this.InitTabControl(null, null, null);
     this.LoadDatas();
     this.SetTitleButtonsVisible();
     this.ShowTitleButtons();
 }
Пример #11
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);
     }
 }
Пример #12
0
        private static int OpenNewChromeDevTools(ChatDesk desk)
        {
            var debugHwnd = 0;

            AssertSingleChatChromeVisible(desk);
            if (!WinApi.BringTopAndDoAction(desk.Hwnd.Handle, () =>
            {
                var chatRecordChromeHwnd = desk.Automator.ChatRecordChromeHwnd;
                WinApi.ClickPointBySendMessage(chatRecordChromeHwnd, 5, 5);
                WinApi.PressF12();
                Thread.Sleep(100);
                OpenChromeDevTools(desk.AliappProcessId);
                debugHwnd = GetExistChromeDevTools(desk.AliappProcessId, 5);
                AssertSingleChatChrome(debugHwnd);
                HideChromeDebugWindow = debugHwnd > 0;
                HideChromeDevDebugWindow(debugHwnd);
            }, 5))
            {
                throw new Exception("Can't bring chat desk to top");
            }
            return(debugHwnd);
        }
Пример #13
0
        private static void Start(string nick, int delayMs)
        {
            if (delayMs > 0)
            {
                Thread.Sleep(delayMs);
            }
            var    loginedSeller = QnHelper.Detected.GetSellerFromCache(nick);
            string arg;
            var    desk = ChatDesk.Create(loginedSeller, nick, out arg);

            if (desk != null)
            {
                DispatcherEx.xInvoke(() =>
                {
                    WndAssist.CreateAndAttachToDesk(desk);
                });
                //写入登录数据
            }
            else
            {
                MsgBox.ShowErrDialog(string.Format("无法为{0}创建辅助面板,原因是{1}", nick, arg));
            }
        }
Пример #14
0
 public void Init(WndAssist wnd)
 {
     _desk   = wnd.Desk;
     _tipper = wnd.ctlBottomPanel.TheTipper;
     _wnd    = wnd;
 }
Пример #15
0
 public DeskSuggestion(ChatDesk desk)
 {
     _desk   = desk;
     _synobj = new object();
     _desk.Editor.EvEditorTextChanged += Editor_EvEditorTextChanged;
 }
Пример #16
0
 private void Init()
 {
     this._desk        = this._wnd.Desk;
     this.Seller       = this._desk.Seller;
     this.MenuQuestion = (ContextMenu)base.FindResource("menuQuestion");
 }
Пример #17
0
        private static void AssertSingleChatChromeVisible(ChatDesk desk)
        {
            int chatRecordChromeHwnd = desk.Automator.ChatRecordChromeHwnd;

            Util.Assert(WinApi.IsVisible(chatRecordChromeHwnd));
        }
Пример #18
0
        public static void CreateAndAttachToDesk(ChatDesk desk)
        {
            WndAssist wndAssist = new WndAssist(desk);

            wndAssist.AttachToDesk();
        }