From 23420922845c9e77019a55c3b3e3271eb1ec261e Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 13 七月 2020 11:42:18 +0800
Subject: [PATCH] 新版本
---
ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs | 419 +++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 306 insertions(+), 113 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs
index 0a8c985..3b5ffb5 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs
@@ -12,184 +12,377 @@
public class AddScenePage : FrameLayout
{
- Button roomname;
public AddScenePage()
{
Tag = "Logic";
}
- public void Show()
+
+ ///鎴块棿婊戝姩鎺т欢
+ public HorizontalScrolViewLayout roomhorizontalScrol = new HorizontalScrolViewLayout
{
- this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
+ Width = Application.GetRealWidth(1080 - 58),
+ Height = Application.GetRealHeight(200),
+ Y = Application.GetRealHeight(184),
+ X = Application.GetRealWidth(58),
+ };
+ public VerticalScrolViewLayout middle = new VerticalScrolViewLayout
+ {
+ Width = Application.GetRealWidth(1080),
+ Height = Application.GetRealHeight(Method.H - 260 - 200 - 184),
+ BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+ };
- var topFrameLayout = new FrameLayout
+ Button roombjButton = new Button();
+ Button roomTextButton = new Button();
+ Button clickbutton = new Button();
+ public string clickTag = "no";
+ public SceneUI tempScene = null;
+ Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
+ public void Show(string sceneType)
+ {
+ #region 涓婇潰鐨勫竷灞�浠g爜
+ UserView.HomePage.Instance.ScrollEnabled = false;
+ this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
+ TopView view = new TopView();
+ this.AddChidren(view.TopRowView(true));
+ view.toptitleNameBtn.TextID =MyInternationalizationString.addscene;
+ view.clickBtn.MouseDownEventHandler += (sender, e) =>
{
- Height = Application.GetRealHeight(220),
- Y = Application.GetRealHeight(80),
- };
-
- AddChidren(topFrameLayout);
-
- var titleName = new Button
- {
- //Text = "娣诲姞鍦烘櫙",
- TextID = MyInternationalizationString.addscene,
- TextSize = 17,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- };
- topFrameLayout.AddChidren(titleName);
-
- var back = new Button
- {
- Width = Application.GetRealWidth(110),
- Height = Application.GetRealHeight(110),
- X = Application.GetRealWidth(20),
- Gravity = Gravity.CenterVertical,
- UnSelectedImagePath = "ZigeeLogic/Back.png",
- };
- topFrameLayout.AddChidren(back);
- back.MouseDownEventHandler += (sender, e) =>
- {
+ UserView.HomePage.Instance.ScrollEnabled = true;
RemoveFromParent();
};
-
- roomname = new Button
+ view.foolrnameBtn.Text = Config.Instance.Home.GetCurrentFloorName;
+ if (Config.Instance.Home.FloorDics.Count < 2)
{
- Width = Application.GetMinRealAverage(300 + 300),
- Height = Application.GetMinRealAverage(80),
- X = Application.GetRealWidth(1080 - 300 - 30 - 300),
- Y = Application.GetRealHeight(120),
- TextAlignment = TextAlignment.CenterRight,
- //Text = "鑷畾涔夋埧闂�",
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- TextID=MyInternationalizationString.customroom,
- };
- topFrameLayout.AddChidren(roomname);
+ ///娌℃湁妤煎眰鎴栬�呭彧鏈変竴涓ゼ灞傦紝榛樿涓嶆樉绀哄浘鏍囧拰鏂囨湰;
+ view.foolrnameBtn.Visible = false;
+ view.dropdownBtn.Visible = false;
+ view.foolrclickBtn.Visible = false;
+ }
+ if (Config.Instance.Home.FloorDics.Count == 0)
+ {
+ Config.Instance.Home.CurrentFloorId = "";
+ }
+ #endregion
- var middle = new VerticalScrolViewLayout();
- middle.Y = topFrameLayout.Bottom;
- middle.Height = Application.GetRealHeight(1920 - 300);
- middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
+ ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱
+ var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms();
+ if (listAllRoom.Count == 0)
+ {
+ return;
+ }
+
+ this.AddChidren(roomhorizontalScrol);
+ middle.Y = roomhorizontalScrol.Bottom;
this.AddChidren(middle);
-
- roomname.MouseUpEventHandler += (sender, e) =>
+ LogicView.SaveView saveView = new LogicView.SaveView();
+ saveView.frameLayout.Y = middle.Bottom;
+ this.AddChidren(saveView.Show());
+ saveView.clickviewBtn.MouseUpEventHandler += (sender2, e2) =>
{
+ if (clickTag == "no" || tempScene == null)
+ {
+ var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+ Language.StringByID(MyInternationalizationString.scenetip),
+ Language.StringByID(MyInternationalizationString.confrim));
+ alert.Show();
+ return;
+ }
+ if (actionsInfo.ContainsKey("LinkType"))
+ {
+ actionsInfo.Remove("LinkType");
+ }
+ actionsInfo.Add("LinkType", 2);
+ LogicIfon.AddSceneactions(tempScene, actionsInfo);
+ if (sceneType ==LogicView.IfString.Action_LogicScene)
+ {
+ //鑷姩鍖栧満鏅�
+ var logicCommunalPage = new LogicCommunalPage();
+ UserView.HomePage.Instance.AddChidren(logicCommunalPage);
+ UserView.HomePage.Instance.PageIndex += 1;
+ logicCommunalPage.Show(() => { });
+ }
+ else {
+ //闂ㄩ攣鍦烘櫙
+ var lockLogicCommunalPage = new DoorLockLogic.LockLogicCommunalPage();
+ UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
+ UserView.HomePage.Instance.PageIndex += 1;
+ lockLogicCommunalPage.Show(() => { });
+ }
+
+ };
+
+ ///妤煎眰鐐瑰嚮浜嬩欢
+ view.foolrclickBtn.MouseUpEventHandler += (sender, e) =>
+ {
+
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
this.AddChidren(flMain);
flMain.MouseUpEventHandler += (sender2, e2) =>
{
flMain.RemoveFromParent();
};
- var roombj = new VerticalScrolViewLayout
+ var foolrbjicon = new FrameLayout
{
- Width = Application.GetRealWidth(400),
- Height = Application.GetRealHeight(600),
- X = Application.GetRealWidth(1080 - 400 - 60),
- Y = Application.GetRealHeight(220 + 30 + 80),
- BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
- Radius = (uint)Application.GetRealHeight(30),
+ Width = Application.GetRealWidth(450),
+ Height = Application.GetRealHeight(780),
+ X = Application.GetRealWidth(1080 - 468 - 35),
+ Y = Application.GetRealHeight(184),
+ BackgroundImagePath = "Item/SelectFloor_Right.png",
};
- flMain.AddChidren(roombj);
- List<Common.Room> roomlist = new List<Common.Room>();
- roomlist.Clear();
- Common.Room customroom = new Common.Room();
- //铏氭嫙涓�涓埧闂村姞杞芥湰鍦版墍鏈夊満鏅紱
- customroom.SceneUIList.AddRange(Common.Room.AllRoomSceneUIList);
- customroom.Name =Language.StringByID(MyInternationalizationString.customroom);
- roomlist.Add(customroom);
- roomlist.AddRange(Common.Room.Lists);
- foreach (var room in roomlist)
+ flMain.AddChidren(foolrbjicon);
+
+ var btnfoolrtext = new Button
{
- var rowLayout = new RowLayout
+ Width = Application.GetRealWidth(450),
+ Height = Application.GetRealHeight(150),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+ X = Application.GetRealWidth(80),
+ TextID = MyInternationalizationString.selecfoolr,
+ TextSize = 14,
+ };
+ foolrbjicon.AddChidren(btnfoolrtext);
+
+ var foolrbj = new VerticalScrolViewLayout
+ {
+
+ Width = Application.GetRealWidth(450),
+ Height = foolrbjicon.Height - btnfoolrtext.Height,
+ X = Application.GetRealWidth(80),
+ Y = btnfoolrtext.Bottom,
+ };
+ foolrbjicon.AddChidren(foolrbj);
+
+ foreach (var foolr in Config.Instance.Home.FloorDics)
+ {
+ var foolrRowLayout = new RowLayout
{
Height = Application.GetRealHeight(150),
+ LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
};
- roombj.AddChidren(rowLayout);
+ foolrbj.AddChidren(foolrRowLayout);
- var btnroomname = new Button
+ var btnfoolricon = new Button
{
- Width = Application.GetRealWidth(300),
- Text = room.Name,
+ Width = Application.GetMinRealAverage(81),
+ Height = Application.GetMinRealAverage(81),
+ UnSelectedImagePath = "Floor/Floor.png",
+ Gravity = Gravity.CenterVertical,
+ };
+ foolrRowLayout.AddChidren(btnfoolricon);
+
+
+ var btnfoolrname = new Button
+ {
+ Width = Application.GetRealWidth(250),
+ Height = Application.GetRealHeight(150),
+ Text = foolr.Value,
TextAlignment = TextAlignment.CenterLeft,
- X = Application.GetRealWidth(30),
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+ TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+ Tag = foolr.Key,
+ X = btnfoolricon.Right + Application.GetRealWidth(12),
+ TextSize = 14,
};
- rowLayout.AddChidren(btnroomname);
-
- EventHandler<MouseEventArgs> roomclick = (sender1, e1) =>
+ foolrRowLayout.AddChidren(btnfoolrname);
+ if (view.foolrnameBtn.Text == foolr.Value)
{
+ btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png";
+ btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor;
+ }
+ EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) =>
+ {
+ roomhorizontalScrol.RemoveAll();
+ view.foolrnameBtn.Text = btnfoolrname.Text;
+ middle.RemoveAll();
flMain.RemoveFromParent();
- roomname.Text = room.Name;
- SceneView(middle, room.SceneUIList);
+ var list = Method.GetRoomList(sceneType, btnfoolrname.Tag.ToString());
+ AllRoomView(list);
};
- rowLayout.MouseUpEventHandler += roomclick;
- btnroomname.MouseUpEventHandler += roomclick;
+ foolrRowLayout.MouseUpEventHandler += foolrnameclick;
+ btnfoolrname.MouseUpEventHandler += foolrnameclick;
+
}
-
- };
- SceneView(middle,Common.Room.AllRoomSceneUIList);
+ };
+ ///鎴块棿鍒楄〃
+ var roomlists = Method.GetRoomList(sceneType, Config.Instance.Home.CurrentFloorId);
+ if (roomlists.Count == 0)
+ {
+ ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱
+ return;
+ }
+ ///绗竴娆¤繘鏉�
+ AllRoomView(roomlists);
}
+ /// <summary>
+ /// 鏄剧ず鎵�鏈夋埧闂寸殑鏂规硶
+ /// </summary>
+ /// <param name="RoomList"></param>
+ void AllRoomView(List<Common.Room> RoomList ) {
+ for (int i = 0; i < RoomList.Count; i++)
+ {
+ var room = RoomList[i];
+ var fra = new FrameLayout
+ {
+ Height = Application.GetRealHeight(200),
+ Width = Application.GetRealWidth(255),
+ };
+ roomhorizontalScrol.AddChidren(fra);
+ var roombjBtn = new Button
+ {
+ Height = Application.GetRealHeight(158),
+ Width = Application.GetRealWidth(255),
+ UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png",
+ SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png",
+ Y = Application.GetRealHeight(21),
+ };
+ fra.AddChidren(roombjBtn);
- void SceneView(VerticalScrolViewLayout middle,List<SceneUI>scenelist)
+ var roomnameBtn = new Button
+ {
+
+ Height = Application.GetRealHeight(152 - 26 - 20),
+ Width = Application.GetRealWidth(255 - 20 - 50),
+ Text = room.Name,
+ TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+ SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+ Y = Application.GetRealHeight(21 + 13 + 10),
+ X = Application.GetRealWidth(10 + 25),
+
+ };
+ fra.AddChidren(roomnameBtn);
+
+ if (i == 0)
+ {
+ roombjButton.IsSelected = false;
+ roombjButton = roombjBtn;
+ roombjBtn.IsSelected = true;
+
+ roomTextButton.IsSelected = false;
+ roomTextButton = roomnameBtn;
+ roomnameBtn.IsSelected = true;
+ SceneView(room.ListSceneId);
+
+ }
+
+ EventHandler<MouseEventArgs> roomclick = (sender, e) =>
+ {
+ clickTag = "no";
+ tempScene = null;
+ clickbutton = null;
+ clickbutton = new Button();
+
+ roombjButton.IsSelected = false;
+ roombjButton = roombjBtn;
+ roombjBtn.IsSelected = true;
+
+ roomTextButton.IsSelected = false;
+ roomTextButton = roomnameBtn;
+ roomnameBtn.IsSelected = true;
+ SceneView(room.ListSceneId);
+ };
+ roomnameBtn.MouseUpEventHandler += roomclick;
+ roombjBtn.MouseUpEventHandler += roomclick;
+
+ }
+ }
+ /// <summary>
+ /// 鏄剧ず鎵�鏈夌殑鍦烘櫙鐨勬柟娉�
+ /// </summary>
+ /// <param name="scenelist"></param>
+ void SceneView(List<int>scenelist)
{
middle.RemoveAll();
- foreach (var tempScene in scenelist)
+ foreach (var sceneId in scenelist)
{
- var deviceRowLayout = new RowLayout
+ var scene = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(sceneId);
+ if (scene == null)
{
- Height = Application.GetRealHeight(180),
+ continue;
+ }
+ var sceneFramelayout = new FrameLayout
+ {
+ Height = Application.GetRealHeight(160),
+ BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
};
- middle.AddChidren(deviceRowLayout);
+ middle.AddChidren(sceneFramelayout);
- var btn = new Button
+ var sceneIconBtn = new Button
{
- Height = Application.GetRealHeight(180),
- Width = LayoutParams.MatchParent,
+ Width = Application.GetMinRealAverage(81),
+ Height = Application.GetMinRealAverage(81),
+ X = Application.GetRealWidth(58),
+ Y = Application.GetRealHeight(55),
+ UnSelectedImagePath = "ZigeeLogic/scene.png",
};
- deviceRowLayout.AddChidren(btn);
+ sceneFramelayout.AddChidren(sceneIconBtn);
- var devicetypename = new Button
+ var sceneRow = new RowLayout
{
- Width = Application.GetRealWidth(600),
- Text = tempScene.Name,
+ Y = Application.GetRealHeight(30),
+ Width = Application.GetRealWidth(850),
+ Height = Application.GetRealHeight(130),
+ X = Application.GetRealWidth(176 + 10),
+ LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+ };
+ sceneFramelayout.AddChidren(sceneRow);
+
+ var scenename = new Button
+ {
+ Text = scene.Name,
TextAlignment = TextAlignment.CenterLeft,
- X = Application.GetRealWidth(40),
- //SelectedBackgroundColor = 0xfffe5e00,
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+ SelectedTextColor = ZigbeeColor.Current.LogicAddColor,
+ TextSize = 14,
};
- deviceRowLayout.AddChidren(devicetypename);
+ sceneRow.AddChidren(scenename);
+ var selectedBtn = new Button
+ {
+ Width = Application.GetMinRealAverage(60),
+ Height = Application.GetMinRealAverage(60),
+ X = Application.GetRealWidth(789),
+ UnSelectedImagePath = "ZigeeLogic/selected.png",
+ Visible = false,
+ Gravity = Gravity.CenterVertical,
+ };
+ sceneRow.AddChidren(selectedBtn);
+ var lineBtn = new Button
+ {
+ Y = sceneFramelayout.Height - 1,
+ Width = Application.GetRealWidth(850),
+ Height = 1,
+ X = Application.GetRealWidth(176 + 10),
+ BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+ };
+ sceneFramelayout.AddChidren(lineBtn);
EventHandler<MouseEventArgs> sceneclick = (sender, e) =>
{
- Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
- if (actionsInfo.ContainsKey("LinkType"))
- {
- actionsInfo.Remove("LinkType");
- }
+ tempScene = scene;
+ clickTag = "yes";
+ clickbutton.Visible = false;
+ clickbutton = selectedBtn;
+ selectedBtn.Visible = true;
if (actionsInfo.ContainsKey("DeviceAddr"))
{
actionsInfo.Remove("DeviceAddr");
}
- actionsInfo.Add("LinkType", 2);
- actionsInfo.Add("DeviceAddr", tempScene.Id);
-
- LogicIfon.AddSceneactions(tempScene,actionsInfo);
- var logicCommunalPage = new LogicCommunalPage();
- UserView.HomePage.Instance.AddChidren(logicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- logicCommunalPage.Show(() => { });
+ actionsInfo.Add("DeviceAddr", scene.Id);
};
- deviceRowLayout.MouseUpEventHandler += sceneclick;
- btn.MouseUpEventHandler += sceneclick;
- devicetypename.MouseUpEventHandler += sceneclick;
+ sceneFramelayout.MouseUpEventHandler += sceneclick;
+ sceneIconBtn.MouseUpEventHandler += sceneclick;
+ sceneRow.MouseUpEventHandler += sceneclick;
+ scenename.MouseUpEventHandler += sceneclick;
+ selectedBtn.MouseUpEventHandler += sceneclick;
}
--
Gitblit v1.8.0