private void btnOK_Click(object sender, EventArgs e)
        {
            DeviceBLL devBll = new DeviceBLL();
            StaticData.Device.device_no = txtDevice_no.Text.Trim();
            devBll.setConfig(StaticData.Device);

            string xml = devBll.setDevice();
            try
            {
                string is_success = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/is_success").InnerText;
                if (is_success == "T")
                {
                    StaticData.Device.device_name = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/device_name").InnerText;
                    StaticData.Device.username = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/username").InnerText;
                    StaticData.Device.pname = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/pname").InnerText;

                    StringBuilder strB = new StringBuilder();
                    strB.Append("请确认这是你添加的设备:\n");
                    strB.Append("用户名:" + StaticData.Device.username + "\n");
                    strB.Append("商户名称:"+ StaticData.Device.pname +"\n");
                    strB.Append("设备名称:" + StaticData.Device.device_name + "\n");
                    strB.Append("确认后所有款项都将会进入此账户下.\n");

                    DialogResult result = MessageBox.Show(strB.ToString(), "信息确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (result == DialogResult.OK)
                    {
                        //确定按钮的方法
                        devBll.setConfig(StaticData.Device);
                        Application.Restart();
                    }
                    else
                    {
                        //取消按钮的方法
                    }
                }
                else
                {
                    string error_msg = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/error_msg").InnerText;
                    lblMsg.Text = error_msg;
                    lblMsg.Visible = true;
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = "异常:" + ex.Message;
                lblMsg.Visible = true;
            }
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ConfigBLL configBll = new ConfigBLL();
            CashierBLL cashierBll = new CashierBLL();
            DeviceBLL deviceBll = new DeviceBLL();

            string path = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Yunfu";

            //第一次启动
            if (!Directory.Exists(path))//不存在path路径
            {
                Directory.CreateDirectory(path);
            }
            if (!File.Exists(path + "\\Cashier.xml"))
            {
                StaticData.Cashier.cashier_id = "0";
                cashierBll.setConfig(StaticData.Cashier);
            }
            if (!File.Exists(path + "\\Device.xml"))
            {
                deviceBll.setConfig(StaticData.Device);
            }
            if (!File.Exists(path + "\\Config.xml"))
            {
                StaticData.Config.isPrint = "0";
                StaticData.Config.isVoice = "1";
                StaticData.Config.dualPrint = "1";
                StaticData.Config.userLptPrint = "0";
                StaticData.Config.LptName = "LPT1";
                StaticData.Config.printerName = new PrintDocument().PrinterSettings.PrinterName;
                configBll.setConfig(StaticData.Config);
            }    
               
            StaticData.Device = deviceBll.getConfig();
            StaticData.Config = configBll.getConfig();
            StaticData.Cashier = cashierBll.getConfig();

            AlipayBLL ab = new AlipayBLL();
            string xml = ab.verify();

            try
            {
                string is_success = XMLStrHelper.GetXmlNodeByXpath(xml,"Alipay/is_success").InnerText;
                if (is_success == "T")
                {
                    FormLogin frmLogin = new FormLogin();
                    frmLogin.ShowDialog();
                    if (frmLogin.DialogResult == DialogResult.OK)
                    {
                        Application.Run(new FormMain());
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
                else
                {
                    try
                    {
                        string error_msg = XMLStrHelper.GetXmlNodeByXpath(xml, "Alipay/error_msg").InnerText;
                        FormDevice frmDevice = new FormDevice(error_msg);
                        frmDevice.ShowDialog();
                    }
                    catch(Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowError("异常" + ex.Message);
            }
        }