From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28
---
ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs | 125 ++++++++++++++++++++++++++++++-----------
1 files changed, 91 insertions(+), 34 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs b/ZigbeeApp/Shared/Phone/Device/Category/SelectFloor.cs
index 85d5b7e..69c0b29 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)
+ 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
@@ -32,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);
@@ -68,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);
@@ -85,19 +120,31 @@
/// 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 (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.IconButton.MouseUpEventHandler += SelectFloor_MouseUpEvent;
- frow.TitleButton.MouseUpEventHandler += SelectFloor_MouseUpEvent;
+ frow.ButtonClickEvent += SelectFloor_MouseUpEvent;
}
/// <summary>
@@ -105,16 +152,26 @@
/// </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 Button).Parent as CommonForm.LeftIconButtonRow).IsSelected = true;
- if(changeFloor)
+ (sender as CommonForm.LeftIconButtonRow).IsSelected = true;
+ if (changeFloor)
{
- Config.Instance.Home.CurrentFloorId = (sender as Button).Tag.ToString();
- Config.Instance.Home.Save();
+ Config.Instance.Home.CurrentFloorId = (sender as CommonForm.LeftIconButtonRow).Tag.ToString();
+ Config.Instance.Home.Save(false);
+ Common.Room.CurrentRoom.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