From a7e8f9ea1b9d0b9c8e9c09a8101e65c59a475465 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 09 七月 2020 17:07:31 +0800
Subject: [PATCH] 2020-07-09-01
---
ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs | 955 +++++++++++++++--------------------------------------------
1 files changed, 241 insertions(+), 714 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
old mode 100755
new mode 100644
index b6b4f84..5efe52a
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
@@ -14,83 +14,43 @@
public LockLogicCommunalPage()
{
- UserView.HomePage.Instance.RemoveViewByTag("LockLogic");
- Tag = "LockLogic";
+ UserView.HomePage.Instance.RemoveViewByTag("Logic");
+ Tag = "Logic";
}
EditText logicTextBox;
public async void Show(Action action)
{
#region 鏈�涓婇潰鐨勫竷灞�浠g爜
- var topRowLayout = new RowLayout
- {
- BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
- Height = Application.GetRealHeight(184),
- LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
- };
- this.AddChidren(topRowLayout);
-
- var titleName = new Button
- {
- TextSize = 17,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- TextAlignment = TextAlignment.CenterLeft,
- X = Application.GetRealWidth(176),
- Width = Application.GetRealWidth(600),
- Height = Application.GetRealHeight(69),
- Y = Application.GetRealHeight(92),
- TextID = MyInternationalizationString.selection,
- IsBold = true,
- };
- topRowLayout.AddChidren(titleName);
+ UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦
+ TopView view = new TopView();
+ this.AddChidren(view.TopRowView());
if (Common.Logic.CurrentLogic.LogicId != 0)
{
- titleName.Text = Language.StringByID(MyInternationalizationString.editlinkageevent);
+ view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.editlinkageevent);
}
else
{
- titleName.Text = Language.StringByID(MyInternationalizationString.addlinkageevent);
+ view.toptitleNameBtn.Text = Language.StringByID(MyInternationalizationString.addlinkageevent);
}
-
- 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();
- };
-
- 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) =>
+ view.clickBtn.MouseDownEventHandler += (sender, e) =>
{
action();
RemoveFromParent();
};
-
- #endregion
-
-
var middle = new VerticalScrolViewLayout
{
- Y = topRowLayout.Bottom,
- Height = Application.GetRealHeight(1920 - 184 - 180),
+ Y = view.topRowLayout.Bottom,
+ Height = Application.GetRealHeight(Method.H - 184 - 180),
BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
};
this.AddChidren(middle);
+ var saveBtn = new LogicView.SaveView();
+ saveBtn.frameLayout.Y = middle.Bottom;
+ saveBtn.frameLayout.Height = Application.GetRealHeight(180);
+ this.AddChidren(saveBtn.Show());
+ #endregion
#region -----鑷姩鍖栧悕绉� 璁剧疆鍚嶇О-----
var logicnamefl = new FrameLayout
@@ -136,68 +96,16 @@
#endregion
#region -----鏄剧ず閫昏緫鏉′欢-----
-
-
- var conditionFrameLayout = new FrameLayout
- {
- Height = Application.GetRealHeight(160),
- BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- };
- middle.AddChidren(conditionFrameLayout);
-
-
- var conditionRowLayout = new RowLayout
- {
- Y = Application.GetRealHeight(30),
- Width = Application.GetRealWidth(965),
- Height = Application.GetRealHeight(130),
- X = Application.GetRealWidth(58),
- LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
- };
- conditionFrameLayout.AddChidren(conditionRowLayout);
-
-
- conditionRowLayout.AddChidren(new Button
- {
-
- Text = Language.StringByID(MyInternationalizationString.ifcondition),
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- Width = Application.GetRealWidth(300),
- Height = Application.GetRealHeight(60),
- TextSize = 15,
- Gravity = Gravity.CenterVertical,
- });
-
- var conditionadd1 = new Button
- {
-
- Y = Application.GetRealHeight(30),
- Width = Application.GetRealWidth(57),
- Height = Application.GetRealHeight(130),
- X = Application.GetRealWidth(965 + 58),
-
- };
- conditionFrameLayout.AddChidren(conditionadd1);
-
- var conditionadd = new Button
- {
-
- Width = Application.GetRealWidth(58),
- Height = Application.GetRealHeight(58),
- UnSelectedImagePath = "ZigeeLogic/add.png",
- X = Application.GetRealWidth(965 - 58),
- Gravity = Gravity.CenterVertical,
-
- };
- conditionRowLayout.AddChidren(conditionadd);
+ LogicView.Addview addconditionview = new LogicView.Addview();
+ addconditionview.iconBtn.Visible = true;
+ addconditionview.titleBtn.TextID = MyInternationalizationString.ifcondition;
+ middle.AddChidren(addconditionview.AddDeviceView());
///娣诲姞鏉′欢鐨勭偣鍑讳簨浠�
- EventHandler<MouseEventArgs> conditionaddclick = (sender, e) =>
+ addconditionview.clickBtn.MouseUpEventHandler = (sender, e) =>
{
AddCondition(-1);
};
- conditionadd.MouseUpEventHandler += conditionaddclick;
- conditionadd1.MouseUpEventHandler += conditionaddclick;
+
List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>();
ListConditions.Clear();
ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions);
@@ -207,72 +115,21 @@
if (i == (ListConditions.Count - 1))
{
- var addfl = new FrameLayout
- {
- Height = Application.GetRealHeight(160 + 30 + 50),
- BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- };
- middle.AddChidren(addfl);
- var addbtn = new Button
- {
- Height = Application.GetRealHeight(130 + 50),
- Width = Application.GetRealWidth(908),
- Y = Application.GetRealHeight(30),
- X = Application.GetRealWidth(86),
- UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png",
- };
- addfl.AddChidren(addbtn);
+ LogicView.AddDeviceView addflview = new LogicView.AddDeviceView();
+ addflview.titleBtn.TextID = MyInternationalizationString.selectunlockingmode;
+ middle.AddChidren(addflview.AddFl());
+ addflview.clickBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ AddCondition(-1);
+ };
-
- var addtextbtn = new Button
- {
- Height = Application.GetRealHeight(58),
- Width = Application.GetRealWidth(500),
- Y = Application.GetRealHeight(45 + 30),
- TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- TextID = MyInternationalizationString.selectunlockingmode,
- X = Application.GetRealWidth(290),
- TextSize = 14,
- };
- addfl.AddChidren(addtextbtn);
-
- EventHandler<MouseEventArgs> addconditionsclick = (sender, e) =>
- {
- AddCondition(-1);
- };
- addbtn.MouseUpEventHandler += addconditionsclick;
- addtextbtn.MouseUpEventHandler += addconditionsclick;
}
else
{
- var devicesFrameLayout = new FrameLayout
- {
- Height = Application.GetRealHeight(130),
- BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- };
- middle.AddChidren(devicesFrameLayout);
-
- ///鏄剧ず鍥炬爣
- var conditionIcon = new Button
- {
- Width = Application.GetRealWidth(81),
- Height = Application.GetRealHeight(81),
- X = Application.GetRealWidth(104),
- Y = Application.GetRealHeight(25),
- //UnSelectedImagePath = "ZigeeLogic/time.png",
-
- };
- devicesFrameLayout.AddChidren(conditionIcon);
-
-
- var conditionsRowLayout = new RowLayout
- {
- Width = Application.GetRealWidth(800),
- Height = Application.GetRealHeight(130),
- X = Application.GetRealWidth(222),
- LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
- };
- devicesFrameLayout.AddChidren(conditionsRowLayout);
+ SelectedDeviceView selecteddevice = new SelectedDeviceView();
+ selecteddevice.Show(middle);
+ selecteddevice.stateRow.AddRightView(selecteddevice.edit);
+ selecteddevice.stateRow.AddRightView(selecteddevice.del);
var Type = int.Parse(ListConditions[i]["Type"]);
var conditions = ListConditions[i];
@@ -280,80 +137,24 @@
{
case 1:
{
- var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; });
- if (deviceinof == null)
- {
- deviceinof = new ZigBee.Device.CommonDevice();
- //continue;
- }
- ///鏄剧ず璁惧鍚嶇О
- var btndevice = new Button
- {
- Y = Application.GetRealHeight(20),
- Height = Application.GetRealHeight(50),
- Width = Application.GetRealWidth(400),
- TextAlignment = TextAlignment.CenterLeft,
- Text = deviceinof.DeviceEpointName,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- TextSize = 14,
- };
- conditionsRowLayout.AddChidren(btndevice);
-
- ///鍖哄煙(鎴块棿)鍚嶇ОButton
- var btnregionname = new Button
- {
- Y = btndevice.Bottom + Application.GetRealHeight(10),
- Width = Application.GetRealWidth(400),
- TextAlignment = TextAlignment.CenterLeft,
- Height = Application.GetRealHeight(50),
- Text = "",//Language.StringByID(MyInternationalizationString.customroom),
- TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
- };
- conditionsRowLayout.AddChidren(btnregionname);
- ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
- Device.Logic.Send.RoomNmae(btnregionname, deviceinof);
-
-
- var deviceedit = new Button
- {
- BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
- Text = Language.StringByID(MyInternationalizationString.edit),
- TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
- Tag = i,
- };
- conditionsRowLayout.AddRightView(deviceedit);
- deviceedit.MouseUpEventHandler += (sender, e) =>
- {
-
- int intvalue = int.Parse(deviceedit.Tag.ToString());
- AddCondition(intvalue);
- };
-
- ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
- var devicestatus = new Button
- {
- Width = Application.GetRealWidth(400),
- Height = Application.GetRealHeight(130),
- Gravity = Gravity.CenterVertical,
- TextAlignment = TextAlignment.CenterRight,
- X = Application.GetRealWidth(400),
- TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
- TextSize = 14,
- };
- conditionsRowLayout.AddChidren(devicestatus);
-
+ var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
+ selecteddevice.deviceNameBtn.Visible = true;
+ selecteddevice.deviceNameBtn.Text = LocalDevice.Current.GetDeviceEpointName(deviceinof);
+ selecteddevice.regionNameBtn.Visible = true;
+ Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof);
+ selecteddevice.edit.Tag = i;
switch (deviceinof.Type)
{
case DeviceType.DoorLock:
{
- conditionIcon.UnSelectedImagePath = "ZigeeLogic/doorlock.png";
+ selecteddevice.iconBtn.UnSelectedImagePath = "ZigeeLogic/doorlock.png";
for (int a = 0; a < Common.Logic.CurrentLogic.Accounts.Count; a++)
{
if (Common.Logic.CurrentLogic.Accounts[a]["Type"] == "1")
{
if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"])
{
- devicestatus.Text = Common.Logic.CurrentLogic.Accounts[a]["AccountName"];
+ selecteddevice.selecetddevicestateBtn.Text = Common.Logic.CurrentLogic.Accounts[a]["AccountName"];
break;
}
}
@@ -365,28 +166,29 @@
}
break;
}
- ///鍒犻櫎鎺т欢
- var del = new Button
+
+ ///缂栬緫
+ selecteddevice.edit.MouseUpEventHandler += (sender, e) =>
{
- BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1,
- Text = Language.StringByID(MyInternationalizationString.del),
+ int intvalue = int.Parse(selecteddevice.edit.Tag.ToString());
+ AddCondition(intvalue);
};
- conditionsRowLayout.AddRightView(del);
- del.MouseUpEventHandler += (sender, e) =>
+ ///鍒犻櫎鎺т欢
+ selecteddevice.del.MouseUpEventHandler += (sender, e) =>
{
var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
- Language.StringByID(MyInternationalizationString.doyouwanttodelete),
- Language.StringByID(MyInternationalizationString.confrim));
+ Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+ Language.StringByID(MyInternationalizationString.confrim));
alert.Show();
alert.ConfirmClickEvent += () =>
{
Common.Logic.CurrentLogic.Conditions.Remove(conditions);
- var lockLogicCommunalPage = new LockLogicCommunalPage();
- UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- lockLogicCommunalPage.Show(() => { });
+ selecteddevice.selecetdFrameLayout.RemoveFromParent();
+ //var lockLogicCommunalPage = new LockLogicCommunalPage();
+ //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
+ //UserView.HomePage.Instance.PageIndex += 1;
+ //lockLogicCommunalPage.Show(() => { });
};
-
};
}
@@ -396,68 +198,16 @@
#endregion
#region ----鏄剧ず鎵ц鐩爣----
+ LogicView.Addview addactionview = new LogicView.Addview();
+ addactionview.iconBtn.Visible = true;
+ addactionview.titleBtn.TextID = MyInternationalizationString.execute;
+ middle.AddChidren(addactionview.AddDeviceView());
- var targetFrameLayout = new FrameLayout
- {
- Height = Application.GetRealHeight(160),
- BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- };
- middle.AddChidren(targetFrameLayout);
-
-
- var targetRowLayout = new RowLayout
- {
- Y = Application.GetRealHeight(30),
- Width = Application.GetRealWidth(965),
- Height = Application.GetRealHeight(130),
- X = Application.GetRealWidth(58),
- LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
- };
- targetFrameLayout.AddChidren(targetRowLayout);
-
-
- var btntargettitle = new Button
- {
-
- Text = Language.StringByID(MyInternationalizationString.execute),
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- Width = Application.GetRealWidth(300),
- Height = Application.GetRealHeight(60),
- TextSize = 15,
- Gravity = Gravity.CenterVertical,
- };
- targetRowLayout.AddChidren(btntargettitle);
-
- var btntargetadd1 = new Button
- {
-
- Y = Application.GetRealHeight(30),
- Width = Application.GetRealWidth(57),
- Height = Application.GetRealHeight(130),
- X = Application.GetRealWidth(965 + 58),
- };
- targetFrameLayout.AddChidren(btntargetadd1);
-
- var btntargetadd = new Button
- {
- Width = Application.GetRealWidth(58),
- Height = Application.GetRealHeight(58),
- UnSelectedImagePath = "ZigeeLogic/add.png",
- X = Application.GetRealWidth(965 - 58),
- Gravity = Gravity.CenterVertical,
- };
- targetRowLayout.AddChidren(btntargetadd);
- EventHandler<MouseEventArgs> btntargetaddclick = (sender, e) =>
+ addactionview.clickBtn.MouseUpEventHandler += (sender, e) =>
{
Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
- var addAction = new AddAction();
- UserView.HomePage.Instance.AddChidren(addAction);
- UserView.HomePage.Instance.PageIndex += 1;
- addAction.Show();
+ Method.View(LogicView.IfString.Action_LockAction, LogicView.IfString.Action_LockScene);
};
- btntargetadd1.MouseUpEventHandler += btntargetaddclick;
- btntargetadd.MouseUpEventHandler += btntargetaddclick;
List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>();
ListActions.Clear();
@@ -469,157 +219,42 @@
if (i == (ListActions.Count - 1))
{
- var addfl = new FrameLayout
- {
- Height = Application.GetRealHeight(160 + 30 + 50),
- BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- };
- middle.AddChidren(addfl);
- var addbtn = new Button
- {
- Height = Application.GetRealHeight(130 + 50),
- Width = Application.GetRealWidth(908),
- Y = Application.GetRealHeight(30),
- X = Application.GetRealWidth(86),
- UnSelectedImagePath = "ZigeeLogic/logicaddcolor.png",
- };
- addfl.AddChidren(addbtn);
-
-
- var addtextbtn = new Button
- {
- Height = Application.GetRealHeight(58),
- Width = Application.GetRealWidth(300),
- Y = Application.GetRealHeight(45 + 30),
- TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- TextID = MyInternationalizationString.lockaddaction,
- X = Application.GetRealWidth(390),
- TextSize = 14,
- };
- addfl.AddChidren(addtextbtn);
- EventHandler<MouseEventArgs> addfunctionclick = (sender, e) =>
+ LogicView.AddDeviceView addflview = new LogicView.AddDeviceView();
+ addflview.titleBtn.TextID = MyInternationalizationString.addaction;
+ middle.AddChidren(addflview.AddFl());
+ addflview.clickBtn.MouseUpEventHandler += (sender, e) =>
{
Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
- var addAction = new AddAction();
- UserView.HomePage.Instance.AddChidren(addAction);
- UserView.HomePage.Instance.PageIndex += 1;
- addAction.Show();
+ Method.View(LogicView.IfString.Action_LockAction, LogicView.IfString.Action_LockScene);
};
- addbtn.MouseUpEventHandler += addfunctionclick;
- addtextbtn.MouseUpEventHandler += addfunctionclick;
}
else
{
- var devicesFrameLayout = new FrameLayout
- {
- Height = Application.GetRealHeight(130),
- BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- };
- middle.AddChidren(devicesFrameLayout);
-
- ///鏄剧ず鍥炬爣
- var actionsIcon = new Button
- {
- Width = Application.GetRealWidth(81),
- Height = Application.GetRealHeight(81),
- X = Application.GetRealWidth(104),
- Y = Application.GetRealHeight(25),
- // UnSelectedImagePath = "ZigeeLogic/time.png",
-
- };
- devicesFrameLayout.AddChidren(actionsIcon);
-
-
- var actionsrowLayout = new RowLayout
- {
- Width = Application.GetRealWidth(800),
- Height = Application.GetRealHeight(130),
- X = Application.GetRealWidth(222),
- LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
- };
- devicesFrameLayout.AddChidren(actionsrowLayout);
-
-
+ SelectedDeviceView actiondevice = new SelectedDeviceView();
+ actiondevice.Show(middle);
var linkType = int.Parse(ListActions[i]["LinkType"].ToString());
var actions = ListActions[i];
-
+ string name = "";
+ string icon = "";
+ string state = "";
switch (linkType)
{
+
case 0:
+ case 8:
{
- var obj1 = actions["DeviceAddr"].ToString();
- var obj2 = actions["Epoint"].ToString();
- var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); });
- if (deviceinof == null)
- {
- deviceinof = new ZigBee.Device.CommonDevice();
- //continue;
- }
- ///璁惧鍚嶇ОButton
- var btndevicename = new Button
- {
- Y = Application.GetRealHeight(20),
- Height = Application.GetRealHeight(50),
- Width = Application.GetRealWidth(450),
- TextAlignment = TextAlignment.CenterLeft,
- Text = deviceinof.DeviceEpointName,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- TextSize = 14,
- };
- actionsrowLayout.AddChidren(btndevicename);
-
- ///鍖哄煙(鎴块棿)鍚嶇ОButton
- var btnregionname = new Button
- {
- Y = btndevicename.Bottom + Application.GetRealHeight(10),
- Width = Application.GetRealWidth(450),
- TextAlignment = TextAlignment.CenterLeft,
- Height = Application.GetRealHeight(50),
- Text = "",//Language.StringByID(MyInternationalizationString.customroom),
- TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
- };
- actionsrowLayout.AddChidren(btnregionname);
- ///閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
- Device.Logic.Send.RoomNmae(btnregionname, deviceinof);
- ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠�
- var devicestatus = new Button
- {
- Width = Application.GetRealWidth(350),
- Height = Application.GetRealHeight(130),
- Gravity = Gravity.CenterVertical,
- TextAlignment = TextAlignment.CenterRight,
- X = Application.GetRealWidth(450),
- TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
- TextSize = 14,
- };
- actionsrowLayout.AddChidren(devicestatus);
-
- ///缂栬緫璁惧鐘舵�丅utton
- var deviceedit = new Button
- {
- BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1,
- Text = Language.StringByID(MyInternationalizationString.edit),
- TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
- };
- actionsrowLayout.AddRightView(deviceedit);
-
- ///缂栬緫鐐瑰嚮浜嬩欢
- deviceedit.MouseUpEventHandler += (sender, e) =>
- {
-
- var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
- this.AddChidren(flMain);
- LockAddDevice.CurrentDeviceStateView(flMain, deviceinof, true);
- };
-
+ var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
+ name =LocalDevice.Current.GetDeviceEpointName(deviceinof);
+ actiondevice.regionNameBtn.Visible = true;
+ Method.RoomNmae(actiondevice.regionNameBtn, deviceinof);
switch (deviceinof.Type)
{
case DeviceType.OnOffOutput:
{
- actionsIcon.UnSelectedImagePath = "ZigeeLogic/light.png";
+ icon = "ZigeeLogic/light.png";
var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
if (TaskList == null)
@@ -632,18 +267,18 @@
{
if (status["Data1"].ToString() == "0")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+ state = Language.StringByID(MyInternationalizationString.close);
}
else if (status["Data1"].ToString() == "1")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
+ state = Language.StringByID(MyInternationalizationString.open);
}
else if (status["Data1"].ToString() == "2")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff);
+ state = Language.StringByID(MyInternationalizationString.onoff);
}
}
@@ -653,7 +288,7 @@
break;
case DeviceType.DimmableLight:
{
- actionsIcon.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png";
+ icon = "ZigeeLogic/dimmableLight.png";
var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
if (TaskList == null)
{
@@ -665,18 +300,18 @@
{
var intvalue = int.Parse(status["Data1"]);
var lightbrightnessvalue = (intvalue * 100) / 254;
- devicestatus.Text = lightbrightnessvalue.ToString() + "%";
+ state = lightbrightnessvalue.ToString() + "%";
}
else if (status["TaskType"].ToString() == "1")
{
if (status["Data1"].ToString() == "0")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+ state = Language.StringByID(MyInternationalizationString.close);
}
else if (status["Data1"].ToString() == "2")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff);
+ state = Language.StringByID(MyInternationalizationString.onoff);
}
}
@@ -687,7 +322,7 @@
break;
case DeviceType.WindowCoveringDevice:
{
- actionsIcon.UnSelectedImagePath = "ZigeeLogic/curtain.png";
+ icon = "ZigeeLogic/curtain.png";
var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
if (TaskList == null)
{
@@ -699,15 +334,15 @@
{
if (status["Data1"] == "0")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
+ state = Language.StringByID(MyInternationalizationString.open);
}
else if (status["Data1"] == "1")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+ state = Language.StringByID(MyInternationalizationString.close);
}
else if (status["Data1"] == "5")
{
- devicestatus.Text = status["Data2"] + "%";
+ state = status["Data2"] + "%";
}
}
@@ -716,7 +351,7 @@
break;
case DeviceType.AirSwitch:
{
- actionsIcon.UnSelectedImagePath = "ZigeeLogic/airswitch.png";
+ icon = "ZigeeLogic/airswitch.png";
var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
if (TaskList == null)
@@ -729,18 +364,18 @@
{
if (status["Data1"].ToString() == "0")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+ state = Language.StringByID(MyInternationalizationString.close);
}
else if (status["Data1"].ToString() == "1")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.open);
+ state = Language.StringByID(MyInternationalizationString.open);
}
else if (status["Data1"].ToString() == "2")
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.onoff);
+ state = Language.StringByID(MyInternationalizationString.onoff);
}
}
@@ -750,7 +385,7 @@
break;
case DeviceType.Thermostat:
{
- actionsIcon.UnSelectedImagePath = "ZigeeLogic/ac.png";
+ icon = "ZigeeLogic/ac.png";
var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
if (TaskList == null)
@@ -761,6 +396,7 @@
bool ifclose = false;
foreach (var status in TaskList)
{
+
if (TaskList.Count == 1)
{
//鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱
@@ -772,7 +408,6 @@
{
ifclose = true;
}
-
if (status["TaskType"].ToString() == "5")
{
if (status["Data1"] == "3")
@@ -846,16 +481,109 @@
}
if (ifclose)
{
- devicestatus.Text = modetext + ";" + temperaturetext + "鈩�;" + speedtext;
+ state = modetext + ";" + temperaturetext + "鈩�;" + speedtext;
}
else
{
- devicestatus.Text = Language.StringByID(MyInternationalizationString.close);
+ state = Language.StringByID(MyInternationalizationString.close);
}
}
break;
+ case DeviceType.DoorLock:
+ {
+ //闂ㄩ攣鐗规畩
+ icon = "ZigeeLogic/doorlock.png";
+ if (actions["PassData"].ToString() == "055704010112")
+ {
+ state = Language.StringByID(MyInternationalizationString.logicopen);
+ }
+ else
+ {
+ state = Language.StringByID(MyInternationalizationString.logicclose);
+ }
+ }
+ break;
+ case DeviceType.ColorTemperatureLight:
+ {
+ icon = "ZigeeLogic/nightLight.png";
+ var taskList = actions["TaskList"] as List<Dictionary<string, string>>;
+ if (taskList == null)
+ {
+ continue;
+ }
+ foreach (var tasks in taskList)
+ {
+ switch (tasks["TaskType"])
+ {
+ case "1":
+ {
+ if (tasks["Data1"] == "0")
+ {
+ state += Language.StringByID(MyInternationalizationString.close) + ";";
+ }
+ else
+ {
+ state += Language.StringByID(MyInternationalizationString.open) + ";";
+ }
+ }
+ break;
+ }
+ }
+ foreach (var tasks in taskList)
+ {
+ switch (tasks["TaskType"])
+ {
+
+ case "3":
+ {
+ var intvalue = int.Parse(tasks["Data1"]);
+ var lightbrightnessvalue = (intvalue * 100) / 254;
+ state += Language.StringByID(MyInternationalizationString.brightness) + lightbrightnessvalue.ToString() + "%;";
+ }
+ break;
+
+ }
+ }
+ foreach (var tasks in taskList)
+ {
+ switch (tasks["TaskType"])
+ {
+
+ case "7":
+ {
+ if (tasks["Data1"] == "0")
+ {
+ state += Language.StringByID(MyInternationalizationString.buzzer) + Language.StringByID(MyInternationalizationString.close) + ";";
+ }
+ else
+ {
+ state += Language.StringByID(MyInternationalizationString.buzzer) + Language.StringByID(MyInternationalizationString.open) + ";";
+ }
+ }
+ break;
+
+ }
+ }
+ foreach (var tasks in taskList)
+ {
+ switch (tasks["TaskType"])
+ {
+
+ case "8":
+ {
+ var intvalue = int.Parse(tasks["Data1"]);
+ var colorTemperatureValue = 1000000 / (intvalue * 100);
+ state += Language.StringByID(MyInternationalizationString.colorTemperature) + colorTemperatureValue.ToString() + "K";
+ }
+ break;
+ }
+ }
+
+ state = state.TrimEnd(';');//鍘绘帀鏈�鍚庨偅涓�";"
+ }
+ break;
}
@@ -863,15 +591,15 @@
break;
case 2:
{
-
- //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙;
- var sceneinof = UserCenter.HdlSceneLogic.Current.GetAllRoomSceneList().Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); });
+ actiondevice.edit.Visible = false;//闅愯棌缂栬緫鎸夐挳(鍦烘櫙涓嶉渶瑕佺紪杈�)
+ //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙;
+ var sceneinof = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(Convert.ToInt32(actions["DeviceAddr"].ToString()));
//鏈湴娌℃湁瀛樺湪;
if (sceneinof == null)
{
//瀹炵幇鐩殑:鏄剧ず鍑烘潵璁╁彲浠ヨ嚜宸辨槸鍚﹀垹闄�
sceneinof = new SceneUI();
- #region -----
+ #region --------
////鍦ㄧ綉鍏虫煡鎵捐鍦烘櫙;
////鏍囪闂:缃戠粶璇锋眰锛屽瓨鍦ㄨ鍥惧姞杞藉揩鎱㈢殑闂锛�
//sceneinof = await Send.GetScene(int.Parse(actions["DeviceAddr"].ToString()));
@@ -889,69 +617,63 @@
#endregion
}
-
-
-
- actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png";
- ///璁惧鍚嶇ОButton
- var btndevicename = new Button
- {
- Y = Application.GetRealHeight(20),
- Height = Application.GetRealHeight(50),
- Width = Application.GetRealWidth(500),
- TextAlignment = TextAlignment.CenterLeft,
- Text = sceneinof.Name,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- TextSize = 14,
- };
- actionsrowLayout.AddChidren(btndevicename);
-
- ///鍖哄煙(鎴块棿)鍚嶇ОButton
- var btnregionname = new Button
- {
- Y = btndevicename.Bottom + Application.GetRealHeight(10),
- Width = Application.GetRealWidth(500),
- TextAlignment = TextAlignment.CenterLeft,
- Height = Application.GetRealHeight(50),
- Text = "",//Language.StringByID(MyInternationalizationString.customroom),
- TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
- };
- actionsrowLayout.AddChidren(btnregionname);
+ icon = "ZigeeLogic/scene.png";
+ name = sceneinof.Name;
+ actiondevice.regionNameBtn.Visible = true;
/////閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
- Common.Room room = new Common.Room();
- btnregionname.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id);
- //Send.RoomNmae(btnregionname, deviceinof);
-
-
+ actiondevice.regionNameBtn.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id);
}
break;
-
}
- ///鍒犻櫎鎺т欢
- var del = new Button
+ if (linkType != 2)
{
- BackgroundColor = ZigbeeColor.Current.LogicDelBlackColor1,
- Text = Language.StringByID(MyInternationalizationString.del),
- };
- actionsrowLayout.AddRightView(del);
+ actiondevice.stateRow.AddRightView(actiondevice.edit);
+ }
+ actiondevice.stateRow.AddRightView(actiondevice.del);
+ //鐘舵��
+ actiondevice.deviceNameBtn.Visible = true;
+ actiondevice.deviceNameBtn.Text = name;
+ actiondevice.iconBtn.UnSelectedImagePath = icon;
+ actiondevice.selecetddevicestateBtn.Text = state;
- del.MouseUpEventHandler += (sender, e) =>
+ ///缂栬緫
+ actiondevice.edit.Tag = i.ToString();
+ actiondevice.edit.MouseUpEventHandler += (sender, e) =>
{
+ switch (linkType)
+ {
+ case 0:
+ case 8:
+ {
+ var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
+ var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+ this.AddChidren(flMain);
+ CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_lockaction", int.Parse(actiondevice.edit.Tag.ToString()));
+ }
+ break;
+
+
+ }
+ };
+ ///鍒犻櫎鎺т欢
+ actiondevice.del.MouseUpEventHandler += (sender, e) =>
+ {
+
var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
- Language.StringByID(MyInternationalizationString.doyouwanttodelete),
- Language.StringByID(MyInternationalizationString.confrim));
+ Language.StringByID(MyInternationalizationString.doyouwanttodelete),
+ Language.StringByID(MyInternationalizationString.confrim));
alert.Show();
alert.ConfirmClickEvent += () =>
{
Common.Logic.CurrentLogic.Actions.Remove(actions);
- var lockLogicCommunalPage = new LockLogicCommunalPage();
- UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- lockLogicCommunalPage.Show(() => { });
+ actiondevice.selecetdFrameLayout.RemoveFromParent();
+ //var lockLogicCommunalPage = new LockLogicCommunalPage();
+ //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
+ //UserView.HomePage.Instance.PageIndex += 1;
+ //lockLogicCommunalPage.Show(() => { });
};
-
};
}
@@ -960,208 +682,14 @@
#endregion
#region ----鎺ㄩ�佽缃�----
-
- var fraline1 = new FrameLayout
- {
- Height = Application.GetRealHeight(30),
- };
- middle.AddChidren(fraline1);
-
- var pushFrameLayout = new FrameLayout
- {
- Height = Application.GetRealHeight(160),
- BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- };
- middle.AddChidren(pushFrameLayout);
-
- var pushswitchRowlayout = new RowLayout
- {
- Y = Application.GetRealHeight(30),
- Width = Application.GetRealWidth(965),
- Height = Application.GetRealHeight(130),
- X = Application.GetRealWidth(58),
- LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
- };
- pushFrameLayout.AddChidren(pushswitchRowlayout);
-
- var btnswitchtxet = new Button
- {
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- Width = Application.GetRealWidth(300),
- Height = Application.GetRealHeight(60),
- Gravity = Gravity.CenterVertical,
- TextID = MyInternationalizationString.pushswitch,
- TextSize = 14,
- };
- pushswitchRowlayout.AddChidren(btnswitchtxet);
-
- var btnswitch = new Button
- {
- Width = Application.GetMinRealAverage(104),
- Height = Application.GetMinRealAverage(63),
- UnSelectedImagePath = "ZigeeLogic/logicclose.png",
- SelectedImagePath = "ZigeeLogic/logicopen.png",
- X = Application.GetRealWidth(965 - 104),
- Gravity = Gravity.CenterVertical,
- };
- pushswitchRowlayout.AddChidren(btnswitch);
-
-
- var custompushFrameLayout = new FrameLayout
- {
- Height = Application.GetRealHeight(0),
- BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- };
- middle.AddChidren(custompushFrameLayout);
-
- var custompushRowLayout = new RowLayout
- {
- Y = Application.GetRealHeight(30),
- Width = Application.GetRealWidth(965),
- Height = Application.GetRealHeight(130),
- X = Application.GetRealWidth(58),
- LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
- };
- custompushFrameLayout.AddChidren(custompushRowLayout);
-
- var btncustompush = new Button
- {
- TextID = MyInternationalizationString.custompush,
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
- Width = Application.GetRealWidth(300),
- Height = Application.GetRealHeight(60),
- Gravity = Gravity.CenterVertical,
- TextSize = 14,
- };
- custompushRowLayout.AddChidren(btncustompush);
-
-
- var custompushback = new Button
- {
- Width = Application.GetRealWidth(58),
- Height = Application.GetRealHeight(58),
- UnSelectedImagePath = "ZigeeLogic/next.png",
- X = Application.GetRealWidth(965 - 58),
- Gravity = Gravity.CenterVertical,
- };
- custompushRowLayout.AddChidren(custompushback);
- EventHandler<MouseEventArgs> customclick = (sender, e) =>
- {
- var CustomText = new CustomText();
- UserView.HomePage.Instance.AddChidren(CustomText);
- UserView.HomePage.Instance.PageIndex += 1;
- CustomText.Show();
-
- };
- btncustompush.MouseUpEventHandler += customclick;
- custompushback.MouseUpEventHandler += customclick;
- custompushRowLayout.MouseUpEventHandler += customclick;
-
+ Method.Push(middle);
#endregion
- bool tag = false;//鏍囪寮�鍏崇姸鎬�;
- btnswitch.MouseUpEventHandler += (sender1, e1) =>
- {
- btnswitch.IsSelected = !btnswitch.IsSelected;
- if (btnswitch.IsSelected)
- {
- tag = true;
- custompushFrameLayout.Height = Application.GetRealHeight(160);
- Common.Logic.CurrentLogic.LogicIsCustomPushText = 1;
-
- }
- else
- {
- tag = false;
- custompushFrameLayout.Height = Application.GetRealHeight(0);
- Common.Logic.CurrentLogic.LogicIsCustomPushText = 0;
- }
- Send.Zj(tag, Common.Logic.CurrentLogic);
- };
- if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0)
- {
- tag = false;
- btnswitch.IsSelected = false;
- custompushFrameLayout.Height = Application.GetRealHeight(0);
- }
- else
- {
- tag = true;
- btnswitch.IsSelected = true;
- custompushFrameLayout.Height = Application.GetRealHeight(160);
- }
- var saveFrameLayout = new FrameLayout
- {
- Y = middle.Bottom,
- Height = Application.GetRealHeight(180),
- BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
- };
- this.AddChidren(saveFrameLayout);
-
- var btnsave = new Button
- {
- X = Application.GetRealWidth(85),
- Height = Application.GetRealHeight(130),//194
- Width = Application.GetRealWidth(910),
- Radius = (uint)Application.GetRealHeight(60),
- BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor,
- TextID = MyInternationalizationString.Save,
- TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor,
- TextSize = 16,
- };
- saveFrameLayout.AddChidren(btnsave);
- btnsave.MouseUpEventHandler += async (sender, e) =>
- {
- var name = logicTextBox.Text.Trim();
- if (string.IsNullOrEmpty(logicTextBox.Text.Trim()))
- {
- var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
- Language.StringByID(MyInternationalizationString.PleaseEnterLogicName),
- Language.StringByID(MyInternationalizationString.confrim));
- alert.Show();
- return;
- }
- //var logicname = Common.Logic.LockLogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name);
- //if (logicname != null)
- //{
- // new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show();
- // return;
- //}
-
- Common.Logic.CurrentLogic.LogicName = name;
-
- //鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫
- CommonPage.Loading.Start();
- if (Common.Logic.CurrentLogic.LogicId == 0)
- {
- //鍙戦�佹坊鍔犻�昏緫鍛戒护
- var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic);
- if (logicifon != null && logicifon.LogicId != 0)
- {
- Common.Logic.CurrentLogic.LogicId = logicifon.LogicId;
- Common.Logic.LockLogicList.Add(Common.Logic.CurrentLogic);
- if (tag)
- {
- Send.Zj(tag, Common.Logic.CurrentLogic);
- }
- }
- }
- else
- {
- //鍙戦�佷慨鏀归�昏緫鍛戒护
- Send.AddModifyLogic(Common.Logic.CurrentLogic);
- }
-
- CommonPage.Loading.Hide();
- UserView.HomePage.Instance.RemoveViewByTag("LockLogic");
- UserView.HomePage.Instance.RemoveViewByTag("LockLogicList");
- var doorLockLogicList = new LockLogicList();
- UserView.HomePage.Instance.AddChidren(doorLockLogicList);
- UserView.HomePage.Instance.PageIndex += 1;
- doorLockLogicList.Show();
- };
+ saveBtn.clickviewBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ var name = logicTextBox.Text.Trim();
+ Method.SaveLogic(LogicView.IfString._LockLogic, name,LogicView.IfString.Tag, Common.Logic.CurrentLogic);
+ };
}
public void AddCondition(int value)
@@ -1172,7 +700,6 @@
UserView.HomePage.Instance.AddChidren(addCondition);
UserView.HomePage.Instance.PageIndex += 1;
addCondition.Show();
-
}
}
}
--
Gitblit v1.8.0