From 17c8d94258154ab2e9f6d2cf821202c873b9f118 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 16 十二月 2020 15:39:15 +0800
Subject: [PATCH] 22222
---
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 244 +++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 207 insertions(+), 37 deletions(-)
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
index b110079..cac5d2c 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using System.Linq;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
@@ -13,14 +14,25 @@
/// </summary>
static FrameLayout bodyView;
/// <summary>
+ /// 妤煎眰閫夋嫨涓嬫媺鍥炬爣
+ /// </summary>
+ Button btnFloorDownIcon;
+ /// <summary>
+ /// 妤煎眰鏄剧ず
+ /// </summary>
+ Button btnFloor;
+ /// <summary>
/// 鍔熻兘鍒楄〃闆嗗悎鏄剧ず鍖哄煙
/// </summary>
static VerticalScrolViewLayout functionListView;
#endregion
+ List<Function> functionList;
+
public FunctionPage()
{
bodyView = this;
+ functionList = new List<Function>();
}
public void LoadPage(int titleId)
@@ -38,10 +50,7 @@
};
bodyView.AddChidren(roomFloorChangeView);
#region 鎴块棿椤堕儴鍒囨崲鏄剧ず鍖哄煙
- /// <summary>
- /// 妤煎眰閫夋嫨涓嬫媺鍥炬爣
- /// </summary>
- var btnFoorDownIcon = new Button()
+ btnFloorDownIcon = new Button()
{
Width = Application.GetMinRealAverage(16),
Height = Application.GetMinRealAverage(16),
@@ -49,22 +58,20 @@
Y = Application.GetRealHeight(18),
UnSelectedImagePath = "Public/DownIcon.png",
};
- roomFloorChangeView.AddChidren(btnFoorDownIcon);
- /// <summary>
- /// 妤煎眰鏄剧ず
- /// </summary>
- var btnFoor = new Button()
+ roomFloorChangeView.AddChidren(btnFloorDownIcon);
+
+ btnFloor = new Button()
{
- X = btnFoorDownIcon.Right,
+ X = btnFloorDownIcon.Right,
Y = Application.GetRealHeight(18),
Width = Application.GetRealWidth(200),
Height = Application.GetMinRealAverage(16),
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
TextAlignment = TextAlignment.CenterLeft,
- Text = UserConfig.Instance.CurFoor,
+ Text = DB_ResidenceData.Instance.CurFloor.roomName,
};
- roomFloorChangeView.AddChidren(btnFoor);
+ roomFloorChangeView.AddChidren(btnFloor);
#endregion
functionListView = new VerticalScrolViewLayout()
@@ -74,30 +81,45 @@
};
bodyView.AddChidren(functionListView);
- foreach (var function in DB_ResidenceData.residenceData.functionList.functions)
+ if (titleId == StringId.Lights)
{
- if (titleId == StringId.Lights)
- {
- if (function.functionCategory != FunctionCategory.Light)
- {
- continue;
- }
- }
- if (titleId == StringId.AC)
- {
- if (function.functionCategory != FunctionCategory.AC)
- {
- continue;
- }
- }
- if (titleId == StringId.Curtain)
- {
- if (function.functionCategory != FunctionCategory.Curtain)
- {
- continue;
- }
- }
- functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
+ functionList.AddRange(FunctionList.List.lights);
+ }
+ else if (titleId == StringId.AC)
+ {
+ functionList.AddRange(FunctionList.List.aCs);
+ }
+ else if (titleId == StringId.Curtain)
+ {
+ functionList.AddRange(FunctionList.List.curtains);
+ }
+ else if (titleId == StringId.FloorHeating)
+ {
+ functionList.AddRange(FunctionList.List.floorHeatings);
+ }
+ else if (titleId == StringId.Electric)
+ {
+ functionList.AddRange(FunctionList.List.electricals);
+ }
+ else if (titleId == StringId.EnvironmentalScience)
+ {
+ functionList.AddRange(FunctionList.List.sensorsEnvironmentalScience);
+ }
+ functionList.OrderByDescending(o => o.usageCount).ToList();
+
+ ShowFunctionRow(functionList);
+
+ LoadDialog_ChangeFloor();
+ }
+
+ /// <summary>
+ /// 鍔犺浇鍔熻兘row
+ /// </summary>
+ void ShowFunctionRow(List<Function> showList)
+ {
+ functionListView.RemoveAll();
+ foreach (var function in showList)
+ {
if (function.functionType == FunctionType.RGB || function.functionType == FunctionType.Dimmer)
{
@@ -110,7 +132,7 @@
BorderColor = 0x00FFFFFF,
BorderWidth = 1,
BackgroundColor = CSS_Color.MainBackgroundColor,
- Tag = function.functionCategory.ToString() + "-" + function.functionType
+ Tag = function.sid
};
functionDiv.LoadFunctionDiv();
functionListView.AddChidren(functionDiv);
@@ -126,13 +148,161 @@
BorderColor = 0x00FFFFFF,
BorderWidth = 1,
BackgroundColor = CSS_Color.MainBackgroundColor,
- Tag = function.functionCategory.ToString() + "-" + function.functionType
+ Tag = function.sid
};
functionDiv.LoadFunctionDiv();
functionListView.AddChidren(functionDiv);
}
+ functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(10) });
}
+ }
+
+ /// <summary>
+ /// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢
+ /// </summary>
+ void LoadDialog_ChangeFloor()
+ {
+ EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+ {
+ var dialog = new Dialog();
+ var dialogBody = new FrameLayout();
+ dialog.AddChidren(dialogBody);
+ dialogBody.MouseUpEventHandler += (sender1, e1) =>
+ {
+ dialog.Close();
+ };
+
+ var dispalyView = new FrameLayout()
+ {
+ X = Application.GetRealWidth(10),
+ Y = Application.GetRealHeight(100),
+ Width = Application.GetRealWidth(160),
+ Height = Application.GetRealHeight(110),
+ BackgroundImagePath = "PersonalCenter/HomeList1bg.png",
+ };
+ dialogBody.AddChidren(dispalyView);
+
+ var contentView = new VerticalScrolViewLayout()
+ {
+ X = Application.GetRealWidth(8),
+ Y = Application.GetRealHeight(15),
+ Width = Application.GetRealWidth(150),
+ Height = Application.GetRealHeight(45 * 2),
+ ScrollEnabled = false
+ };
+ dispalyView.AddChidren(contentView);
+
+ if (SpatialInfo.CurrentSpatial.RoomList.Count < 2)
+ {
+ }
+ else if (SpatialInfo.CurrentSpatial.RoomList.Count < 3)
+ {
+ dispalyView = new FrameLayout()
+ {
+ X = Application.GetRealWidth(10),
+ Y = Application.GetRealHeight(100),
+ Width = Application.GetRealWidth(160),
+ Height = Application.GetRealHeight(155),
+ BackgroundImagePath = "PersonalCenter/HomeList2bg.png",
+ };
+ dialogBody.AddChidren(dispalyView);
+
+ contentView.Height = Application.GetRealHeight(45 * 3);
+ dispalyView.AddChidren(contentView);
+ }
+ else if (SpatialInfo.CurrentSpatial.RoomList.Count < 4)
+ {
+ dispalyView = new FrameLayout()
+ {
+ X = Application.GetRealWidth(10),
+ Y = Application.GetRealHeight(100),
+ Width = Application.GetRealWidth(160),
+ Height = Application.GetRealHeight(200),
+ BackgroundImagePath = "PersonalCenter/HomeList3bg.png",
+ };
+ dialogBody.AddChidren(dispalyView);
+
+ contentView.Height = Application.GetRealHeight(45 * 4);
+ dispalyView.AddChidren(contentView);
+ }
+ else
+ {
+ dispalyView = new FrameLayout()
+ {
+ X = Application.GetRealWidth(10),
+ Y = Application.GetRealHeight(100),
+ Width = Application.GetRealWidth(160),
+ Height = Application.GetRealHeight(245),
+ BackgroundImagePath = "PersonalCenter/HomeList4bg.png",
+ };
+ dialogBody.AddChidren(dispalyView);
+
+ contentView.Height = Application.GetRealHeight(45 * 5);
+ contentView.ScrollEnabled = true;
+ dispalyView.AddChidren(contentView);
+ }
+
+
+ List<Room> roomList = new List<Room>();
+ roomList.Add(new Room() { roomName = Language.StringByID(StringId.All) });
+ roomList.AddRange(SpatialInfo.CurrentSpatial.RoomList);
+ foreach (var tempRoom in roomList)
+ {
+ var roomName = tempRoom.roomName;
+ if (roomName != Language.StringByID(StringId.All))
+ {
+ contentView.AddChidren(new Button()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(112),
+ Height = Application.GetRealHeight(1),
+ BackgroundColor = CSS_Color.BackgroundColor
+ });
+ }
+ var btnHomeName = new Button()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(112),
+ Height = Application.GetRealHeight(44),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ SelectedTextColor = CSS_Color.MainColor,
+ Text = roomName,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ IsSelected = btnFloor.Text == roomName,
+ IsMoreLines = true,
+ };
+ contentView.AddChidren(btnHomeName);
+
+ btnHomeName.MouseUpEventHandler += (senderH, en) =>
+ {
+ dialog.Close();
+ btnFloor.Text = roomName;
+ if (roomName == Language.StringByID(StringId.All))
+ {
+ ShowFunctionRow(functionList);
+ }
+ else
+ {
+ var showList = new List<Function>();
+ foreach (var sf in functionList)
+ {
+ if(sf.roomIds.Contains(tempRoom.roomId))
+ {
+ showList.Add(sf);
+ }
+ }
+ ShowFunctionRow(showList);
+ }
+ };
+ }
+
+ dialog.Show();
+ };
+
+ btnFloor.MouseUpEventHandler = eventHandler;
+ btnFloorDownIcon.MouseUpEventHandler = eventHandler;
}
}
}
\ No newline at end of file
--
Gitblit v1.8.0