HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-01-17 4b378188ce972df432b23d9cb73babb6cc0679c6
ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs
@@ -22,7 +22,7 @@
        /// <summary>
      /// Init
      /// </summary>
      public void Init(int x,int y,CommonForm.Direction direction=CommonForm.Direction.Left)
      public void Init(int x, int y, CommonForm.Direction direction = CommonForm.Direction.Left)
        {
            dialogBackground = new Dialog
            {
@@ -44,35 +44,30 @@
                X = Application.GetRealWidth(x),
                Y = Application.GetRealHeight(y),
                Width = Application.GetMinRealAverage(449),
                Height = Application.GetMinRealAverage(783),
                UnSelectedImagePath="Item/SelectFloor_Left.png"
                Height = Application.GetMinRealAverage(773),
                UnSelectedImagePath = "Floor/SelectFloor_Left_4.png"
            };
            dialog.AddChidren(bg);
            if (direction == CommonForm.Direction.Right)
            {
                bg.UnSelectedImagePath = "Item/SelectFloor_Right.png";
            }
            var backgroundFL = new FrameLayout
            {
                X = Application.GetRealWidth(x+10),
                Y = Application.GetRealHeight(y+23),
                Width = Application.GetMinRealAverage(449-20),
                Height = Application.GetMinRealAverage(783-23-10),
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
                X = Application.GetRealWidth(x),
                Y = Application.GetRealHeight(y + 23),
                Width = Application.GetMinRealAverage(449),
                Height = Application.GetMinRealAverage(773 - 23)
            };
            dialog.AddChidren(backgroundFL);
            var tip = new Button
            {
                X = Application.GetRealWidth(80),
                Width = Application.GetRealWidth(350),
                Height = Application.GetRealHeight(150),
                Width = Application.GetMinRealAverage(350),
                Height = Application.GetMinRealAverage(150),
                TextColor = ZigbeeColor.Current.GXCTextBlackColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextID = R.MyInternationalizationString.SelectFloor,
                TextSize=16,
                IsBold=true
                TextSize = 14,
                IsBold = true
            };
            backgroundFL.AddChidren(tip);
@@ -80,12 +75,40 @@
            {
                Y = tip.Bottom,
                Width = Application.GetMinRealAverage(449),
                Height = Application.GetMinRealAverage(600)
                Height = Application.GetMinRealAverage(600),
                VerticalScrollBarEnabled = false
            };
            backgroundFL.AddChidren(floorLayout);
            if (Config.Instance.Home.FloorDics.Count > 0)
            var floorCount = Config.Instance.Home.FloorDics.Count;
            if (floorCount > 0)
            {
                string directStr = string.Empty;
                if (direction == CommonForm.Direction.Right)
                {
                    directStr = "Right";
                }
                else
                {
                    directStr = "Left";
                }
                if (floorCount > 5)
                {
                    bg.UnSelectedImagePath = $"Floor/SelectFloor_{directStr}_5.png";
                    bg.Height = Application.GetMinRealAverage(150*6+23);
                    backgroundFL.Height = Application.GetMinRealAverage(150 * 6);
                    floorLayout.Height = Application.GetMinRealAverage(150 * 5);
                }
                else
                {
                    bg.UnSelectedImagePath = $"Floor/SelectFloor_{directStr}_{floorCount}.png";
                    bg.Height = Application.GetMinRealAverage(150 * (floorCount + 1)+23);
                    backgroundFL.Height = Application.GetMinRealAverage(150 * (floorCount + 1));
                    floorLayout.Height = Application.GetMinRealAverage(150 * floorCount);
                }
                foreach (var floor in Config.Instance.Home.FloorDics)
                {
                    AddFloor(floorLayout, floor);
@@ -97,14 +120,16 @@
        /// AddFloor
        /// </summary>
        /// <param name="verticalScrolView"></param>
        private void AddFloor(VerticalScrolViewLayout verticalScrolView, KeyValuePair<string, string> floor)
        private void AddFloor(VerticalScrolViewLayout verticalScrolView, KeyValuePair<string, string> floor,bool isLast=false)
        {
            var frow = new CommonForm.LeftIconButtonRow(449, 150);
            frow.Width = Application.GetMinRealAverage(449);
            frow.Height = Application.GetMinRealAverage(150);
            frow.Tag = floor.Key;
            frow.Init("Floor/Floor.png", "Floor/FloorSelected.png", floor.Value);
            verticalScrolView.AddChidren(frow);
            if(string.IsNullOrEmpty(CurFloorId))
            if (string.IsNullOrEmpty(CurFloorId))
            {
                if (Config.Instance.Home.CurrentFloorId == floor.Key)
                {
@@ -127,10 +152,10 @@
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="mouseEventArgs"></param>
        private void SelectFloor_MouseUpEvent(object sender,MouseEventArgs mouseEventArgs)
        private void SelectFloor_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
        {
            (sender as CommonForm.LeftIconButtonRow).IsSelected = true;
            if(changeFloor)
            if (changeFloor)
            {
                Config.Instance.Home.CurrentFloorId = (sender as CommonForm.LeftIconButtonRow).Tag.ToString();
                Config.Instance.Home.Save(false);