Exemple #1
0
        internal static async void ExcuteMacro(WebBrowser web, string textData)
        {
            HMExtension hm  = new HMExtension(web);
            var         doc = hm.doc;

            var codeList = hm.parseCode(textData);

            if (codeList == null)
            {
                return;
            }

            while (codeList.Count > 0)
            {
                await hm.Navigate(new Uri("https://www.happymoney.co.kr/svc/cash/giftCardCharge.hm"));

                await Task.Delay(1000);

                HtmlUtils.DisableAlertPopup(web);

                // 결제비밀번호 사용안내 layer popup 종료
                var         closeButton  = hm.GetElementsClose();
                HtmlElement chargeButton = HtmlUtils.GetElementsByClass(doc, "input", "btn60 btn_4 btnCharge");

                // 결제 비밀번호 창 닫기
                hm.ClickButton(closeButton);
                await Task.Delay(300);

                if (codeList.Count > 5)
                {
                    hm.AddTen();
                    await Task.Delay(500);
                }

                var cpltCode = new List <HMCode>();
                await Task.Run(() =>
                               codeList.Take(10).ToList().ForEach(h =>
                {
                    var idx = codeList.IndexOf(h);
                    hm.DoInputCode(idx + 1, h).Wait();
                    cpltCode.Add(h);
                })
                               );

                cpltCode.ForEach(ch => codeList.Remove(ch));

                hm.ClickButton(chargeButton);

                await Task.Delay(2000);

                if (codeList.Count == 0)
                {
                    MessageBox.Show("GiftCharging is completed", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
 private void menuExcute_Click(object sender, EventArgs e)
 {
     switch (macroData.CodeType)
     {
     case GiftCodeType.HappyMoneyCash:
         HtmlUtils.DisableAlertPopup(web);
         HMExtension.ExcuteMacro(web, macroData.TextData);
         break;
     }
 }