From 34e965100d635346e2d4cd6e6013bdaed66b3004 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 02 一月 2020 19:52:13 +0800
Subject: [PATCH] 2019.1.2-3
---
ZigbeeApp/Shared/Phone/Device/CommonForm/SelectZone.cs | 139 ++++++++++++++++++++--------------------------
1 files changed, 61 insertions(+), 78 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectZone.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectZone.cs
index 213da61..c36e818 100644
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectZone.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectZone.cs
@@ -4,7 +4,7 @@
namespace Shared.Phone.Device.CommonForm
{
- public class SelectZone : FrameLayout
+ public class SelectZone
{
public Action<Common.Room> ZoneAction;
@@ -13,7 +13,11 @@
private List<string> floorList = new List<string> { };
private List<string> roomList = new List<string> { };
private List<string> roomIdList = new List<string> { };
- private string currentId;
+ /// <summary>
+ /// curRoom
+ /// </summary>
+ private Common.Room curRoom;
+
public SelectZone()
{
}
@@ -23,91 +27,70 @@
/// </summary>
public void Init()
{
- var dialog = new FrameLayout()
+ List<string> floorIds = new List<string> { };
+ List<string> floorNames = new List<string> { };
+ List<List<string>> roomNames = new List<List<string>> { };
+ List<List<Common.Room>> rooms = new List<List<Common.Room>> { };
+ List<Common.Room> rs = new List<Common.Room> { };
+ List<string> rNames = new List<string> { };
+ if (Config.Instance.Home.FloorDics.Count > 0)
{
- BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor
- };
- AddChidren(dialog);
-
- dialog.MouseUpEventHandler += (sender, e) =>
+ foreach (var floor in Config.Instance.Home.FloorDics)
+ {
+ floorIds.Add(floor.Key);
+ floorNames.Add(floor.Value);
+ if (Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count > 0)
+ {
+ roomNames.Add(Common.Room.CurrentRoom.GetRoomNamesByFloorId(floor.Key));
+ rooms.Add(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key));
+ }
+ }
+ PickerView.ShowSecondary(floorNames, roomNames, (index1, index2) =>
+ {
+ curRoom = rooms[index1][index2];
+ ZoneAction?.Invoke(curRoom);
+ //RemoveFromParent();
+ }, 0, 0, Language.StringByID(R.MyInternationalizationString.BelongFloor),
+ Language.StringByID(R.MyInternationalizationString.Confrim),
+ Language.StringByID(R.MyInternationalizationString.Cancel));
+ }
+ else
{
- RemoveFromParent();
- };
+ for (int i = 0; i < Common.Room.Lists.Count; i++)
+ {
+ var r = Common.Room.Lists[i];
+ if (r.IsLove)
+ {
+ continue;
+ }
+ rs.Add(r);
+ rNames.Add(r.Name);
+ }
+ PickerView.Show(rNames, (index1) =>
+ {
+ curRoom = rs[index1];
+ ZoneAction?.Invoke(curRoom);
+ //RemoveFromParent();
+ }, 0, Language.StringByID(R.MyInternationalizationString.AddTo),
+ Language.StringByID(R.MyInternationalizationString.Confrim),
+ Language.StringByID(R.MyInternationalizationString.Cancel));
+ }
- var backgroundFL = new FrameLayout
- {
- Y = Application.GetRealHeight(1115),
- Height = Application.GetRealHeight(805),
- BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
- Radius = (uint)Application.GetRealHeight(20)
- };
- dialog.AddChidren(backgroundFL);
-
- var topView = new FrameLayout
- {
- Height = Application.GetRealHeight(138)
- };
- backgroundFL.AddChidren(topView);
-
- var cancle = new Button
- {
- X = Application.GetRealWidth(80),
- Width = Application.GetRealWidth(300),
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = ZigbeeColor.Current.GXCTextGrayColor,
- TextID = R.MyInternationalizationString.Cancel,
- TextSize = 16
- };
- topView.AddChidren(cancle);
-
- var title = new Button
- {
- Width = Application.GetRealWidth(300),
- Gravity = Gravity.CenterHorizontal,
- TextColor = ZigbeeColor.Current.GXCTextBlackColor2,
- TextID = R.MyInternationalizationString.AddTo,
- TextSize = 16
- };
- topView.AddChidren(title);
-
- var confrim = new Button
- {
- X = Application.GetRealWidth(CommonFormResouce.AppRealWidth - 80 - 300),
- Width = Application.GetRealWidth(300),
- TextAlignment = TextAlignment.CenterRight,
- TextColor = ZigbeeColor.Current.GXCTextSelectedColor2,
- TextID = R.MyInternationalizationString.Confrim,
- TextSize = 16
- };
- topView.AddChidren(confrim);
-
- pickView = new UIPickerView
- {
- Y = Application.GetRealHeight(20+138),
- Height = Application.GetRealHeight(450)
- };
- backgroundFL.AddChidren(pickView);
-
- foreach(var floor in Config.Instance.Home.FloorDics)
+ foreach (var floor in Config.Instance.Home.FloorDics)
{
floorList.Add(floor.Value);
}
- foreach(var room in Shared.Common.Room.Lists)
+ foreach (var room in Shared.Common.Room.Lists)
{
+ if(room.IsLove)
+ {
+ continue;
+ }
roomList.Add(room.Name);
roomIdList.Add(room.Id);
}
- pickView.setNPicker(floorList, roomList, null);
- pickView.OnSelectChangeEvent += (l1, l2, l3) =>
- {
- currentId = roomIdList[l2];
- };
-
- cancle.MouseUpEventHandler += Close;
- confrim.MouseUpEventHandler += Confrim_MouseEvent;
}
-
/// <summary>
/// Close
@@ -116,7 +99,7 @@
/// <param name="mouseEventArgs"></param>
private void Close(object sender, MouseEventArgs mouseEventArgs)
{
- RemoveFromParent();
+ //RemoveFromParent();
}
/// <summary>
@@ -126,8 +109,8 @@
/// <param name="mouseEventArgs"></param>
private void Confrim_MouseEvent(object sender, MouseEventArgs mouseEventArgs)
{
- ZoneAction?.Invoke(Shared.Common.Room.CurrentRoom.GetRoomById(currentId));
- RemoveFromParent();
+ //ZoneAction?.Invoke(curRoom);
+ //RemoveFromParent();
}
}
}
--
Gitblit v1.8.0