HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2021-01-14 d78515ac4ac8cf4a1785d9df18058d6724f12b79
ZigbeeApp/Shared/Phone/UserCenter/Gateway/Add/WiredGatewayDirectionForm.cs
@@ -27,50 +27,41 @@
            this.ClearBodyFrame();
            //图标
            var btnimage = new PicViewControl(533, 884, true);
            btnimage.Y = Application.GetRealHeight(173);
            var btnimage = new PicViewControl(496, 781, true);
            btnimage.Y = Application.GetRealHeight(86);
            btnimage.Gravity = Gravity.CenterHorizontal;
            btnimage.UnSelectedImagePath = "Gateway/WiredGatewayInstruct.png";
            bodyFrameLayout.AddChidren(btnimage);
            //请确保网关用网线正常连接路由器{0}正常连接则系统指示灯1秒闪烁
            string[] strMsg = Language.StringByID(R.MyInternationalizationString.ConfirmLineConnectMsg).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
            var btnMsg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
            btnMsg1.TextColor = UserCenterColor.Current.TextGrayColor3;
            btnMsg1.TextAlignment = TextAlignment.Center;
            btnMsg1.Text = strMsg[0];
            btnMsg1.Y = btnimage.Bottom + Application.GetRealHeight(101);
            bodyFrameLayout.AddChidren(btnMsg1);
            if (strMsg.Length > 1)
            //1.请确保网关用网线正常连接路由器
            //2.网口指示灯LAN无规律闪烁
            //3.系统指示灯SYS为1秒周期闪烁,灯光偏暗
            //4.手机APP和网关首次连接,请将手机保持在与网关同一个局域网下(WIFI)
            //5.进行“下一步”操作
            string[] strMsg = Language.StringByID(R.MyInternationalizationString.uAddWiredGatewayMsg1).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
            int YY = btnimage.Bottom + Application.GetRealHeight(66);
            foreach (var msg in strMsg)
            {
                var btnMsg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(60), false);
                btnMsg2.TextColor = UserCenterColor.Current.TextGrayColor3;
                btnMsg2.TextAlignment = TextAlignment.Center;
                btnMsg2.Text = strMsg[1];
                btnMsg2.Y = btnMsg1.Bottom;
                bodyFrameLayout.AddChidren(btnMsg2);
            }
                var btnMsg1 = new NormalViewControl(910, 60, true);
                btnMsg1.TextColor = UserCenterColor.Current.TextGrayColor1;
                btnMsg1.TextSize = 12;
                btnMsg1.Text = msg;
                btnMsg1.Y = YY;
                btnMsg1.X = Application.GetRealWidth(75);
                btnMsg1.IsMoreLines = true;
                btnMsg1.Height = Application.GetRealHeight(60) * this.GetRowCountByTextLength(btnMsg1, 910);
                bodyFrameLayout.AddChidren(btnMsg1);
                YY = btnMsg1.Bottom;
            }
            //查看帮助
            var btnHelp = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false);
            btnHelp.Y = Application.GetRealHeight(1388);
            btnHelp.TextSize = 12;
            btnHelp.TextAlignment = TextAlignment.Center;
            btnHelp.TextColor = UserCenterColor.Current.TextOrangeColor;
            btnHelp.Text = Language.StringByID(R.MyInternationalizationString.uSearchHelp);
            var btnHelp = this.AddHelpControl();
            btnHelp.ButtonClickEvent += (sender, e) =>
            {
                var form = new AddGatewayHelpForm();
                form.AddForm("Wired");
            };
            bodyFrameLayout.AddChidren(btnHelp);
            //底线
            int lineWidth = btnHelp.GetRealWidthByText();
            var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
            btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
            btnLine.Gravity = Gravity.CenterHorizontal;
            btnLine.Y = btnHelp.Bottom - Application.GetRealHeight(8);
            bodyFrameLayout.AddChidren(btnLine);
            };
            //下一步
            var btnNext = new BottomClickButton();
@@ -83,5 +74,25 @@
                this.AddFromAndRemoveNowForm(form);
            };
        }
        /// <summary>
        /// 根据文本长度,获取行数
        /// </summary>
        /// <param name="btnContr"></param>
        /// <param name="i_width"></param>
        /// <returns></returns>
        private int GetRowCountByTextLength(NormalViewControl btnContr, int i_width)
        {
            int realWidth = btnContr.GetRealWidthByText();
            int myWidth = Application.GetRealWidth(i_width);
            int row = realWidth / myWidth;
            int value = realWidth % myWidth;
            if (value > 8)
            {
                row++;
            }
            return row;
        }
    }
}