예제 #1
0
        //Send reservation link
        private void SendReservationLink(IntPtr wechatMainHandler, RECT rct, WechatMessage vballMessage)
        {
            try
            {
                //Bring wechat to front
                SetForegroundWindow(wechatMainHandler);
                //Click on favorates tab
                DoMouseClick(rct, 20, 190);
                Thread.Sleep(HALF_SND);
                DoMouseClick(rct, 80, 150);
                Thread.Sleep(HALF_SND);
                //Right click on the first favorate
                DoMouseRightClick(rct, 400, 110);
                Thread.Sleep(ONE_SND);
                //Select forward
                DoMouseClick(rct, 450, 150);
                Thread.Sleep(HALF_SND);
                //Thread.Sleep(WAIT);
                IntPtr selectContactWndHandler = FindWindow("SelectContactWnd", "WeChat");

                // If found, position it.
                if (selectContactWndHandler == IntPtr.Zero)
                {
                    return;
                }
                //Copy chat name or group into clipboard
                Clipboard.SetText(vballMessage.WechatName);
                SendKeys.SendWait("^{v}");
                Thread.Sleep(HALF_SND);
                //Detect the SelectContactWnd location
                RECT rect = new RECT();
                GetWindowRect(selectContactWndHandler, ref rect);
                //Select the first on the list
                Thread.Sleep(HALF_SND);
                DoMouseClick(rect, 35, 80);
                //Click Ok button
                Thread.Sleep(ONE_SND);
                DoMouseClick(rect, 420, 450);
                //Click Cancel button in case of failure
                Thread.Sleep(HALF_SND);
                DoMouseClick(rect, 420, 490);
                Thread.Sleep(HALF_SND);
            }
            catch (Exception ex)
            {
                this.LogTb.Text     = this.LogTb.Text + "\r\n" + DateTime.Now.ToString() + " " + ex.Message;
                this.MessageLb.Text = ex.Message;
            }
        }
예제 #2
0
        private WechatMessage[] QueryActivityMessages()
        {
            ActivityWebservice.ActivityWebServiceSoapClient client = new ActivityWebservice.ActivityWebServiceSoapClient();
            List <WechatMessage> wechatMessages = new List <WechatMessage>();

            foreach (ActivityWebservice.WechatMessage wechatMessage in client.WechatMessages())
            {
                WechatMessage theWechatMessage = new WechatMessage();
                theWechatMessage.At         = wechatMessage.At;
                theWechatMessage.Date       = wechatMessage.Date;
                theWechatMessage.Message    = wechatMessage.Message;
                theWechatMessage.Name       = wechatMessage.Name;
                theWechatMessage.WechatName = wechatMessage.WechatName;
                wechatMessages.Add(theWechatMessage);
            }
            return(wechatMessages.ToArray());
        }
예제 #3
0
        private WechatMessage[] QueryVballMessages()
        {
            VballManagerWebservice.VballWebServiceSoapClient client = new VballManagerWebservice.VballWebServiceSoapClient();
            List <WechatMessage> wechatMessages = new List <WechatMessage>();

            VballManagerWebservice.WechatMessage[] receivdMesseages = client.WechatMessages();
            foreach (VballManagerWebservice.WechatMessage wechatMessage in receivdMesseages)
            {
                WechatMessage theWechatMessage = new WechatMessage();
                theWechatMessage.At         = wechatMessage.At;
                theWechatMessage.Date       = wechatMessage.Date;
                theWechatMessage.Message    = wechatMessage.Message;
                theWechatMessage.Name       = wechatMessage.Name;
                theWechatMessage.WechatName = wechatMessage.WechatName;
                wechatMessages.Add(theWechatMessage);
            }
            return(wechatMessages.ToArray());
        }
예제 #4
0
        private void SendMessage(IntPtr wechatMainHandler, RECT rct, WechatMessage vballMessage)
        {
            try
            {
                //Bring wechat to front
                SetForegroundWindow(wechatMainHandler);
                //Click on message tab
                DoMouseClick(rct, 20, 90);
                Thread.Sleep(HALF_SND);
                //Click on clean search field
                DoMouseClick(rct, 243, 35);
                //Click on search
                DoMouseClick(rct, 100, 35);
                //Thread.Sleep(WAIT);
                //Copy chat name or group into clipboard
                Clipboard.SetText(vballMessage.WechatName);
                SendKeys.SendWait("^{v}");
                Thread.Sleep(ONE_SND);
                //Check to see if chat name or group found

                /*if (NoMatchChat(rct))
                 * {
                 *  continue;
                 * }*/
                //Thread.Sleep(WAIT);
                //Click on first match one
                DoMouseClick(rct, 80, 120);
                Thread.Sleep(ONE_SND);
                //Check if wechat search window pops up
                if (GetForegroundWindow() != wechatMainHandler)
                {
                    return;
                }
                //Check to see if message contains {ENTER}
                Thread.Sleep(HALF_SND);
                if (!String.IsNullOrEmpty(vballMessage.At))
                {
                    SendKeys.SendWait("@" + vballMessage.At);
                    Thread.Sleep(HALF_SND);
                    SendKeys.SendWait(ENTER);
                }
                if (String.IsNullOrEmpty(vballMessage.Name))
                {
                    Clipboard.SetText(vballMessage.Message);
                }
                else
                {
                    Clipboard.SetText("Hi, " + vballMessage.Name + ". " + vballMessage.Message);
                }
                Thread.Sleep(HALF_SND);
                SendKeys.SendWait("^{v}");
                Thread.Sleep(HALF_SND);
                SendKeys.SendWait(ENTER);
                Thread.Sleep(HALF_SND);
            }
            catch (Exception ex)
            {
                this.LogTb.Text = this.LogTb.Text + "\r\n" + DateTime.Now.ToString() + " " + ex.Message;
                //this.MessageLb.Text = ex.Message;
            }
        }