From b69d7735274b8d0f741da8a6bb8b8e1347477a5a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 19 三月 2020 17:14:16 +0800
Subject: [PATCH] 20200319
---
HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 388 +++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 292 insertions(+), 96 deletions(-)
diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
index bc023c9..e0eb990 100644
--- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -22,12 +22,16 @@
/// </summary>
Button btnFuncTitle;
#endregion
-
+ /// <summary>
+ /// 鎴块棿/鍔熻兘鍒嗛〉鍖哄煙
+ /// </summary>
+ PageLayout contentPageView;
#region 鎴块棿鍖哄煙
+ FrameLayout roomPageView;
/// <summary>
/// 鎴块棿鍐呭鏄剧ず鍖哄煙
/// </summary>
- FrameLayout roomContentView;
+ FrameLayout roomFloorChangeView;
#region 鎴块棿搴曢儴鍒囨崲鏄剧ず鍖哄煙
/// <summary>
/// 鎴块棿鍖哄煙锛岄《閮ㄥ尯鍩�
@@ -54,6 +58,11 @@
/// 鎴块棿鍖哄煙闆嗗悎
/// </summary>
List<FrameLayout> roomViewList;
+ #endregion
+
+ #region 鍔熻兘鍖哄煙
+ VerticalScrolViewLayout functionsPageView;
+
#endregion
@@ -99,25 +108,41 @@
TextSize = CSS_FontSize.TextFontSize,
TextColor = CSS_Color.PromptingColor1,
SelectedTextColor = CSS_Color.MainColor,
- TextID = StringId.Devices,
+ TextID = StringId.Functions,
};
topView.AddChidren(btnFuncTitle);
-
#endregion
+ contentPageView = new PageLayout()
+ {
+ Y = Application.GetRealHeight(64),
+ Height = Application.GetRealHeight(667 - 64-49+20),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ IsShowPoint = false
+ };
+ bodyView.AddChidren(contentPageView);
+ LoadRoomPageView();
+ LoadFunctionPageView();
+ LoadEventList();
+ }
+ /// <summary>
+ /// 鍔犺浇鎴块棿鍒楄〃鐣岄潰
+ /// </summary>
+ void LoadRoomPageView()
+ {
#region 鎴块棿鍖哄煙
+ roomPageView = new FrameLayout();
+ contentPageView.AddChidren(roomPageView);
/// <summary>
/// 鎴块棿鍐呭鏄剧ず鍖哄煙
/// </summary>
- roomContentView = new FrameLayout()
+ roomFloorChangeView = new FrameLayout()
{
- Y = Application.GetRealHeight(64),
Height = Application.GetRealHeight(52),
- BackgroundColor = CSS_Color.MainBackgroundColor,
};
- bodyView.AddChidren(roomContentView);
+ roomPageView.AddChidren(roomFloorChangeView);
#region 鎴块棿搴曢儴鍒囨崲鏄剧ず鍖哄煙
/// <summary>
/// 鎴块棿鍖哄煙锛岄《閮ㄥ尯鍩�
@@ -126,7 +151,7 @@
{
Height = Application.GetRealHeight(53),
};
- roomContentView.AddChidren(roomTopView);
+ roomFloorChangeView.AddChidren(roomTopView);
/// <summary>
/// 妤煎眰閫夋嫨涓嬫媺鍥炬爣
/// </summary>
@@ -138,7 +163,7 @@
Y = Application.GetRealHeight(18),
UnSelectedImagePath = "Public/DownIcon.png",
};
- roomContentView.AddChidren(btnFoorDownIcon);
+ roomFloorChangeView.AddChidren(btnFoorDownIcon);
/// <summary>
/// 妤煎眰鏄剧ず
/// </summary>
@@ -153,7 +178,7 @@
TextAlignment = TextAlignment.CenterLeft,
Text = UserConfig.Instance.CurFoor,
};
- roomContentView.AddChidren(btnFoor);
+ roomFloorChangeView.AddChidren(btnFoor);
/// <summary>
/// 鏄剧ず鏂瑰紡鍒囨崲鎸夐挳
/// </summary>
@@ -166,7 +191,7 @@
UnSelectedImagePath = "Classification/ToggleDisplayThumbnail.png",//缂╃暐鍥�
SelectedImagePath = "Classification/ToggleDisplayLarge.png",
};
- roomContentView.AddChidren(btnSwitchDipaly);
+ roomFloorChangeView.AddChidren(btnSwitchDipaly);
#endregion
@@ -175,95 +200,15 @@
/// </summary>
roomListView = new VerticalScrolViewLayout()
{
- Y = roomContentView.Bottom,
- Height = Application.GetRealHeight(497 + 10+30),
+ Y = roomFloorChangeView.Bottom,
+ Height = Application.GetRealHeight(497 + 10 + 30),
BackgroundColor = CSS_Color.MainBackgroundColor,
};
- bodyView.AddChidren(roomListView);
+ roomPageView.AddChidren(roomListView);
/// <summary>
/// 鎴块棿鍖哄煙闆嗗悎
/// </summary>
roomViewList = new List<FrameLayout>();
-
-
-#if DEBUG1
- var r = new Room() { sid = "0001", name = "Room-1", floor = "1F", backgroundImage = "Classification/Room/Roombg.png" };
- r.functions.Add(new Function()
- {
- sid = "000000000000000000000000000000000001",
- funcType = FunctionType.AC,
- name = "绌鸿皟",
- roomIdList = new List<string>() { "0001" },
- lastState = "鍒跺喎 涓 18掳C",
- bus_Data = "{" +
- "\"SubnetID\":42" + "," +
- "\"DeviceID\":8" + "," +
- "\"LoopID\":1" +
- "}",
- });
- r.functions.Add(new Dimmer()
- {
- sid = "0001002019101209000025670400010002",
- funcType = FunctionType.Light,
- name = "瀹㈠巺鐏�",
- roomIdList = new List<string>() { "0001" },
- lastState = "20%",
- bus_Data = "{" +
- "\"SubnetID\":111" + "," +
- "\"DeviceID\":2" + "," +
- "\"LoopID\":1" +
- "}",
- });
- r.functions.Add(new MotorCurtain()
- {
- sid = "000000000000000000000000000000000003",
- funcType = FunctionType.Curtain,
- name = "绐楀笜",
- roomIdList = new List<string>() { "0001" },
- lastState = "20%",
- bus_Data = "{" +
- "\"SubnetID\":42" + "," +
- "\"DeviceID\":7" + "," +
- "\"LoopID\":1" +
- "}",
- });
- r.functions.Add(new Function()
- {
- sid = "000000000000000000000000000000000004",
- funcType = FunctionType.FloorHeating,
- name = "鍦扮儹",
- roomIdList = new List<string>() { "0001" },
- lastState = ""
- });
- r.functions.Add(new Light()
- {
- sid = "0001002019101209000025670400010005",
- funcType = FunctionType.Light,
- name = "瀹㈠巺澶х伅",
- roomIdList = new List<string>() { "0001" },
- bus_Data = "{" +
- "\"SubnetID\":111" + "," +
- "\"DeviceID\":6" + "," +
- "\"LoopID\":1" +
- "}",
- });
- r.functions.Add(new RGBLight()
- {
- sid = "0001002019101209000025670500010006",
- funcType = FunctionType.Light,
- name = "瀹㈠巺RGB鐏�",
- roomIdList = new List<string>() { "0001" },
- bus_Data = "{" +
- "\"SubnetID\":222" + "," +
- "\"DeviceID\":222" + "," +
- "\"LoopID\":222" +
- "}",
- });
-
- DB_ResidenceData.residenceData.rooms.Add(r);
-
-#endif
-
foreach (var room in DB_ResidenceData.residenceData.rooms)
{
@@ -311,7 +256,7 @@
Height = Application.GetRealHeight(32),
Tag = "EnvironmentalView",
};
- topView.AddChidren(environmentalView);
+ roomView.AddChidren(environmentalView);
Button btnTempIcon = new Button()
{
@@ -420,5 +365,256 @@
#endregion
}
+
+ /// <summary>
+ /// 鍔犺浇鍔熻兘鍒楄〃鐣岄潰
+ /// </summary>
+ void LoadFunctionPageView()
+ {
+ #region
+ functionsPageView = new VerticalScrolViewLayout()
+ {
+ BackgroundColor = CSS_Color.BackgroundColor,
+ Height = Application.GetRealHeight(667 - 64 - 49 + 20),
+ };
+ contentPageView.AddChidren(functionsPageView);
+
+ FrameLayout functionContentView;
+ functionContentView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(16),
+ Height = Application.GetRealHeight(667 - 64 - 49 + 20),
+ };
+
+ if (DB_ResidenceData.residenceData.functionTypeList.Count > 4)
+ {
+ functionContentView.Height += Application.GetRealHeight((220 * (DB_ResidenceData.residenceData.functionTypeList.Count - 4 - 2) / 2) + 20);
+ }
+ functionsPageView.AddChidren(functionContentView);
+
+ int index = 0;
+ List<int> specialList = new List<int>() { 1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22 };
+
+ var s1View = new FrameLayout()
+ {
+ X = Application.GetRealWidth(16),
+ Width = Application.GetRealWidth(164),
+ };
+ functionContentView.AddChidren(s1View);
+
+ var s2View = new FrameLayout()
+ {
+ X = Application.GetRealWidth(196),
+ Width = Application.GetRealWidth(164),
+ };
+ functionContentView.AddChidren(s2View);
+
+ var lastY1 = Application.GetRealWidth(16);
+ var lastY2 = Application.GetRealWidth(16);
+
+ foreach (var item in DB_ResidenceData.residenceData.functionTypeList)
+ {
+ FrameLayout functionView = new FrameLayout()
+ {
+ Height = Application.GetRealWidth(161),
+ Radius = (uint)Application.GetRealHeight(6),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Y = index % 2 == 1 ? lastY2 : lastY1
+ };
+ //楂樺害绋嶉珮鐨剉iew
+ if (specialList.Contains(index))
+ {
+ functionView.Height = Application.GetRealWidth(204);
+ }
+ if (index % 2 == 1)
+ {
+ lastY2 += functionView.Height + Application.GetRealWidth(16);
+ }
+ else
+ {
+ lastY1 += functionView.Height + Application.GetRealWidth(16);
+ }
+
+ if (index % 2 == 0)
+ {
+ s1View.AddChidren(functionView);
+ }
+ else
+ {
+ s2View.AddChidren(functionView);
+ }
+
+ Button btnFunctionViewBg;
+ btnFunctionViewBg = new Button()
+ {
+ Height = Application.GetRealWidth(161),
+ UnSelectedImagePath = "FunctionIcon/FunctionBg/" + item + "FunctionBg.png",
+ };
+ functionView.AddChidren(btnFunctionViewBg);
+
+ Button btnName = new Button()
+ {
+ X = Application.GetRealWidth(16),
+ Y = Application.GetRealHeight(14),
+ Width = Application.GetRealWidth(120),
+ Height = Application.GetRealHeight(24),
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextSize = CSS_FontSize.TextFontSize,
+ TextAlignment = TextAlignment.CenterLeft,
+ };
+ functionView.AddChidren(btnName);
+
+
+ int functionCount = 0;
+ switch (item)
+ {
+ case "Light":
+ #region Light
+ btnName.TextID = StringId.Lights;
+ functionCount = DB_ResidenceData.residenceData.functionList.lights.Count;
+ Button btnLightPower = new Button()
+ {
+ X = Application.GetRealWidth(120),
+ Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117),
+ Width = Application.GetRealWidth(32),
+ Height = Application.GetRealWidth(32),
+ SelectedImagePath = "Public/PowerOpen.png",
+ UnSelectedImagePath = "Public/PowerClose.png",
+ };
+ functionView.AddChidren(btnLightPower);
+ btnLightPower.MouseUpEventHandler = (sender, e) => {
+ LoadEvent_LightsPower(btnLightPower);
+ };
+ btnFunctionViewBg.MouseUpEventHandler = (sender, e) => {
+ var skipView = new FunctionPage();
+ MainPage.BasePageView.AddChidren(skipView);
+ skipView.LoadPage(StringId.Lights);
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ };
+ #endregion
+ break;
+ case "AC":
+ #region AC
+ btnName.TextID = StringId.AC;
+ functionCount = DB_ResidenceData.residenceData.functionList.aCs.Count;
+ Button btnAcPower = new Button()
+ {
+ X = Application.GetRealWidth(120),
+ Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117),
+ Width = Application.GetRealWidth(32),
+ Height = Application.GetRealWidth(32),
+ SelectedImagePath = "Public/PowerOpen.png",
+ UnSelectedImagePath = "Public/PowerClose.png",
+ };
+ functionView.AddChidren(btnAcPower);
+ btnAcPower.MouseUpEventHandler = (sender, e) => {
+ LoadEvent_LightsPower(btnAcPower);
+ };
+ btnFunctionViewBg.MouseUpEventHandler = (sender, e) => {
+ var skipView = new FunctionPage();
+ MainPage.BasePageView.AddChidren(skipView);
+ skipView.LoadPage(StringId.AC);
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ };
+ #endregion
+ break;
+ case "Curtain":
+ #region Curtain
+ btnName.TextID = StringId.Curtain;
+ functionCount = DB_ResidenceData.residenceData.functionList.curtains.Count;
+
+ Button btnClose;
+ btnClose = new Button()
+ {
+ X = Application.GetRealWidth(72),
+ Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117),
+ Width = Application.GetRealWidth(32),
+ Height = Application.GetRealWidth(32),
+ UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png",
+ SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png",
+ };
+ functionView.AddChidren(btnClose);
+
+ Button btnOpen;
+ btnOpen = new Button()
+ {
+ X = Application.GetRealWidth(120),
+ Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117),
+ Width = Application.GetRealWidth(32),
+ Height = Application.GetRealWidth(32),
+ UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png",
+ SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png",
+ };
+ functionView.AddChidren(btnOpen);
+ LoadEvent_CurtainSwitch(btnClose, btnOpen);
+
+ btnFunctionViewBg.MouseUpEventHandler = (sender, e) => {
+ var skipView = new FunctionPage();
+ MainPage.BasePageView.AddChidren(skipView);
+ skipView.LoadPage(StringId.Curtain);
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ };
+ #endregion
+ break;
+ case "FloorHeating":
+ btnName.TextID = StringId.FloorHeating;
+ break;
+ case "DoorLock":
+ btnName.TextID = StringId.DoorLock;
+ break;
+ case "Electric":
+ btnName.TextID = StringId.Electric;
+ break;
+ case "EnergyMonitoring":
+ btnName.TextID = StringId.EnergyMonitoring;
+ break;
+ case "Environmental":
+ btnName.TextID = StringId.Environmental;
+ break;
+ case "FreshAir":
+ btnName.TextID = StringId.FreshAir;
+ break;
+ case "Music":
+ btnName.TextID = StringId.Music;
+ break;
+ case "Panel":
+ btnName.TextID = StringId.Panel;
+ break;
+ case "SecurityMonitoring":
+ btnName.TextID = StringId.SecurityMonitoring;
+ break;
+ case "Sensor":
+ btnName.TextID = StringId.Sensor;
+ break;
+ case "VideoIntercom":
+ btnName.TextID = StringId.VideoIntercom;
+ break;
+
+ }
+
+ Button btnFunctionCount = new Button()
+ {
+ X = Application.GetRealWidth(16),
+ Y = btnName.Bottom,
+ Width = Application.GetRealWidth(120),
+ Height = Application.GetRealHeight(24),
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextSize = CSS_FontSize.TextFontSize,
+ TextAlignment = TextAlignment.CenterLeft,
+ Text = "0/" + functionCount.ToString()
+ };
+ functionView.AddChidren(btnFunctionCount);
+
+
+
+
+ index++;
+ }
+
+
+
+ #endregion
+
+ }
}
}
--
Gitblit v1.8.0