gxc
2020-01-02 00ab3ddb140ba8bb88b5cf572b004a85e1da85e9
ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/NewGateWayMenuSelectForm.cs
@@ -5,7 +5,22 @@
    /// 添加网关的选择画面
    /// </summary>
    public class NewGateWayMenuSelectForm : EditorCommonForm
    {
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// 是否显示提示设置住宅地理位置
        /// </summary>
        private bool showSettion = true;
        /// <summary>
        /// 提示的FrameLayout
        /// </summary>
        private FrameLayout frameTip = null;
        #endregion
        #region ■ 初始化_____________________________
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
@@ -42,6 +57,11 @@
            row1.AddBottomLine();
            row1.ButtonClickEvent += (sender, e) =>
            {
                //检测住宅经纬度
                if (this.CheckResidencePoint() == false)
                {
                    return;
                }
                var form = new WiredGatewayDirectionForm();
                form.AddForm();
            };
@@ -56,6 +76,11 @@
            row2.AddRightArrow();
            row2.ButtonClickEvent += (sender, e) =>
            {
                //检测住宅经纬度
                if (this.CheckResidencePoint() == false)
                {
                    return;
                }
                var menuContr = new BottomMenuSelectForm();
                menuContr.AddForm(2);
                //UDP模式(推荐)
@@ -71,89 +96,87 @@
                    form.AddForm();
                });
            };
            //如果还没有设置地理位置
            if (Common.Config.Instance.Home.Latitude == 0 && Common.Config.Instance.Home.Longitude == 0)
            {
                this.frameTip = new FrameLayout();
                frameTip.X = Application.GetRealWidth(179);
                frameTip.Y = Application.GetRealHeight(1426);
                frameTip.Height = Application.GetRealHeight(100);
                frameTip.Width = Application.GetRealWidth(714);
                bodyFrameLayout.AddChidren(frameTip);
                var btnIcon = new IconViewControl(58);
                btnIcon.UnSelectedImagePath = "Item/Tips.png";
                frameTip.AddChidren(btnIcon);
                //如果不设置住宅的地理位置,则会影响自动化地理围栏功能的设置
                var btnTip = new NormalViewControl(Application.GetRealWidth(636), Application.GetRealHeight(100), false);
                btnTip.X = btnIcon.Right + Application.GetRealWidth(20);
                btnTip.TextAlignment = TextAlignment.Center;
                btnTip.TextColor = UserCenterColor.Current.TextGrayColor1;
                btnTip.TextSize = 12;
                btnTip.IsMoreLines = true;
                btnTip.Text = Language.StringByID(R.MyInternationalizationString.uNotSetLocationWillAffectTheAutomaticGeofencingFunction);
                frameTip.AddChidren(btnTip);
            }
        }
        #endregion
        #region ■ 一般方法___________________________
        /// <summary>
        /// 菜单控件
        /// 检测住宅经纬度
        /// </summary>
        private class SearchWirelessMenuControl : DialogCommonForm
        /// <returns></returns>
        private bool CheckResidencePoint()
        {
            /// <summary>
            /// 画面显示(底层会固定调用此方法,借以完成画面创建)
            /// </summary>
            public void ShowForm()
            //只弹一次
            if (this.showSettion == false)
            {
                var frameBack1 = new FrameLayoutControl();
                frameBack1.UseClickStatu = false;
                frameBack1.Y = Application.GetRealHeight(1420);
                frameBack1.Gravity = Gravity.CenterHorizontal;
                frameBack1.Radius = 12;
                frameBack1.Width = Application.GetRealWidth(1034);
                frameBack1.Height = Application.GetRealHeight(300);
                frameBack1.BackgroundColor = UserCenterColor.Current.White;
                bodyFrameLayout.AddChidren(frameBack1);
                //UDP模式(推荐)
                var btnUdp = new NormalViewControl(900, 156, true);
                btnUdp.Gravity = Gravity.CenterHorizontal;
                btnUdp.TextAlignment = TextAlignment.Center;
                btnUdp.TextColor = 0xff0075ff;
                btnUdp.TextSize = 17;
                btnUdp.TextID = R.MyInternationalizationString.uUdpModeRecommend;
                frameBack1.AddChidren(btnUdp, ChidrenBindMode.NotBind);
                btnUdp.ButtonClickEvent += (sender, e) =>
                {
                    //关闭界面
                    this.CloseForm();
                    var form = new WirelessUdpDirectionForm();
                    form.AddForm();
                };
                //线
                var btnLine = new NormalViewControl(frameBack1.Width, ControlCommonResourse.BottomLineHeight, false);
                btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
                btnLine.Y = btnUdp.Bottom;
                frameBack1.AddChidren(btnLine, ChidrenBindMode.NotBind);
                //AP模式
                var btnAp = new NormalViewControl(900, 144, true);
                btnAp.Y = btnLine.Bottom;
                btnAp.Gravity = Gravity.CenterHorizontal;
                btnAp.TextAlignment = TextAlignment.Center;
                btnAp.TextColor = 0xff0075ff;
                btnAp.TextSize = 17;
                btnAp.TextID = R.MyInternationalizationString.uApMode;
                frameBack1.AddChidren(btnAp, ChidrenBindMode.NotBind);
                btnAp.ButtonClickEvent += (sender, e) =>
                {
                    //关闭界面
                    this.CloseForm();
                    var form = new WirelessApDirection1Form();
                    form.AddForm();
                };
                var frameBack2 = new FrameLayoutControl();
                frameBack2.UseClickStatu = false;
                frameBack2.Y = frameBack1.Bottom + Application.GetRealHeight(23);
                frameBack2.Gravity = Gravity.CenterHorizontal;
                frameBack2.Radius = 12;
                frameBack2.Width = Application.GetRealWidth(1034);
                frameBack2.Height = Application.GetRealHeight(156);
                frameBack2.BackgroundColor = UserCenterColor.Current.White;
                bodyFrameLayout.AddChidren(frameBack2);
                //取消
                var btnCancel = new NormalViewControl(900, 156, true);
                btnCancel.Gravity = Gravity.CenterHorizontal;
                btnCancel.TextAlignment = TextAlignment.Center;
                btnCancel.TextColor = 0xff0075ff;
                btnCancel.TextSize = 17;
                btnCancel.TextID = R.MyInternationalizationString.uCancel;
                frameBack2.AddChidren(btnCancel, ChidrenBindMode.NotBind);
                btnCancel.ButtonClickEvent += (sender, e) =>
                {
                    //关闭界面
                    this.CloseForm();
                };
                return true;
            }
        }
            this.showSettion = false;
            if (Common.Config.Instance.Home.Latitude == 0 && Common.Config.Instance.Home.Longitude == 0)
            {
                //请前往住宅管理{0}设置住宅的地理位置
                string msg = Language.StringByID(R.MyInternationalizationString.uGotoResidenceAndSetLocation).Replace("{0}", "\r\n");
                this.ShowMassage(ShowMsgType.Confirm, msg, () =>
                {
                    var form = new Residence.ResidenceManagementForm();
                    form.AddForm(false);
                }, Language.StringByID(R.MyInternationalizationString.uGotoSettion));
                return false;
            }
            return true;
        }
        #endregion
        #region ■ 界面重新激活事件___________________
        /// <summary>
        /// 自身的上层界面关闭后,它自身处于最上层时,触发的事件
        /// </summary>
        public override int FormActionAgainEvent()
        {
            if (frameTip == null)
            {
                return 0;
            }
            if (Common.Config.Instance.Home.Latitude != 0 || Common.Config.Instance.Home.Longitude != 0)
            {
                //移除掉提示
                frameTip.RemoveFromParent();
                return 1;
            }
            return 1;
        }
        #endregion
    }
}