From a4d29f9f72452ccae2f607e6ad31cad493822da4 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 06 五月 2020 11:36:47 +0800
Subject: [PATCH] 2020-05-06-1
---
ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs | 315 ++++++++++++++++++++++++++-------------------------
1 files changed, 161 insertions(+), 154 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs
old mode 100644
new mode 100755
index fe73fd3..3b5ffb5
--- a/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddScenePage.cs
@@ -16,142 +16,75 @@
{
Tag = "Logic";
}
+
+ ///鎴块棿婊戝姩鎺т欢
+ public HorizontalScrolViewLayout roomhorizontalScrol = new HorizontalScrolViewLayout
+ {
+ 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,
+ };
+
Button roombjButton = new Button();
Button roomTextButton = new Button();
Button clickbutton = new Button();
- HorizontalScrolViewLayout roomhorizontalScrol;
- VerticalScrolViewLayout middle;
public string clickTag = "no";
public SceneUI tempScene = null;
Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
- public void Show()
+ public void Show(string sceneType)
{
+ #region 涓婇潰鐨勫竷灞�浠g爜
UserView.HomePage.Instance.ScrollEnabled = false;
this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
- #region 鏈�涓婇潰鐨勫竷灞�浠g爜
- var topRowLayout = new RowLayout
+ TopView view = new TopView();
+ this.AddChidren(view.TopRowView(true));
+ view.toptitleNameBtn.TextID =MyInternationalizationString.addscene;
+ view.clickBtn.MouseDownEventHandler += (sender, e) =>
{
- BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
- Height = Application.GetRealHeight(184),
- LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
- };
- this.AddChidren(topRowLayout);
-
- var titleName = new Button
- {
- TextSize = 16,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- TextAlignment = TextAlignment.CenterLeft,
- X = Application.GetRealWidth(160),
- Width = Application.GetRealWidth(300),
- Height = Application.GetRealHeight(69),
- Y = Application.GetRealHeight(92),
- TextID = MyInternationalizationString.addscene,
- };
- topRowLayout.AddChidren(titleName);
-
- var clickBtn = new Button
- {
- Width = Application.GetRealWidth(81 + 51),
- Height = Application.GetRealHeight(58 + 40),
- Y = Application.GetRealHeight(98 - 40),
- };
- topRowLayout.AddChidren(clickBtn);
- clickBtn.MouseDownEventHandler += (sender, e) =>
- {
- RemoveFromParent();
UserView.HomePage.Instance.ScrollEnabled = true;
- };
-
- var back = new Button
- {
- Width = Application.GetRealWidth(30),
- Height = Application.GetRealHeight(51),
- X = Application.GetRealWidth(81),
- Y = Application.GetRealHeight(98),
- //Gravity = Gravity.CenterVertical;
- UnSelectedImagePath = "ZigeeLogic/back.png",
- };
- topRowLayout.AddChidren(back);
- back.MouseDownEventHandler += (sender, e) => {
RemoveFromParent();
- UserView.HomePage.Instance.ScrollEnabled = true;
};
-
- var foolrname = new Button
+ view.foolrnameBtn.Text = Config.Instance.Home.GetCurrentFloorName;
+ if (Config.Instance.Home.FloorDics.Count < 2)
{
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- TextAlignment = TextAlignment.CenterRight,
- X = Application.GetRealWidth(1080 - 400 - 120),
- Width = Application.GetRealWidth(400),
- Height = Application.GetRealHeight(69),
- Y = Application.GetRealHeight(92),
- TextID = MyInternationalizationString.customroom,
- };
- topRowLayout.AddChidren(foolrname);
- var dropdown = new Button
+ ///娌℃湁妤煎眰鎴栬�呭彧鏈変竴涓ゼ灞傦紝榛樿涓嶆樉绀哄浘鏍囧拰鏂囨湰;
+ view.foolrnameBtn.Visible = false;
+ view.dropdownBtn.Visible = false;
+ view.foolrclickBtn.Visible = false;
+ }
+ if (Config.Instance.Home.FloorDics.Count == 0)
{
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- TextAlignment = TextAlignment.CenterRight,
- X = foolrname.Right,
- Width = Application.GetRealWidth(72),
- Height = Application.GetRealHeight(72),
- Y = Application.GetRealHeight(92),
- UnSelectedImagePath = "ZigeeLogic/drop-down.png",
- };
- topRowLayout.AddChidren(dropdown);
+ Config.Instance.Home.CurrentFloorId = "";
+ }
#endregion
-
+
///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱
- if (Common.Room.Lists.Count == 0)
+ var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms();
+ if (listAllRoom.Count == 0)
{
return;
}
- ///鎴块棿婊戝姩鎺т欢
- roomhorizontalScrol = new HorizontalScrolViewLayout()
- {
- Width = Application.GetRealWidth(1080 - 58),
- Height = Application.GetRealHeight(200),
- Y = topRowLayout.Bottom,
- X = Application.GetRealWidth(58),
- };
+
this.AddChidren(roomhorizontalScrol);
-
-
-
- middle = new VerticalScrolViewLayout();
middle.Y = roomhorizontalScrol.Bottom;
- middle.Height = Application.GetRealHeight(1920 - 260 - 200 - 184);
- middle.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
this.AddChidren(middle);
-
- var saveframeLayout = new FrameLayout
- {
- Y = middle.Bottom,
- Height = Application.GetRealHeight(260),
- BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
- };
- this.AddChidren(saveframeLayout);
-
- var btnsave = new Button
- {
- X = Application.GetRealWidth(85),
- Height = Application.GetRealHeight(130),
- Width = Application.GetRealWidth(910),
- Radius = (uint)Application.GetRealHeight(60),
- BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
- TextID = MyInternationalizationString.Save,
- TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
- };
- saveframeLayout.AddChidren(btnsave);
-
- btnsave.MouseUpEventHandler += (sender2, e2) =>
+ 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 Alert(Language.StringByID(MyInternationalizationString.Prompt),
- Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
- Language.StringByID(MyInternationalizationString.complete));
+ var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+ Language.StringByID(MyInternationalizationString.scenetip),
+ Language.StringByID(MyInternationalizationString.confrim));
alert.Show();
return;
}
@@ -161,73 +94,130 @@
}
actionsInfo.Add("LinkType", 2);
LogicIfon.AddSceneactions(tempScene, actionsInfo);
- var logicCommunalPage = new LogicCommunalPage();
- UserView.HomePage.Instance.AddChidren(logicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- logicCommunalPage.Show(() => { });
+ 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(() => { });
+ }
};
- ///閫変腑妤煎眰
- foolrname.MouseUpEventHandler += (sender, e) =>
+ ///妤煎眰鐐瑰嚮浜嬩欢
+ view.foolrclickBtn.MouseUpEventHandler += (sender, e) =>
{
+
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
this.AddChidren(flMain);
flMain.MouseUpEventHandler += (sender2, e2) =>
{
flMain.RemoveFromParent();
};
+ var foolrbjicon = new FrameLayout
+ {
+
+ 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(foolrbjicon);
+
+ var btnfoolrtext = new Button
+ {
+ 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(400),
- Height = Application.GetRealHeight(600),
- X = Application.GetRealWidth(1080 - 400 - 60),
- Y = Application.GetRealHeight(184 + 50),
- BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
- Radius = (uint)Application.GetRealHeight(30),
+ Width = Application.GetRealWidth(450),
+ Height = foolrbjicon.Height - btnfoolrtext.Height,
+ X = Application.GetRealWidth(80),
+ Y = btnfoolrtext.Bottom,
};
- flMain.AddChidren(foolrbj);
- ///榛樿璋冭瘯
- List<string> foolrlist = new List<string> { "涓�妤�", "浜屾ゼ", "涓夋ゼ" };
+ foolrbjicon.AddChidren(foolrbj);
- foreach (var foolr in foolrlist)
+ foreach (var foolr in Config.Instance.Home.FloorDics)
{
- var foolrRowLayout = new FrameLayout
+ var foolrRowLayout = new RowLayout
{
Height = Application.GetRealHeight(150),
+ LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
};
foolrbj.AddChidren(foolrRowLayout);
+
+ var btnfoolricon = new Button
+ {
+ 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(160),
- Text = foolr,
- TextAlignment = TextAlignment.Center,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- //SelectedTextColor=0xfffc744b,
+ Height = Application.GetRealHeight(150),
+ Text = foolr.Value,
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+ Tag = foolr.Key,
+ X = btnfoolricon.Right + Application.GetRealWidth(12),
+ TextSize = 14,
};
foolrRowLayout.AddChidren(btnfoolrname);
+ if (view.foolrnameBtn.Text == foolr.Value)
+ {
+ btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png";
+ btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor;
+ }
-
- EventHandler<MouseEventArgs> foolrclick = (sender13, e13) =>
+ EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) =>
{
roomhorizontalScrol.RemoveAll();
- foolrname.Text = btnfoolrname.Text;
+ view.foolrnameBtn.Text = btnfoolrname.Text;
+ middle.RemoveAll();
flMain.RemoveFromParent();
- ///澶囨敞锛氭樉绀洪�変腑妤煎眰鐨勬墍鏈夋埧闂�
- AllRoomView(Common.Room.Lists);
+ var list = Method.GetRoomList(sceneType, btnfoolrname.Tag.ToString());
+ AllRoomView(list);
+
};
- foolrRowLayout.MouseUpEventHandler += foolrclick;
- btnfoolrname.MouseUpEventHandler += foolrclick;
+ foolrRowLayout.MouseUpEventHandler += foolrnameclick;
+ btnfoolrname.MouseUpEventHandler += foolrnameclick;
}
- };
+ };
+ ///鎴块棿鍒楄〃
+ var roomlists = Method.GetRoomList(sceneType, Config.Instance.Home.CurrentFloorId);
+ if (roomlists.Count == 0)
+ {
+ ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱
+ return;
+ }
///绗竴娆¤繘鏉�
- AllRoomView(Common.Room.Lists);
+ AllRoomView(roomlists);
}
/// <summary>
@@ -278,12 +268,17 @@
roomTextButton.IsSelected = false;
roomTextButton = roomnameBtn;
roomnameBtn.IsSelected = true;
- SceneView(room.SceneUIList);
+ 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;
@@ -291,7 +286,7 @@
roomTextButton.IsSelected = false;
roomTextButton = roomnameBtn;
roomnameBtn.IsSelected = true;
- SceneView(room.SceneUIList);
+ SceneView(room.ListSceneId);
};
roomnameBtn.MouseUpEventHandler += roomclick;
roombjBtn.MouseUpEventHandler += roomclick;
@@ -302,11 +297,16 @@
/// 鏄剧ず鎵�鏈夌殑鍦烘櫙鐨勬柟娉�
/// </summary>
/// <param name="scenelist"></param>
- void SceneView(List<SceneUI>scenelist)
+ void SceneView(List<int>scenelist)
{
middle.RemoveAll();
- foreach (var scene in scenelist)
+ foreach (var sceneId in scenelist)
{
+ var scene = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(sceneId);
+ if (scene == null)
+ {
+ continue;
+ }
var sceneFramelayout = new FrameLayout
{
Height = Application.GetRealHeight(160),
@@ -314,11 +314,10 @@
};
middle.AddChidren(sceneFramelayout);
-
var sceneIconBtn = new Button
{
- Width = Application.GetRealWidth(81),
- Height = Application.GetRealHeight(81),
+ Width = Application.GetMinRealAverage(81),
+ Height = Application.GetMinRealAverage(81),
X = Application.GetRealWidth(58),
Y = Application.GetRealHeight(55),
UnSelectedImagePath = "ZigeeLogic/scene.png",
@@ -332,8 +331,7 @@
Width = Application.GetRealWidth(850),
Height = Application.GetRealHeight(130),
X = Application.GetRealWidth(176 + 10),
- LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-
+ LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
};
sceneFramelayout.AddChidren(sceneRow);
@@ -343,20 +341,29 @@
TextAlignment = TextAlignment.CenterLeft,
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
SelectedTextColor = ZigbeeColor.Current.LogicAddColor,
+ TextSize = 14,
};
sceneRow.AddChidren(scenename);
var selectedBtn = new Button
{
- Width = Application.GetRealWidth(58),
- Height = Application.GetRealHeight(58),
+ 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) =>
{
tempScene = scene;
--
Gitblit v1.8.0