HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-09-30 404cdc88627f942df7944af04ee05b9d527752d6
ZigbeeApp/Shared/Phone/UserCenter/Safety/CoercePasswordMainForm.cs
@@ -7,7 +7,7 @@
    /// <summary>
    /// 胁迫密码设置的菜单界面★
    /// </summary>
    public class CoercePasswordMainForm : UserCenterCommonForm
    public class CoercePasswordMainForm : EditorCommonForm
    {
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
@@ -18,141 +18,154 @@
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uCoercePasswordSettion));
            //初始化中部信息
            this.InitMiddleFrame();
            //this.InitMiddleFrame();
        }
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        public void InitMiddleFrame()
        {
            bodyFrameLayout.RemoveAll();
        ///// <summary>
        ///// 初始化中部信息
        ///// </summary>
        //public void InitMiddleFrame()
        //{
        //    //清空bodyFrame
        //    this.ClearBodyFrame();
            //密码设置
            string text = Language.StringByID(R.MyInternationalizationString.uPasswordSettion);
            var rowPsw = new OnlyCenterViewRow(text);
            //将图标控件适配为【点号】控件
            rowPsw.ChangedIconInPointMode();
            bodyFrameLayout.AddChidren(rowPsw);
            rowPsw.InitControl();
            //点号图片有点特殊,需要调整偏移量
            rowPsw.btnName.X -= ControlCommonResourse.PointXXLeft;
        //    //密码设置
        //    string text = Language.StringByID(R.MyInternationalizationString.uPasswordSettion);
        //    var rowPsw = new OnlyCenterViewRow(text);
        //    //将图标控件适配为【点号】控件
        //    rowPsw.ChangedIconInPointMode();
        //    bodyFrameLayout.AddChidren(rowPsw);
        //    rowPsw.InitControl();
        //    //点号图片有点特殊,需要调整偏移量
        //    rowPsw.btnName.X -= ControlCommonResourse.PointXXLeft;
            //添加向右的图标
            rowPsw.AddRightIconControl();
            //状态
            var btnStatuPsw = new RowSecondRightTextView();
            rowPsw.AddChidren(btnStatuPsw);
        //    //添加向右的图标
        //    rowPsw.AddRightArrow();
        //    //状态
        //    var btnStatuPsw = new RowSecondRightTextView();
        //    rowPsw.AddChidren(btnStatuPsw);
            rowPsw.MouseUpEvent += (sender, e) =>
            {
                var form = new EdtiorCoercePasswordForm();
                this.AddForm(form, btnStatuPsw.TextColor != UserCenterColor.Current.Green);
            };
        //    rowPsw.MouseUpEvent += (sender, e) =>
        //    {
        //        var form = new EdtiorCoercePasswordForm();
        //        form.AddForm(btnStatuPsw.TextColor != UserCenterColor.Current.Green);
        //    };
            //联系人设置
            text = Language.StringByID(R.MyInternationalizationString.uContactSettion);
            var rowContact = new OnlyCenterViewRow(text);
            rowContact.Y = rowPsw.Bottom;
            //将图标控件适配为【点号】控件
            rowContact.ChangedIconInPointMode();
            bodyFrameLayout.AddChidren(rowContact);
            rowContact.InitControl();
            //点号图片有点特殊,需要调整偏移量
            rowContact.btnName.X -= ControlCommonResourse.PointXXLeft;
        //    //联系人设置
        //    text = Language.StringByID(R.MyInternationalizationString.uContactSettion);
        //    var rowContact = new OnlyCenterViewRow(text);
        //    rowContact.Y = rowPsw.Bottom;
        //    //将图标控件适配为【点号】控件
        //    rowContact.ChangedIconInPointMode();
        //    bodyFrameLayout.AddChidren(rowContact);
        //    rowContact.InitControl();
        //    //点号图片有点特殊,需要调整偏移量
        //    rowContact.btnName.X -= ControlCommonResourse.PointXXLeft;
            //添加向右的图标
            rowContact.AddRightIconControl();
            //状态
            var btnStaturowContact = new RowSecondRightTextView();
            rowContact.AddChidren(btnStaturowContact);
        //    //添加向右的图标
        //    rowContact.AddRightArrow();
        //    //状态
        //    var btnStaturowContact = new RowSecondRightTextView();
        //    rowContact.AddChidren(btnStaturowContact);
            rowContact.MouseUpEvent += (sender, e) =>
            {
                var form = new CoerceContactSettionForm();
                this.AddForm(form, btnStaturowContact.Tag);
            };
        //    rowContact.MouseUpEvent += (sender, e) =>
        //    {
        //        var form = new CoerceContactSettionForm();
        //        form.AddForm(btnStaturowContact.Tag);
        //    };
            //设置行的状态
            this.SetRowStatu(btnStatuPsw, btnStaturowContact);
        }
        //    //设置行的状态
        //    this.SetRowStatu(btnStatuPsw, btnStaturowContact);
        //}
        /// <summary>
        /// 设置行的状态
        /// </summary>
        /// <param name="btnStatuPsw"></param>
        /// <param name="btnStaturowContact"></param>
        private async void SetRowStatu(RowSecondRightTextView btnStatuPsw, RowSecondRightTextView btnStaturowContact)
        {
            //开启进度条
            this.ShowProgressBar();
        ///// <summary>
        ///// 设置行的状态
        ///// </summary>
        ///// <param name="btnStatuPsw"></param>
        ///// <param name="btnStaturowContact"></param>
        //private async void SetRowStatu(RowSecondRightTextView btnStatuPsw, RowSecondRightTextView btnStaturowContact)
        //{
        //    //开启进度条
        //    this.ShowProgressBar();
            //判断是否设置有胁迫密码
            var listData = await Common.LocalSafeguard.Current.GetAllUserPassword();
            bool isEsixt = false;
            if (listData != null)
            {
                foreach (var data in listData)
                {
                    if (data.UserId == 5)
                    {
                        isEsixt = true;
                        break;
                    }
                }
            }
            else
            {
                //关闭进度条
                this.CloseProgressBar(ShowReLoadMode.YES);
                return;
            }
        //    //判断是否设置有胁迫密码
        //    var listData = await Common.LocalSafeguard.Current.GetAllUserPassword();
        //    bool isEsixt = false;
        //    if (listData != null)
        //    {
        //        foreach (var data in listData)
        //        {
        //            if (data.UserId == 5)
        //            {
        //                isEsixt = true;
        //                break;
        //            }
        //        }
        //    }
        //    else
        //    {
        //        //关闭进度条
        //        this.CloseProgressBar(ShowReLoadMode.YES);
        //        return;
        //    }
            if (isEsixt == true)
            {
                Application.RunOnMainThread(() =>
                {
                    //已设置
                    btnStatuPsw.TextID = R.MyInternationalizationString.uAlreadySettion;
                    btnStatuPsw.TextColor = UserCenterColor.Current.Green;
                });
            }
            else
            {
                Application.RunOnMainThread(() =>
                {
                    //未设置
                    btnStatuPsw.TextID = R.MyInternationalizationString.uNotHadSettion;
                    btnStatuPsw.TextColor = UserCenterColor.Current.Gray;
                });
            }
        //    if (isEsixt == true)
        //    {
        //        Application.RunOnMainThread(() =>
        //        {
        //            if (btnStatuPsw != null)
        //            {
        //                //已设置
        //                btnStatuPsw.TextID = R.MyInternationalizationString.uAlreadySettion;
        //                btnStatuPsw.TextColor = UserCenterColor.Current.Green;
        //            }
        //        });
        //    }
        //    else
        //    {
        //        Application.RunOnMainThread(() =>
        //        {
        //            if (btnStatuPsw != null)
        //            {
        //                //未设置
        //                btnStatuPsw.TextID = R.MyInternationalizationString.uNotHadSettion;
        //                btnStatuPsw.TextColor = UserCenterColor.Current.Gray;
        //            }
        //        });
        //    }
            //获取联系方式
            var result = await Common.LocalSafeguard.Current.GetCoercePhoneNumber();
            if (result == null || result.Actions.Count == 0 || result.Actions[0].PushTarget.Count == 0)
            {
                Application.RunOnMainThread(() =>
                {
                    //未设置
                    btnStaturowContact.TextID = R.MyInternationalizationString.uNotHadSettion;
                    btnStaturowContact.TextColor = UserCenterColor.Current.Gray;
                    var data = new List<ZigBee.Device.Safeguard.PushTargetInfo>();
                    btnStaturowContact.Tag = data;
                });
            }
            else
            {
                Application.RunOnMainThread(() =>
                {
                    //已设置
                    btnStaturowContact.TextID = R.MyInternationalizationString.uAlreadySettion;
                    btnStaturowContact.TextColor = UserCenterColor.Current.Green;
                    btnStaturowContact.Tag = result.Actions[0].PushTarget;
                });
            }
        //    //获取联系方式
        //    var result = await Common.LocalSafeguard.Current.GetCoercePhoneNumber();
        //    if (result == null || result.Actions.Count == 0 || result.Actions[0].PushTarget.Count == 0)
        //    {
        //        Application.RunOnMainThread(() =>
        //        {
        //            if (btnStaturowContact != null)
        //            {
        //                //未设置
        //                btnStaturowContact.TextID = R.MyInternationalizationString.uNotHadSettion;
        //                btnStaturowContact.TextColor = UserCenterColor.Current.Gray;
        //                var data = new List<ZigBee.Device.Safeguard.PushTargetInfo>();
        //                btnStaturowContact.Tag = data;
        //            }
        //        });
        //    }
        //    else
        //    {
        //        Application.RunOnMainThread(() =>
        //        {
        //            if (btnStaturowContact != null)
        //            {
        //                //已设置
        //                btnStaturowContact.TextID = R.MyInternationalizationString.uAlreadySettion;
        //                btnStaturowContact.TextColor = UserCenterColor.Current.Green;
        //                btnStaturowContact.Tag = result.Actions[0].PushTarget;
        //            }
        //        });
        //    }
            //关闭进度条
            this.CloseProgressBar();
        }
        //    //关闭进度条
        //    this.CloseProgressBar();
        //}
    }
}