From 0f6bf2b39fe1d3838c385eee86dc47a2260ad024 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期二, 24 十二月 2019 15:03:52 +0800
Subject: [PATCH] 2019.12.24
---
ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs | 258 +++++++++++++++++++++++++++++---------------------
1 files changed, 149 insertions(+), 109 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs
index 3ee57ba..8c0d561 100644
--- a/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/UnallocatedRoom.cs
@@ -15,15 +15,13 @@
/// bodyFrameLayout
/// </summary>
private FrameLayout bodyFrameLayout;
-
- private Button addBtn;
+ /// <summary>
+ /// top
+ /// </summary>
+ private TopFrameLayout top;
+ private Button selectAllBtn;
private FrameLayout itemView;
- /// <summary>
- /// editStatus
- /// </summary>
- private bool SelectAll;
-
/// <summary>
/// low_High
/// </summary>
@@ -117,14 +115,25 @@
{
devList = Shared.Common.Room.CurrentRoom.GetUnalloctedDeviceUIs();
sceneList = Shared.Common.Room.CurrentRoom.GetUnalloctedScenes();
- var sameDevList = new List<DeviceUI> { };
typeDeviceDic.Clear();
typeIdDic.Clear();
+ if (devList == null)
+ {
+ return;
+ }
foreach (var device in devList)
{
- var info = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device.CommonDevice });
- sameDevList.Add(device);
- typeDeviceDic[info.BeloneTextId] = sameDevList;
+ var info = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device?.CommonDevice });
+ if (typeDeviceDic.ContainsKey(info.BeloneTextId) == false)
+ {
+ var sameDevList = new List<DeviceUI> { };
+ sameDevList.Add(device);
+ typeDeviceDic[info.BeloneTextId] = sameDevList;
+ }
+ else
+ {
+ typeDeviceDic[info.BeloneTextId].Add(device);
+ }
typeIdDic[info.BeloneTextId] = info.ConcreteType;
}
}
@@ -145,7 +154,7 @@
/// </summary>
public void AddTop()
{
- var top = new TopFrameLayout();
+ top = new TopFrameLayout();
AddChidren(top);
top.InitTopview();
top.SetTopTitle(R.MyInternationalizationString.Unallocated);
@@ -154,20 +163,7 @@
RemoveFromParent();
};
- addBtn = new Button()
- {
- X = Application.GetRealWidth(1080-150-80),
- Width = Application.GetRealWidth(150),
- Height = Application.GetRealHeight(80),
- Gravity = Gravity.CenterVertical,
- TextColor = ZigbeeColor.Current.GXCTextBlackColor,
- TextSize = CommonFormResouce.TopTitle_TextSize,
- TextAlignment = TextAlignment.CenterRight,
- TextID = R.MyInternationalizationString.AllSelect
- };
- top.topView.AddChidren(addBtn);
-
- addBtn.MouseUpEventHandler += Edit_MouseUpEventHandler;
+
}
/// <summary>
@@ -247,35 +243,6 @@
RefreshBodyView();
}
- /// <summary>
- /// 缂栬緫
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="mouseEventArgs"></param>
- private void Edit_MouseUpEventHandler(object sender, MouseEventArgs mouseEventArgs)
- {
- SelectAll = !SelectAll;
- if (SelectAll)
- {
- addBtn.TextID = R.MyInternationalizationString.Cancel;
- }
- else
- {
- addBtn.TextID = R.MyInternationalizationString.AllSelect;
- }
-
- if (functionBtn.IsSelected)
- {
- functionSceneBodyView.RemoveAll();
- ShowFunction(SelectAll);
- }
- else if (sceneBtn.IsSelected)
- {
- functionSceneBodyView.RemoveAll();
- ShowScene(SelectAll);
- }
- }
-
#endregion
#region 鈼� 鍒锋柊____________________________
@@ -285,14 +252,14 @@
public void RefreshBodyView()
{
functionSceneBodyView.RemoveAll();
- SelectAll = false;
+
if (functionBtn.IsSelected)
{
- ShowFunction(SelectAll);
+ ShowFunction();
}
else if (sceneBtn.IsSelected)
{
- ShowScene(SelectAll);
+ ShowScene();
}
}
@@ -302,9 +269,8 @@
/// <summary>
/// 鍔熻兘
/// </summary>
- public void ShowFunction(bool selectAll)
+ public void ShowFunction()
{
- SelectAll = selectAll;
if (typeIdDic.Count == 0)
{
ShowNoFunctionTip();
@@ -377,11 +343,12 @@
functionTypeIMG.ClickBtn.MouseUpEventHandler += ShowSameTypeFunction;
- if (typeRowLayout.ChildrenCount == 1)
+ if (functionTypeScrowView.ChildrenCount == 1)
{
ShowSameTypeFunction(functionTypeIMG.ImageBtn, null);
}
}
+
}
}
@@ -403,10 +370,6 @@
var selectedList = new List<DeviceUI> { };
sameTypeList = typeDeviceDic[int.Parse((typeSender as Button).Tag.ToString())];
- if (SelectAll)
- {
- selectedList.AddRange(sameTypeList);
- }
foreach (var deviceUI in sameTypeList)
{
var deviceTypeRowLayout = new FrameLayout()
@@ -419,7 +382,6 @@
var deviceRow = new SelectFunctionView(0, 35);
deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath);
deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName);
- deviceRow.IsSelected = SelectAll;
deviceTypeRowLayout.AddChidren(deviceRow);
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
@@ -441,44 +403,85 @@
}
};
deviceRow.ClickBtn.MouseUpEventHandler += eventHandler;
-
- var addBackground = new Button
- {
- Y = Application.GetRealHeight(1405),
- Width = Application.GetMinRealAverage(1080),
- Height = Application.GetMinRealAverage(202),
- UnSelectedImagePath = "Room/AddBackground.png"
- };
- functionSceneBodyView.AddChidren(addBackground);
- var add = new Button
- {
- Y = Application.GetRealHeight(1428),
- Width = Application.GetRealWidth(1034),
- Height = Application.GetRealHeight(156),
- BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
- TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
- Radius = (uint)Application.GetRealHeight(35),
- TextID = R.MyInternationalizationString.AddTo,
- Gravity = Gravity.CenterHorizontal,
- TextSize=17
- };
- functionSceneBodyView.AddChidren(add);
- add.MouseUpEventHandler += (sender, e) =>
- {
- var selectZone = new SelectZone();
- AddChidren(selectZone);
- selectZone.Init();
- selectZone.ZoneAction = (r) =>
- {
- foreach (var d in selectedList)
- {
- r.AddDevice(d.CommonDevice,true);
- deviceListScrolView.RemoveViewByTag(d);
- }
- RefreshData();
- };
- };
}
+
+ selectAllBtn?.RemoveFromParent();
+ selectAllBtn = new Button()
+ {
+ X = Application.GetRealWidth(1080 - 150 - 80),
+ Width = Application.GetRealWidth(150),
+ Height = Application.GetRealHeight(80),
+ Gravity = Gravity.CenterVertical,
+ TextColor = ZigbeeColor.Current.GXCTextBlackColor,
+ SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor,
+ TextSize = CommonFormResouce.TopTitle_TextSize,
+ TextAlignment = TextAlignment.CenterRight,
+ TextID = R.MyInternationalizationString.AllSelect
+ };
+ top.topView.AddChidren(selectAllBtn);
+ selectAllBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ try
+ {
+ (sender as Button).IsSelected = !(sender as Button).IsSelected;
+ for (int i = 0; i < deviceListScrolView.ChildrenCount; i++)
+ {
+ var frame = deviceListScrolView.GetChildren(i) as FrameLayout;
+ (frame.GetChildren(0) as SelectFunctionView).IsSelected = (sender as Button).IsSelected;
+ }
+ if ((sender as Button).IsSelected)
+ {
+ (sender as Button).TextID = R.MyInternationalizationString.Cancel;
+ selectedList.AddRange(sameTypeList);
+ }
+ else
+ {
+ (sender as Button).TextID = R.MyInternationalizationString.AllSelect;
+ selectedList.Clear();
+ }
+ }
+ catch
+ {
+
+ }
+ };
+
+ var addBackground = new Button
+ {
+ Y = Application.GetRealHeight(1405),
+ Width = Application.GetMinRealAverage(1080),
+ Height = Application.GetMinRealAverage(202),
+ UnSelectedImagePath = "Room/AddBackground.png"
+ };
+ functionSceneBodyView.AddChidren(addBackground);
+ var add = new Button
+ {
+ Y = Application.GetRealHeight(1428),
+ Width = Application.GetRealWidth(1034),
+ Height = Application.GetRealHeight(156),
+ BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
+ TextColor = ZigbeeColor.Current.GXCTextSelectedColor4,
+ Radius = (uint)Application.GetRealHeight(35),
+ TextID = R.MyInternationalizationString.AddTo,
+ Gravity = Gravity.CenterHorizontal,
+ TextSize = 17
+ };
+ functionSceneBodyView.AddChidren(add);
+ add.MouseUpEventHandler += (sender, e) =>
+ {
+ var selectZone = new SelectZone();
+ AddChidren(selectZone);
+ selectZone.Init();
+ selectZone.ZoneAction = (r) =>
+ {
+ foreach (var d in selectedList)
+ {
+ r.AddDevice(d.CommonDevice, true);
+ deviceListScrolView.RemoveViewByTag(d);
+ }
+ RefreshData();
+ };
+ };
}
/// <summary>
@@ -517,13 +520,9 @@
/// <summary>
/// 閫夋嫨鍦烘櫙--鎵�鏈夋埧闂寸殑鎵�鏈夊満鏅�
/// </summary>
- public void ShowScene(bool selectAll)
+ public void ShowScene()
{
List<SceneUI> selectedList = new List<SceneUI>();
- if(selectAll)
- {
- selectedList.AddRange(sceneList);
- }
if (sceneList == null || sceneList.Count == 0)
{
ShowNoSceneTip();
@@ -568,7 +567,6 @@
Height = Application.GetMinRealAverage(60),
UnSelectedImagePath = "Room/ItemUnSelected.png",
SelectedImagePath = "Room/ItemSelected.png",
- IsSelected = selectAll
};
sceneFL.AddChidren(selectedBtn);
@@ -626,6 +624,48 @@
sceneImg.MouseUpEventHandler += eventHandler;
}
+ selectAllBtn?.RemoveFromParent();
+ selectAllBtn = new Button()
+ {
+ X = Application.GetRealWidth(1080 - 150 - 80),
+ Width = Application.GetRealWidth(150),
+ Height = Application.GetRealHeight(80),
+ Gravity = Gravity.CenterVertical,
+ TextColor = ZigbeeColor.Current.GXCTextBlackColor,
+ SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor,
+ TextSize = CommonFormResouce.TopTitle_TextSize,
+ TextAlignment = TextAlignment.CenterRight,
+ TextID = R.MyInternationalizationString.AllSelect
+ };
+ top.topView.AddChidren(selectAllBtn);
+ selectAllBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ try
+ {
+ (sender as Button).IsSelected = !(sender as Button).IsSelected;
+ for (int i = 0; i < sceneScrolView.ChildrenCount; i++)
+ {
+ var frame = sceneScrolView.GetChildren(i) as FrameLayout;
+ (frame.GetChildren(1) as Button).IsSelected = (sender as Button).IsSelected;
+ }
+
+ if ((sender as Button).IsSelected)
+ {
+ (sender as Button).TextID = R.MyInternationalizationString.Cancel;
+ selectedList.AddRange(sceneList);
+ }
+ else
+ {
+ (sender as Button).TextID = R.MyInternationalizationString.AllSelect;
+ selectedList.Clear();
+ }
+ }
+ catch
+ {
+
+ }
+ };
+
var addBackground = new Button
{
Y = Application.GetRealHeight(1405),
--
Gitblit v1.8.0