黄学彪
2020-03-23 cc0d80c7d86c6d0167269b3408c4b30c24ce84e9
ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePswAddContactForm.cs
@@ -42,6 +42,21 @@
            btnIcon.InitControl();
            btnIcon.ButtonClickEvent += ((sender, e) =>
            {
                Contacts.ContactAction = (phoneName, phoneNum) =>
                {
                    if (string.IsNullOrEmpty(phoneName) == true)
                    {
                        return;
                    }
                    //手机号检测
                    if (this.CheckPhoneNumber("86", phoneNum, phoneName) == false)
                    {
                        return;
                    }
                    //保存联系人
                    this.SaveCoercePhoneNumber("86", phoneNum, phoneName);
                };
                Contacts.Open();
            });
            //初始化中部信息
@@ -69,15 +84,16 @@
            btnArea.TextAlignment = TextAlignment.Center;
            btnArea.TextColor = UserCenterColor.Current.TextGrayColor1;
            frameBack.AddChidren(btnArea);
            btnArea.ButtonClickEvent += (sender, e) =>
            {
                var form = new AreaCodeSelectForm();
                form.AddForm();
                form.FinishSelectEvent += (code) =>
                {
                    btnArea.Text = "+" + code;
                };
            };
            //目前只针对+86
            //btnArea.ButtonClickEvent += (sender, e) =>
            //{
            //    var form = new AreaCodeSelectForm();
            //    form.AddForm();
            //    form.FinishSelectEvent += (code) =>
            //    {
            //        btnArea.Text = "+" + code;
            //    };
            //};
            //电话输入框
            var txtPhone = new TextInputControl(Application.GetRealWidth(634), btnArea.Height, false);
            txtPhone.X = btnArea.Right + Application.GetRealWidth(35);
@@ -101,12 +117,14 @@
            btnLine.Y = Application.GetRealHeight(150);
            btnLine.Gravity = Gravity.CenterHorizontal;
            frameBack.AddChidren(btnLine);
            //联动线的状态
            txtPhone.btnLine = btnLine;
            //备注
            var txtNote = new TextInputControl(Application.GetRealWidth(740), txtPhone.Height, false);
            txtNote.X = ControlCommonResourse.XXLeft;
            txtNote.Y = btnLine.Bottom + Application.GetRealHeight(60);
            txtNote.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup);
            txtNote.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPlesaeInputNoteInformation);
            frameBack.AddChidren(txtNote);
            //取消图标
            var btnCancel2 = new MostRightIconControl(69, 69);
@@ -153,13 +171,16 @@
        /// </summary>
        /// <param name="areaCode"></param>
        /// <param name="phoneNum"></param>
        /// <param name="strNote"></param>
        private async void SaveCoercePhoneNumber(string areaCode, string phoneNum, string strNote)
        {
            Dictionary<string, string> dicPhone = new Dictionary<string, string>();
            dicPhone[phoneNum] = areaCode;
            var listPhone = new List<string>();
            listPhone.Add(areaCode + "-" + phoneNum);
            var listNote = new List<string>();
            listNote.Add(strNote);
            //变更
            var result = await HdlSafeguardLogic.Current.SetCoercePhoneNumber(dicPhone);
            var result = await HdlSafeguardLogic.Current.SetCoercePhoneNumber(listPhone, listNote);
            if (result == false)
            {
                return;
@@ -188,8 +209,8 @@
            }
            if (strNote == string.Empty)
            {
                //请输入备注名称
                btnErrorMsg.Text = Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackup);
                //请输入备注内容
                btnErrorMsg.Text = Language.StringByID(R.MyInternationalizationString.uPlesaeInputNoteInformation);
                return false;
            }
@@ -216,13 +237,5 @@
        }
        #endregion
    }
}