Esempio n. 1
0
        static void Main()
        {
            HttpListener httpListenner;

            httpListenner = new HttpListener();
            httpListenner.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
            //操作系统:管理员运行cmd,执行netsh http add urlacl url=http://+:8080/ user=Everyone
            httpListenner.Prefixes.Add("http://+:" + Constants.heartPort + "/");
            httpListenner.Start();

            new Thread(new ThreadStart(delegate
            {
                try
                {
                    loop(httpListenner);
                }
                catch (Exception)
                {
                    //httpListenner.Stop();
                }
            })).Start();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //AuthWindow auth = new AuthWindow();
            //Application.Run(auth);
            //if (auth.isExitAll == false)
            //{

            //}
            BusWebFormE form = new BusWebFormE();

            //Test form = new Test();
            Application.Run(form);
        }
Esempio n. 2
0
        //发送消息
        public static bool succNotice(domain.Bill bill)
        {
            string     posData    = bill.ToString();
            HttpResult httpResult = postData(Constants.serverUrl + "/payIntf/terminal/receiveNoticeMsg", posData);
            string     jsonStr    = subResultHtml(httpResult.Html);

            Console.WriteLine(jsonStr);
            ServiceDataResult result = JSON.parse <ServiceDataResult>(jsonStr);

            if (result.code == "0")
            {
                BusWebFormE.log("发送消息成功: " + JSON.stringify(bill));
                //更新最后一条流水号
                BusWebFormE.serial = result.data;
                return(true);
            }
            else
            {
                lastError = result.msg;
                return(false);
            }

            //测试
            //Console.WriteLine("发送消息成功: " + JSON.stringify(bill));
            //BusWebFormE.serial = bill.Serial;
            //return true;
        }