黄学彪
2020-06-01 0bf9e65bc3ba98391e7835c922b15baab3c77876
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>
@@ -27,7 +42,7 @@
            this.ClearBodyFrame();
            var listView = new VerticalListControl(29);
            listView.Height = Application.GetRealHeight(340);
            listView.Height = bodyFrameLayout.Height;
            listView.BackgroundColor = UserCenterColor.Current.White;
            bodyFrameLayout.AddChidren(listView);
@@ -59,6 +74,7 @@
            var btntext2 = row2.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uWirelessGateway), 500);
            btntext2.TextSize = 15;
            row2.AddRightArrow();
            row2.AddBottomLine();
            row2.ButtonClickEvent += (sender, e) =>
            {
                //检测住宅经纬度
@@ -81,14 +97,70 @@
                    form.AddForm();
                });
            };
        }
            //Mini网关
            var row3 = new FrameRowControl(listView.rowSpace / 2);
            listView.AddChidren(row3);
            var btnIcon3 = row3.AddLeftIcon(81);
            btnIcon3.UnSelectedImagePath = "Gateway/MiniGateway.png";
            var btntext3 = row3.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uMiniGateway), 500);
            btntext3.TextSize = 15;
            row3.AddRightArrow();
            row3.ButtonClickEvent += (sender, e) =>
            {
                //检测住宅经纬度
                if (this.CheckResidencePoint() == false)
                {
                    return;
                }
                var form = new MiniGatewayDirection1Form();
                form.AddForm();
            };
            listView.AdjustRealHeight(Application.GetRealHeight(23));
            //如果还没有设置地理位置
            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>
        /// <returns></returns>
        private bool CheckResidencePoint()
        {
            //只弹一次
            if (this.showSettion == false)
            {
                return true;
            }
            this.showSettion = false;
            if (Common.Config.Instance.Home.Latitude == 0 && Common.Config.Instance.Home.Longitude == 0)
            {
                //请前往住宅管理{0}设置住宅的地理位置
@@ -102,6 +174,30 @@
                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
    }
}