HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-01-06 72be4f06a683de33ddd563c8447c39f7f17e5b7d
ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs
@@ -8,23 +8,35 @@
    {
        public Action<string> FloorAction;
        /// <summary>
        /// 是否切换为当前楼层
        /// </summary>
        public bool changeFloor = true;
        /// <summary>
        /// 当前传过来的floorid
        /// </summary>
        public string CurFloorId = string.Empty;
        public bool changeFloor;
        Dialog dialogBackground;
        /// <summary>
      /// Init
      /// </summary>
      public void Init(int x,int y,CommonForm.Direction direction=CommonForm.Direction.Left)
        {
            var dialog = new FrameLayout()
            dialogBackground = new Dialog
            {
                BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor
            };
            AddChidren(dialog);
            dialogBackground.Show();
            var dialog = new FrameLayout()
            {
            };
            dialogBackground.AddChidren(dialog);
            dialog.MouseUpEventHandler += (sender, e) =>
            {
                RemoveFromParent();
                RemoveView();
            };
            var bg = new Button
@@ -91,12 +103,23 @@
            frow.Tag = floor.Key;
            frow.Init("Floor/Floor.png", "Floor/FloorSelected.png", floor.Value);
            verticalScrolView.AddChidren(frow);
            if (Config.Instance.Home.CurrentFloorId == floor.Key)
            if(string.IsNullOrEmpty(CurFloorId))
            {
                frow.IsSelected = true;
                if (Config.Instance.Home.CurrentFloorId == floor.Key)
                {
                    frow.IsSelected = true;
                }
            }
            else
            {
                if (CurFloorId == floor.Key)
                {
                    frow.IsSelected = true;
                }
            }
            frow.ClickBtn.MouseUpEventHandler += SelectFloor_MouseUpEvent;
            frow.ButtonClickEvent += SelectFloor_MouseUpEvent;
        }
        /// <summary>
@@ -106,15 +129,24 @@
        /// <param name="mouseEventArgs"></param>
        private void SelectFloor_MouseUpEvent(object sender,MouseEventArgs mouseEventArgs)
        {
            ((sender as Button).Parent as CommonForm.LeftIconButtonRow).IsSelected = true;
            (sender as CommonForm.LeftIconButtonRow).IsSelected = true;
            if(changeFloor)
            {
                Config.Instance.Home.CurrentFloorId = (sender as Button).Tag.ToString();
                Config.Instance.Home.CurrentFloorId = (sender as CommonForm.LeftIconButtonRow).Tag.ToString();
                Config.Instance.Home.Save();
                Common.Room.RefreshRoomListView();
            }
            FloorAction?.Invoke((sender as Button).Tag.ToString());
            RemoveView();
            FloorAction?.Invoke((sender as CommonForm.LeftIconButtonRow).Tag.ToString());
        }
        /// <summary>
        /// RemoveView
        /// </summary>
        private void RemoveView()
        {
            dialogBackground.Close();
            RemoveFromParent();
        }
    }