public bool OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey)
        {
            if (type == KeyType.KeyUp && Enum.IsDefined(typeof(Keys), windowsKeyCode))
            {
                var key = (Keys)windowsKeyCode;
                switch (key)
                {
                case Keys.F1:    //F1事件,打开钱箱
                    PublicUtil.openMoneyBox();
                    break;

                case Keys.F4:    //F4事件,释放内存
                    MainForm.ClearMemory();
                    break;

                case Keys.F5:    //F5事件,刷新
                    browser.Reload();
                    break;

                case Keys.F12:    //F12事件,调出开发者工具
                    browser.ShowDevTools();
                    break;
                }
            }
            return(false);
        }
示例#2
0
 /// <summary>
 /// 测试打开钱箱
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_test_Click(object sender, EventArgs e)
 {
     if (PublicUtil.openMoneyBox())
     {
         MessageBox.Show("钱箱打开中……");
     }
     else
     {
         MessageBox.Show("钱箱打开失败");
     }
 }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string     phone    = Request.Form["LoginInputPhone"].ToString();
        string     pass     = Request.Form["LoginInputPassword"].ToString();
        PublicUtil pt       = new PublicUtil();
        string     password = pt.GetMD5(pass);
        bool       isSucc   = checkLogin(phone, pass);

        if (isSucc)
        {
            Session["userId"] = phone;
            Response.Redirect("~/Default.aspx");
        }
        else
        {
            Response.Write("<script>alert('用户名或密码不正确')</script>");
            Response.Redirect("~/Default.aspx");
        }
    }
示例#4
0
        /// <summary>
        /// 测试led客显
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_LedCustomerDisplay_Click(object sender, EventArgs e)
        {
            string type = this.cmb_ledCustomerTestType.SelectedItem.ToString().Trim();

            LedCustomerDispiayType customerDispiayType = LedCustomerDispiayType.Clear;
            decimal showContent = 0.00M;

            if ("清屏".Equals(type))
            {
                showContent         = 0.00M;
                customerDispiayType = LedCustomerDispiayType.Clear;
            }
            if ("单价".Equals(type))
            {
                showContent         = 90.50M;
                customerDispiayType = LedCustomerDispiayType.Price;
            }
            if ("总计".Equals(type))
            {
                showContent         = 181.00M;
                customerDispiayType = LedCustomerDispiayType.Total;
            }
            if ("收款".Equals(type))
            {
                showContent         = 200.00M;
                customerDispiayType = LedCustomerDispiayType.Recive;
            }
            if ("找零".Equals(type))
            {
                showContent         = 19.00M;
                customerDispiayType = LedCustomerDispiayType.Change;
            }
            if (PublicUtil.ledCustomerShow(showContent, customerDispiayType))
            {
                MessageBox.Show("显示中……");
            }
            else
            {
                MessageBox.Show("显示失败");
            }
        }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string     phone         = Request.Form["registerInputPhone"].ToString();
        string     pass          = Request.Form["registerInputPassword"].ToString();
        string     pass1         = Request.Form["registerInputPassword1"].ToString();
        string     validationNum = Request.Form["validationNum"].ToString();
        PublicUtil pt            = new PublicUtil();

        if (!validationNum.Equals(Session["ValidationNum"]))
        {
            Response.Redirect("~/Default.aspx");
            Response.Write("<script>alert('验证码不正确')</script>");
            return;
        }
        else
        {
            if (!pass.Equals(pass1))
            {
                Response.Redirect("~/Default.aspx");
                Response.Write("<script>alert('两次密码不匹配')</script>");
                return;
            }
            else
            {
                string repassword = pt.GetMD5(pass);
                if (addUser(phone, repassword))
                {
                    saveIdByPhone(phone);
                    Session["userId"] = phone;
                    Response.Redirect("~/Default.aspx");
                }
                else
                {
                    Response.Redirect("~/Default.aspx");
                    Response.Write("<script>alert('该手机号已经注册')</script>");
                }
            }
        }
    }
示例#6
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                string ledCustomerPort                 = "";    //led客显端口
                string customerDisplayType             = "LED"; //客显类型
                string ledCustomerDisplaySpecification = "";    //客显型号
                string ledCustomerDisplayPortBaudRate  = "";    //led客显端口通信波特率
                string LedDataBits = "";                        //led客显数据位


                Config.CustomerDisplayType displayType;//客显类型
                if (this.rb_LCDCustomer.Checked)
                {
                    displayType         = Config.CustomerDisplayType.LCD液晶客显;
                    customerDisplayType = "LCD";
                }
                if (this.rb_LEDCustomer.Checked)
                {
                    displayType         = Config.CustomerDisplayType.LED客显;
                    customerDisplayType = "LED";
                    if (null == this.com_ledCustomerPort.SelectedItem)
                    {
                        MessageBox.Show("请设置LED客显端口");
                        return;
                    }
                    ledCustomerPort = this.com_ledCustomerPort.SelectedItem.ToString();//led客显端口
                    LedDataBits     = this.tb_LedDataBits.Text.Trim();
                    if (null == this.cmb_LedCustomerDisplaySpecification.SelectedItem)
                    {
                        MessageBox.Show("请选择客显型号");
                        return;
                    }
                    ledCustomerDisplaySpecification = this.cmb_LedCustomerDisplaySpecification.SelectedItem.ToString();//客显型号
                    try
                    {
                        ledCustomerDisplayPortBaudRate = this.com_LedBaudRate.SelectedItem.ToString().Trim();//led客显端口通信波特率
                    }
                    catch (Exception)
                    {
                        ledCustomerDisplayPortBaudRate = this.com_LedBaudRate.Text.Trim();//led客显端口通信波特率
                    }
                    if (ledCustomerDisplayPortBaudRate.Length == 0)
                    {
                        MessageBox.Show("请设置LED客显端口的通信波特率");
                        return;
                    }
                    if (LedDataBits.Length == 0)
                    {
                        MessageBox.Show("请设置LED客显数据位");
                        return;
                    }
                }
                string moneyBoxType = "2";//钱箱引脚数
                if (this.rb_2_line.Checked)
                {
                    moneyBoxType = "2";
                }
                else if (this.rb_5_line.Checked)
                {
                    moneyBoxType = "5";
                }
                string port = this.cmb_port.SelectedItem.ToString();

                if (PublicUtil.SetConfigValue(AppSettionsType.钱箱端口, port))
                {
                    PublicUtil.SetConfigValue(AppSettionsType.钱箱引脚类型, moneyBoxType);

                    PublicUtil.SetConfigValue(AppSettionsType.客显类型, customerDisplayType);
                    PublicUtil.SetConfigValue(AppSettionsType.LED客显端口, ledCustomerPort);
                    PublicUtil.SetConfigValue(AppSettionsType.LED客显端口通信波特率, ledCustomerDisplayPortBaudRate);
                    PublicUtil.SetConfigValue(AppSettionsType.LED客显数据位, LedDataBits);
                    PublicUtil.SetConfigValue(AppSettionsType.LED客显型号, ledCustomerDisplaySpecification);

                    MessageBox.Show("保存设置成功,软件重启后设置生效!");
                }
                else
                {
                    MessageBox.Show("保存设置失败");
                }
            }catch (Exception ex)
            {
                MessageBox.Show("保存设置出错");
            }
        }
示例#7
0
        /// <summary>
        /// 用于页面与后台互通操作
        /// </summary>
        /// <param name="data">数据</param>
        /// <param name="action">动作:print=打印,printSet=打印设置,printPreview=打印预览</param>
        public string cefQuery(string data, string action)
        {
            bool   ret     = true; //处理成功或失败状态
            string msg     = "";   //返回消息
            string retData = "";   //返回信息

            try
            {
                ActionType actionType = ActionType.直接打印;
                if ("print".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.直接打印;
                }
                if ("printSet".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.打印设置;
                }
                if ("printPreview".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.打印预览;
                }
                if ("secondScreen".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.第二显示器;
                }
                if ("exit".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.退出程序;
                }
                if ("openMoneyBox".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.打开钱箱;
                }

                #region 客显相关
                if ("checkCDPType".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.检测客显类型;
                }
                if ("LED_CDP_Clear".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.LED客显_清屏;
                }
                if ("LED_CDP_Price".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.LED客显_单价;
                }
                if ("LED_CDP_Total".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.LED客显_总计;
                }
                if ("LED_CDP_Recive".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.LED客显_收款;
                }
                if ("LED_CDP_Change".ToLower().Equals(action.ToLower().Trim()))
                {
                    actionType = ActionType.LED客显_找零;
                }
                #endregion

                switch (actionType)
                {
                case ActionType.第二显示器:    //用于第二显示器显示

                    //将数据转成html文件
                    data = HtmlTextConvertFile(data);

                    if (null != this.secodeScreenShowWindow)
                    {
                        data     = data.Replace("#", "%23");
                        filePath = data;
                        this.secodeScreenShowWindow.myBrowser.Navigate(data);
                    }
                    break;

                case ActionType.退出程序:    //用于关闭应用程序
                    if (null != this.mainWindow)
                    {
                        this.mainWindow.Exit();
                    }
                    break;

                case ActionType.打开钱箱:    //用于打开钱箱
                    PublicUtil.openMoneyBox();
                    break;

                    #region 客显相关
                case ActionType.检测客显类型:
                    string customerDisplayType = ConfigurationManager.AppSettings[AppSettionsType.客显类型];
                    retData = customerDisplayType;
                    break;

                case ActionType.LED客显_单价:
                    try
                    {
                        PublicUtil.ledCustomerShow(Convert.ToDecimal(data), LedCustomerDispiayType.Price);
                    }
                    catch {
                        ret = false;
                        msg = "请传入浮点型数据";
                    }
                    break;

                case ActionType.LED客显_总计:
                    try
                    {
                        PublicUtil.ledCustomerShow(Convert.ToDecimal(data), LedCustomerDispiayType.Total);
                    }
                    catch
                    {
                        ret = false;
                        msg = "请传入浮点型数据";
                    }
                    break;

                case ActionType.LED客显_收款:
                    try
                    {
                        PublicUtil.ledCustomerShow(Convert.ToDecimal(data), LedCustomerDispiayType.Recive);
                    }
                    catch
                    {
                        ret = false;
                        msg = "请传入浮点型数据";
                    }
                    break;

                case ActionType.LED客显_找零:
                    try
                    {
                        PublicUtil.ledCustomerShow(Convert.ToDecimal(data), LedCustomerDispiayType.Change);
                    }
                    catch
                    {
                        ret = false;
                        msg = "请传入浮点型数据";
                    }
                    break;

                case ActionType.LED客显_清屏:
                    try
                    {
                        PublicUtil.ledCustomerShow(0, LedCustomerDispiayType.Clear);
                    }
                    catch
                    {
                        ret = false;
                        msg = "请传入浮点型数据";
                    }
                    break;
                    #endregion

                default:
                    //将数据转成html文件
                    data = HtmlTextConvertFile(data);

                    this.window.Invoke((EventHandler) delegate
                    {
                        //设置预打印文件的路径,并执行对应的操作,data为打印文件路径
                        PrintUtil.Instance.SetPrintFilePath(data, actionType);
                    });
                    break;
                }
            }
            catch (Exception ex)
            {
                ret = false;
                msg = "请求发生异常,异常消息:" + ex.Message;
            }

            JObject retJob = new JObject();
            retJob.Add("ret", ret);
            retJob.Add("msg", msg);
            retJob.Add("data", retData);

            return(retJob.ToString());
        }