From b186c02eb9e44268727b769be477d1956e97fbb0 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期四, 02 一月 2020 09:08:05 +0800 Subject: [PATCH] 2019.1.2 --- ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 43 insertions(+), 11 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs b/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs index 11d2bf8..2d66ac5 100644 --- a/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs +++ b/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(); } } -- Gitblit v1.8.0