From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码
---
ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs | 407 +++++++++++++++++++++++++++++++++++----------------------
1 files changed, 247 insertions(+), 160 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs
index f9b736b..ca0c158 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicDveiceStatus.cs
@@ -30,7 +30,7 @@
Common.Logic.CurrentLogic.LogicName = logicName;
if (Common.Logic.CurrentLogic.Conditions.Count == 1)
{
- ConditionView(false, frameLayout);
+ ConditionView(false, frameLayout,null);
}
else
{
@@ -171,19 +171,23 @@
case DeviceType.IASZone:
{
var iASZonedevice = deviceinof as IASZone;
- var intvalue = conditions["AttriButeData1"];
+ //var intvalue = conditions["AttriButeData1"];
+ string if_value = "5";
+ var intvalue = conditions["Range"];
icon = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
switch (iASZonedevice.IasDeviceType)
{
case 13:
{
- if (conditions["Cluster_ID"] == "1024")
+ if (conditions["Cluster_ID"] == "1024")
{
state = Language.StringByID(MyInternationalizationString.ambientLight) + "<" + conditions["AttriButeData1"] + "lux" + Language.StringByID(MyInternationalizationString.hour1);
}
else
{
- if (conditions.ContainsKey("IgnoreTime"))
+
+
+ if (conditions.ContainsKey("IgnoreTime")&& conditions["IgnoreTime"]!="0")
{
int minute = int.Parse(conditions["IgnoreTime"]) / 60;
int second = int.Parse(conditions["IgnoreTime"]) % 60;
@@ -212,15 +216,14 @@
state = Language.StringByID(MyInternationalizationString.someone);
}
}
-
}
break;
case 21:
case 22:
{
- if (conditions.ContainsKey("IgnoreTime"))
- {
+ if (conditions.ContainsKey("IgnoreTime")&&conditions["IgnoreTime"] != "0")
+ {
int minute = int.Parse(conditions["IgnoreTime"]) / 60;
int second = int.Parse(conditions["IgnoreTime"]) % 60;
if (minute != 0 && second != 0)
@@ -246,7 +249,7 @@
}
else
{
- if (intvalue == "1")
+ if (intvalue == if_value)
{
state = Language.StringByID(MyInternationalizationString.logicopen);
}
@@ -261,7 +264,7 @@
break;
case 40:
{
- if (intvalue == "1")
+ if (intvalue == if_value)
{
state =Language.StringByID(MyInternationalizationString.smokescreen);
}
@@ -270,7 +273,7 @@
break;
case 42:
{
- if (intvalue == "1")
+ if (intvalue == if_value)
{
state =Language.StringByID( MyInternationalizationString.waterleakage);
}
@@ -282,7 +285,7 @@
break;
case 43:
{
- if (intvalue == "1")
+ if (intvalue == if_value)
{
state =Language.StringByID( MyInternationalizationString.gas);
}
@@ -291,17 +294,16 @@
break;
case 277:
{
- if (intvalue == "1")
+ if (intvalue == if_value)
{
state =Language.StringByID( MyInternationalizationString.callthepolice);
}
}
break;
-
default:
{
- if (intvalue == "1")
+ if (intvalue == if_value)
{
state =Language.StringByID(MyInternationalizationString.callthepolice);
}
@@ -337,56 +339,166 @@
break;
case DeviceType.TemperatureSensor:
{
- // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png";
- var dev = deviceinof as TemperatureSensor;
- if (conditions["Cluster_ID"] == "1026")
+ //鑾峰彇璁惧绫诲瀷
+ var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { deviceinof });
+ if (deviceEnumInfo==null) {
+ continue;
+ }
+ //绌烘皵璐ㄩ噺浼犳劅鍣�
+ if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
{
- dev.SensorDiv = 1;
+ icon = "ZigeeLogic/airquality.png";
+ string s = "";
+ switch (conditions["Range"])
+ {
+ case "0":
+ {
+ s = ">";
+ }
+ break;
+ case "1":
+ {
+ s = "=";
+ }
+ break;
+ case "2":
+ {
+ s = "<";
+ }
+ break;
+ case "6":
+ {
+ s = "鈮�";
+ }
+ break;
+ case "7":
+ {
+ s = "鈮�";
+ }
+ break;
+ }
+ switch (conditions["Cluster_ID"]) {
+ case "1066": {
+ if (conditions["AttriButeId"] =="57344") {
+ if (conditions["AttriButeData1"] == "1")
+ {
+ state = Language.StringByID(MyInternationalizationString.you);
+ }
+ else if (conditions["AttriButeData1"] == "2")
+ {
+ state = Language.StringByID(MyInternationalizationString.liang);
+ }
+ else {
+ state = Language.StringByID(MyInternationalizationString.cha);
+ }
+ state = Language.StringByID(MyInternationalizationString.kongqizhiliang) + state;
+ } else {
+ ///Pm2.5
+ int intValue = int.Parse(conditions["AttriButeData1"]);
+ if (0< intValue&& intValue<30) {
+ state = Language.StringByID(MyInternationalizationString.pmyou);
+ }
+ else if (36 < intValue && intValue < 75) {
+ state = Language.StringByID(MyInternationalizationString.pmliang);
+ }
+ else if (76 < intValue && intValue < 115) {
+ state = Language.StringByID(MyInternationalizationString.pmqingdu);
+ }
+ else if (intValue >115) {
+ state = Language.StringByID(MyInternationalizationString.pmzhongdu);
+ }
+ state = Language.StringByID(MyInternationalizationString.pm25) + state;
+ }
+ }break;
+ case "1037":
+ {
+ ///co2
+ int intValue = int.Parse(conditions["AttriButeData1"]);
+ if (0 < intValue && intValue < 1000)
+ {
+ state = Language.StringByID(MyInternationalizationString.co2qingxin);
+ }
+ else if (1000 < intValue && intValue < 2000)
+ {
+ state = Language.StringByID(MyInternationalizationString.co2huizhuo);
+ }
+ else if (2000 < intValue && intValue < 5000)
+ {
+ state = Language.StringByID(MyInternationalizationString.co2queyang);
+ }
+ else if (intValue > 5000)
+ {
+ state = Language.StringByID(MyInternationalizationString.co2yanzhongqueyang);
+ }
+ state = Language.StringByID(MyInternationalizationString.co2) + state;
+ }
+ break;
+ case "1026": {
+ ///杞崲娓╁害鍊�/100
+ string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString();
+ state = s + srtValue + "鈩�";
+ } break;
+ case "1029": {
+ ///杞崲娓╁害鍊�/100
+ string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString();
+ state = s + srtValue + "%";
+ } break;
+ }
+
}
else
{
- dev.SensorDiv = 2;
- }
- string s = "";
- switch (conditions["Range"])
- {
- case "0":
- {
- s = ">";
- }
- break;
- case "1":
- {
- s = "=";
- }
- break;
- case "2":
- {
- s = "<";
- }
- break;
- case "6":
- {
- s = "鈮�";
- }
- break;
- case "7":
- {
- s = "鈮�";
- }
- break;
- }
- ///杞崲娓╁害鍊�/100
- string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString();
- if (conditions["Cluster_ID"] == "1026")
- {
- icon = "ZigeeLogic/temperature.png";
- state = s + srtValue + "鈩�";
- }
- else
- {
- icon = "ZigeeLogic/humidity.png";
- state = s + srtValue + "%";
+
+ var dev = deviceinof as TemperatureSensor;
+ if (conditions["Cluster_ID"] == "1026")
+ {
+ dev.SensorDiv = 1;
+ }
+ else
+ {
+ dev.SensorDiv = 2;
+ }
+ string s = "";
+ switch (conditions["Range"])
+ {
+ case "0":
+ {
+ s = ">";
+ }
+ break;
+ case "1":
+ {
+ s = "=";
+ }
+ break;
+ case "2":
+ {
+ s = "<";
+ }
+ break;
+ case "6":
+ {
+ s = "鈮�";
+ }
+ break;
+ case "7":
+ {
+ s = "鈮�";
+ }
+ break;
+ }
+ ///杞崲娓╁害鍊�/100
+ string srtValue = (int.Parse(conditions["AttriButeData1"]) / 100).ToString();
+ if (conditions["Cluster_ID"] == "1026")
+ {
+ icon = "ZigeeLogic/temperature.png";
+ state = s + srtValue + "鈩�";
+ }
+ else
+ {
+ icon = "ZigeeLogic/humidity.png";
+ state = s + srtValue + "%";
+ }
}
break;
@@ -466,9 +578,17 @@
selecteddevice.selecetddevicestateBtn.Text = state;
}
///缂栬緫
- selecteddevice.edit.Tag = i.ToString();
+ selecteddevice.edit.Tag = conditions;
selecteddevice.edit.MouseUpEventHandler += (sender, e) =>
{
+ var dic = selecteddevice.edit.Tag as Dictionary<string, string>;
+ int isInt = 0;
+ if (dic != null)
+ {
+ //涔嬪墠鏍囪绱㈠紩鍊硷紝涓�鏃﹀垹闄ゆ暟鎹储寮曞�间細鍙戠敓鏀瑰彉锛�
+ //鎵惧埌鏁版嵁鍦ㄥ垪琛ㄩ噷鏈�鏂扮储寮曪紝骞朵笖鏇存柊绱㈠紩鍊�
+ isInt = Common.Logic.CurrentLogic.Conditions.IndexOf(dic);
+ }
switch (Type)
{
@@ -479,7 +599,7 @@
UserView.HomePage.Instance.AddChidren(timePoint);
UserView.HomePage.Instance.PageIndex += 1;
timePoint.IsEditor = true;
- timePoint.Show(conditions);
+ timePoint.Show(dic);
}
break;
case 5:
@@ -499,7 +619,7 @@
{
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
frameLayout.AddChidren(flMain);
- CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic",int.Parse(selecteddevice.edit.Tag.ToString()));
+ CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic", isInt);
}
else
{
@@ -507,22 +627,20 @@
UserView.HomePage.Instance.AddChidren(memberList);
UserView.HomePage.Instance.PageIndex += 1;
MemberList.edit = true;
- memberList.Show(deviceinof, conditions);
+ memberList.Show(deviceinof, dic);
}
}
break;
case 6:
{
- var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
- frameLayout.AddChidren(flMain);
- AddLogicPage.SecurityView(flMain, true);
+
+ AddLogicPage.SecurityView(frameLayout, true);
}
break;
case 7:
{
- var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
- frameLayout.AddChidren(flMain);
- AddLogicPage.LocationView(flMain, true);
+
+ AddLogicPage.LocationView(frameLayout, true);
}
break;
}
@@ -531,7 +649,7 @@
selecteddevice.del.MouseUpEventHandler += (sender, e) =>
{
- var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+ var alert = new UserCenter.ShowMsgControl(ShowMsgType.Confirm,
Language.StringByID(MyInternationalizationString.doyouwanttodelete),
Language.StringByID(MyInternationalizationString.confrim));
alert.Show();
@@ -540,10 +658,6 @@
{
Common.Logic.CurrentLogic.Conditions.Remove(conditions);
selecteddevice.selecetdFrameLayout.RemoveFromParent();
- //var logicCommunalPage = new LogicCommunalPage();
- //UserView.HomePage.Instance.AddChidren(logicCommunalPage);
- //UserView.HomePage.Instance.PageIndex += 1;
- //logicCommunalPage.Show(() => { });
};
};
@@ -923,7 +1037,7 @@
{
var intvalue = int.Parse(tasks["Data1"]);
var colorTemperatureValue = 1000000 / (intvalue * 100);
- state += Language.StringByID(MyInternationalizationString.colorTemperature) + colorTemperatureValue.ToString() + "K";
+ state += Language.StringByID(MyInternationalizationString.colorTemperature) + colorTemperatureValue.ToString() + "00K";
}
break;
}
@@ -1030,8 +1144,7 @@
{
state = seconds.ToString() + Language.StringByID(MyInternationalizationString.second);
}
- //璁板綍寤舵椂锛�
- actiondevice.edit.Tag = i;
+
};
break;
}
@@ -1058,9 +1171,18 @@
actiondevice.selecetddevicestateBtn.Text = state;
}
///缂栬緫
- actiondevice.edit.Tag = i.ToString();
+ //璁板綍锛�
+ actiondevice.edit.Tag = actions;
actiondevice.edit.MouseUpEventHandler += (sender, e) =>
{
+ var dic = actiondevice.edit.Tag as Dictionary<string, object>;
+ int isInt = 0;
+ if (dic != null)
+ {
+ //涔嬪墠鏍囪绱㈠紩鍊硷紝涓�鏃﹀垹闄ゆ暟鎹储寮曞�间細鍙戠敓鏀瑰彉锛�
+ //鎵惧埌鏁版嵁鍦ㄥ垪琛ㄩ噷鏈�鏂扮储寮曪紝骞朵笖鏇存柊绱㈠紩鍊�
+ isInt = Common.Logic.CurrentLogic.Actions.IndexOf(dic);
+ }
switch (linkType)
{
case 8:
@@ -1069,7 +1191,7 @@
var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
frameLayout.AddChidren(flMain);
- CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic", int.Parse(actiondevice.edit.Tag.ToString()));
+ CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic", isInt);
}
break;
case 6:
@@ -1083,10 +1205,11 @@
break;
case 7:
{
+
var delayTime = new DelayTime();
UserView.HomePage.Instance.AddChidren(delayTime);
UserView.HomePage.Instance.PageIndex += 1;
- delayTime.Show(int.Parse(actiondevice.edit.Tag.ToString()), true);
+ delayTime.Show(isInt, true);
}
break;
@@ -1096,7 +1219,7 @@
actiondevice.del.MouseUpEventHandler += (sender, e) =>
{
- var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
+ var alert = new UserCenter.ShowMsgControl(ShowMsgType.Confirm,
Language.StringByID(MyInternationalizationString.doyouwanttodelete),
Language.StringByID(MyInternationalizationString.confrim));
alert.Show();
@@ -1122,90 +1245,50 @@
/// <summary>
/// 涓庢垨鏉′欢甯冨眬鐣岄潰鐨勬柟娉�
/// </summary>
- /// <param name="edit"></param>
- /// <param name="frameLayout"></param>
- public void ConditionView(bool edit, FrameLayout frameLayout)
+ /// <param name="edit">琛ㄧず鏄惁缂栬緫</param>
+ /// <param name="frameLayout">鏄剧ず鍦ㄥ摢涓晫闈�</param>
+ /// <param name="button">鏄剧ず閫変腑鏂囨湰</param>
+ public void ConditionView(bool edit, FrameLayout frameLayout,Button button)
{
- #region ------缁勫悎鏉′欢鐣岄潰甯冨眬閮ㄥ垎
- var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
- frameLayout.AddChidren(flMain);
- CompleteView completeView = new CompleteView();
- flMain.AddChidren(completeView.Show(2));
- completeView.Btntitle.TextID = MyInternationalizationString.condition;
- EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
- {
- UserView.HomePage.Instance.ScrollEnabled = true;
- flMain.RemoveFromParent();
- };
- flMain.MouseUpEventHandler += clickcancel;
- completeView.Btncancel.MouseUpEventHandler += clickcancel;
-
- //婊¤冻鎵�鏈夋潯浠�
- mFunView allFunView = new mFunView();
- allFunView.frameLayout.Y = Application.GetRealHeight(140 + 20);
- completeView.Show(2).AddChidren(allFunView.Show());
- allFunView.titleBtn.TextID = MyInternationalizationString.Allconditions;
- //婊¤冻鍏朵腑涓�涓潯浠�
- mFunView ormFunview = new mFunView();
- ormFunview.frameLayout.Y = allFunView.frameLayout.Bottom;
- completeView.Show(2).AddChidren(ormFunview.Show());
- ormFunview.titleBtn.TextID = MyInternationalizationString.anycondition;
- ormFunview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
- #endregion
-
- ///婊¤冻鎵�鏈夋潯浠剁偣鍑讳簨浠�
- allFunView.clickviewBtn.MouseUpEventHandler += (sedner, e) =>
- {
- allFunView.selectedIconBtn.Visible = true;
- ormFunview.selectedIconBtn.Visible = false;
- allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
- ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
- };
- ///婊¤冻鍏朵腑涓�涓潯浠剁偣鍑讳簨浠�
- ormFunview.clickviewBtn.MouseUpEventHandler += (sedner, e) =>
- {
- allFunView.selectedIconBtn.Visible = false;
- ormFunview.selectedIconBtn.Visible = true;
- allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
- ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
- };
-
+
+ string stateText = "";
if (edit)
{
- if (Common.Logic.CurrentLogic.Relationship == 0)
- {
- allFunView.selectedIconBtn.Visible = true;
- ormFunview.selectedIconBtn.Visible = false;
- allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
- ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
- }
- else
- {
- allFunView.selectedIconBtn.Visible = false;
- ormFunview.selectedIconBtn.Visible = true;
- allFunView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
- ormFunview.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
- }
- }
- completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
- {
- if (!allFunView.selectedIconBtn.Visible && !ormFunview.selectedIconBtn.Visible)
- {
- ///鍙互鎻愮ず鏈�変腑鐘舵�侊紱
- return;
- }
- flMain.RemoveFromParent();
- if (allFunView.selectedIconBtn.Visible)
+ switch (Common.Logic.CurrentLogic.Relationship)
+ {
+ case 0:
+ {
+ stateText = Language.StringByID(MyInternationalizationString.Allconditions);
+ }
+ break;
+ case 1:
+ {
+ stateText = Language.StringByID(MyInternationalizationString.anycondition);
+ }
+ break;
+ }
+
+ }
+
+ PublicInterface publicInterface = new PublicInterface();
+ var list = publicInterface.GetViewList("缁勫悎鏉′欢");
+ publicInterface.SingleSelectionShow(frameLayout, list, MyInternationalizationString.condition, stateText, (str) =>
+ {
+ //鏄剧ず閫変腑鏂囨湰
+ if (button!=null) {
+ button.Text = Language.StringByID(MyInternationalizationString.followingconditions)+ str;
+ }
+ if (str == Language.StringByID(MyInternationalizationString.Allconditions))
{
Common.Logic.CurrentLogic.Relationship = 0;
}
- if (ormFunview.selectedIconBtn.Visible)
+ else if (str == Language.StringByID(MyInternationalizationString.anycondition))
{
- Common.Logic.CurrentLogic.Relationship = 1;
+ Common.Logic.CurrentLogic.Relationship = 1;
}
if (edit)
{
@@ -1213,10 +1296,6 @@
{
Send.LogicControlSwitch(Common.Logic.CurrentLogic);
}
- var logicCommunalPage = new LogicCommunalPage();
- UserView.HomePage.Instance.AddChidren(logicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- logicCommunalPage.Show(() => { });
}
else
{
@@ -1225,8 +1304,16 @@
UserView.HomePage.Instance.PageIndex += 1;
addLogicPage.Show();
}
- };
+
+ });
+
+
+
+
}
+
+
+
}
}
--
Gitblit v1.8.0