コード例 #1
0
ファイル: FrmMain.cs プロジェクト: radtek/EUGV2
        private void button3_Click(object sender, EventArgs e)
        {
            VoiceService service = Service.Factory.ServicesFactory.GetInstance().GetVoicService();

            service.BroadcastOnce("习近平表示,尊敬的菲德尔同志,很高兴再次同你见面。2011年我访问古巴时拜访了你,我们进行了长时间交谈。今天看到你精神矍铄,我感到十分欣慰");
        }
コード例 #2
0
        //取件时点击确定后的事件实现
        private void inputPwdPanel1_confirmEvent(object sender, EventArgs e)
        {
            //验证密码
            string password = inputPwdPanel1.getPwd().Trim();

            //校验不能为空
            if (password.Equals(""))
            {
                inputPwdPanel1.errorMessage("密码不能为空");
            }
            else
            {
                ServerCallback callback = serverService.RceiverLogin(password, this.about);
                if (callback.Success)
                {
                    bool issuccess = cameraService.TakePicture();
                    CLog4net.LogInfo("拍照是否成功:" + issuccess.ToString());
                    int tempcode = 0;
                    try
                    {
                        tempcode = Convert.ToInt32(callback.BoxCode);
                    }
                    catch (Exception err)
                    {
                        CLog4net.LogError("inputPwdPanel1_confirmEvent callback.BoxCode" + callback.BoxCode + " " + err);
                    }

                    //开箱
                    Box box = boxsManager.Find(tempcode);
                    if (box.Open())
                    {
                        boxsManager.ClearBox(tempcode);
                        //柜子地址
                        courierNum = box.CoordinateInfo.X.ToString() + box.CoordinateInfo.Y.ToString();
                        //跳转下一页
                        NavGetPackageSuccessState();
                        //设置信息
                        getPackageSuccess1.setInfo(courierNum);
                        string s = String.Format("取件成功,您的包裹在{0}号箱,请关闭柜门,谢谢", courierNum);
                        voiceService.BroadcastOnce(s);
                        CLog4net.LogInfo("取件成功");

                        Package package = packageManager.TakePackage(callback);
                        if (package != null)
                        {
                            //拍照
                            tempPackage = package;

                            if (package.Place.Code != box.Code)
                            {
                                CLog4net.LogError("服务器与客户端查询箱子不一致,服务器boxcode:" + callback.BoxCode + " 客户端boxcode:" + package.Place.Code + " 快递号:" + package.SN);
                            }
                        }
                        else
                        {
                            CLog4net.LogInfo("服务器与客户端查询箱子不一致:" + callback.BoxCode);
                        }
                    }
                    else
                    {
                        voiceService.BroadcastOnce("开柜失败");
                        returnSuccess1.errorMessage("如果储物柜无法打开,请联系管理员");
                        CLog4net.LogInfo("如果储物柜无法打开,请联系管理员:" + tempcode);
                    }
                }
                else
                {
                    if (callback.Message == null)
                    {
                        inputPwdPanel1.errorMessage("网络或者服务器连接失败");
                        voiceService.BroadcastOnce("网络或者服务器连接失败");
                        CLog4net.LogInfo("网络或者服务器连接异常");
                    }
                    else
                    {
                        if (callback.Message != "")
                        {
                            inputPwdPanel1.errorMessage(callback.Message);
                            voiceService.BroadcastOnce(callback.Message);
                            CLog4net.LogInfo(callback.Message);
                        }
                        else
                        {
                            inputPwdPanel1.errorMessage("取件密码错误");
                            voiceService.BroadcastOnce("密码错误");
                            CLog4net.LogInfo("取件密码错误");
                        }
                    }
                }
            }
        }