From b4312dc4fc0b37955322058937fea6a1845de3bf Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期五, 25 十月 2019 17:53:45 +0800
Subject: [PATCH] 2019-10-25-3
---
ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs | 184 +++++++++------------------------------------
1 files changed, 38 insertions(+), 146 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs b/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs
index 0cbb7ae..278128d 100755
--- a/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs
@@ -2,6 +2,7 @@
using Shared.Common;
using Shared.Phone.Device.Category;
using Shared.Phone.Device.CommonForm;
+using Shared.Phone.UserView;
namespace Shared.Phone.Device.Room
{
@@ -76,7 +77,7 @@
UnSelectedImagePath = "Item/Drop_Down.png"
};
- floorBtn.Text = Config.Instance.Home.GetCurrentFloorName();
+ floorBtn.Text = Config.Instance.Home.GetCurrentFloorName;
top.topView.AddChidren(floorBtn);
top.topView.AddChidren(selectFloorBtn);
selectFloorBtn.MouseUpEventHandler += SelectedFloor_MouseUpEventHandler;
@@ -113,20 +114,18 @@
var roomScrolView = new VerticalScrolViewLayout { };
bodyFrameLayout.AddChidren(roomScrolView);
- for (int i = 0; i < Shared.Common.Room.Lists.Count; i++)
+ var roomList = Shared.Common.Room.Lists;
+ for (int i = 0; i < roomList.Count+1; i++)
{
- var room = Shared.Common.Room.Lists[i];
int xx = 43 + i % 2 * (20 + 487);
int yy = 0;
-
if (i == 0 || i == 1)
{
if (i % 2 == 0)
{
itemView = new FrameLayout()
{
- Height = Application.GetRealHeight(354 + 58),
- Tag = room
+ Height = Application.GetRealHeight(354 + 58)
};
roomScrolView.AddChidren(itemView);
}
@@ -136,19 +135,31 @@
{
itemView = new FrameLayout()
{
- Height = Application.GetRealHeight(354),
- Tag = room
+ Height = Application.GetRealHeight(354)
};
roomScrolView.AddChidren(itemView);
}
- var roomView = new RoomMainView(xx, yy);
- itemView.AddChidren(roomView);
- roomView.Init();
- roomView.SetRoomName(room.Name);
- roomView.SetRoomIcon(room.BackgroundImage);
- }
+ if (i< roomList.Count)
+ {
+ var room = roomList[i];
+ var roomView = new RoomMainView(xx, yy);
+ itemView.AddChidren(roomView);
+ roomView.Init();
+ roomView.SetRoomName(room.Name);
+ roomView.SetRoomIcon(room.BackgroundImage);
+ }
+ else
+ {
+ var roomView = new RoomNoNameMainView(xx, yy);
+ itemView.AddChidren(roomView);
+ roomView.Init();
+ roomView.Icon.MouseUpEventHandler += ShowUnallocatedRoom_MouseUpEvent;
+ roomView.RoomNameButton.MouseUpEventHandler += ShowUnallocatedRoom_MouseUpEvent;
+ roomView.iconFL.MouseUpEventHandler += ShowUnallocatedRoom_MouseUpEvent;
+ }
+ }
}
#endregion
@@ -159,138 +170,19 @@
void RoomPage()
{
BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
+ }
- return;
-
-
-
- var RoomBodyView = new VerticalScrolViewLayout()
- {
- Height = Application.GetRealHeight(CommonPage.AppRealHeight - CommonPage.Navigation_Height),
- BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
- };
-
-
-
- foreach (var roomFilePath in Config.Instance.Home.RoomFilePathList)
- {
- var room = Shared.Common.Room.GetRoomByFilePath(roomFilePath);
- if (room == null)
- {
- continue;
- }
-
- var roomFL = new FrameLayout()
- {
- Height = Application.GetRealHeight(570),
- Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft * 2),
- BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
- Gravity = Gravity.CenterHorizontal,
- Radius = CommonPage.BigFormRadius,
- };
- RoomBodyView.AddChidren(roomFL);
-
- var roomRowView = new RowLayout()
- {
- Y = Application.GetRealHeight(20),
- Height = Application.GetMinRealAverage(550),
- Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft * 2),
- BackgroundColor =ZigbeeColor.Current.GXCBackgroundColor,
- LineColor= ZigbeeColor.Current.GXCBackgroundColor,
- Radius = CommonPage.BigFormRadius,
- Gravity = Gravity.CenterHorizontal
- };
- roomFL.AddChidren(roomRowView);
-
- var backGroundBtn = new Button()
- {
- UnSelectedImagePath = room.BackgroundImage,
- Radius = CommonPage.BigFormRadius,
- Height = Application.GetMinRealAverage(550),
- Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft * 2),
- };
- roomRowView.AddChidren(backGroundBtn);
-
- var hardBlackBG = new FrameLayout()
- {
- Radius = CommonPage.BigFormRadius,
- BackgroundColor = ZigbeeColor.Current.GXCBlack70Color
- };
- roomRowView.AddChidren(hardBlackBG);
-
- var btnRoomName = new Button()
- {
- Width = Application.GetRealWidth(500),
- Height=Application.GetRealHeight(200),
- Text = room.Name,
- TextAlignment = TextAlignment.Center,
- TextSize=25,
- TextColor=ZigbeeColor.Current.GXCTextWhiteColor,
- Gravity=Gravity.Center
- };
- roomRowView.AddChidren(btnRoomName);
-
- var btnEditRoom = new Device.CommonForm.SelectedStatuButton()
- {
- X = roomRowView.Width- Application.GetRealWidth(100+30),
- Y=backGroundBtn.Y,
- Width = Application.GetMinRealAverage(110),
- Height=Application.GetMinRealAverage(110),
- UnSelectedImagePath = "Room/More.png",
- SelectedImagePath="Room/MoreSelected.png",
- };
- roomRowView.AddChidren(btnEditRoom);
-
- var delBtn = new Shared.Phone.Device.CommonForm.RowLayoutDeleteButton();
- //绗竴涓槸鎴块棿鍠滅埍锛屼笉鍏佽婊戝姩鍒犻櫎 鍒嗕韩杩囨潵鐨勪篃涓嶅厑璁稿垹闄�
- if (room.IsLove || room.IsSharedRoom)
- {
-
- }
- else
- {
- roomRowView.AddRightView(delBtn);
- }
-
- //鍒犻櫎浣忓畢
- delBtn.MouseUpEventHandler += (sender, e) =>
- {
- var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.ConfirmDeleteThisRoom), Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim));
- alert.Show();
- alert.ResultEventHandler += (send, ee) =>
- {
- if(ee)
- {
- Shared.Common.Room.CurrentRoom.Remove(roomFilePath);
- Show();
- }
- };
- };
-
- btnEditRoom.MouseUpEventHandler += (sender, e) =>
- {
- //AddOrUpdateRoom(action, roomFilePath);
- var addRoom = new AddRoom();
- Shared.Phone.UserView.HomePage.Instance.AddChidren(addRoom);
- Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
- addRoom.action = () =>
- {
- Show();
- };
- AddRoom.OldBackgroundImagePath = string.Empty;
- addRoom.Show(roomFilePath);
- };
-
- roomRowView.MouseUpEventHandler += (sender, e) =>
- {
- //var userRoom = new RoomAddDevice();
- //this.AddChidren(userRoom);
- //userRoom.Show(roomFilePath);
- };
-
- }
-
-
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="mouseEventArgs"></param>
+ private void ShowUnallocatedRoom_MouseUpEvent(object sender,MouseEventArgs mouseEventArgs)
+ {
+ var unalloctedRoom = new UnallocatedRoom();
+ HomePage.Instance.AddChidren(unalloctedRoom);
+ HomePage.Instance.PageIndex += 1;
+ unalloctedRoom.Show();
}
}
-}
\ No newline at end of file
+}
--
Gitblit v1.8.0