From 8615f80ef3a66cb115298510c625db4cb2ba6f8e Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 02 七月 2020 12:08:14 +0800
Subject: [PATCH] 2020-07-02-1
---
ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs | 1210 +-------------------------------------------------------
1 files changed, 38 insertions(+), 1,172 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index 385d1e0..008ae98 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -18,7 +18,7 @@
UserView.HomePage.Instance.RemoveViewByTag("Logic");
Tag = "Logic";
}
- EditText logicTextBox;
+
public async void Show(Action action)
{
@@ -36,14 +36,14 @@
}
view.clickBtn.MouseDownEventHandler += (sender, e) =>
{
- // UserView.HomePage.Instance.ScrollEnabled = true;//鎭㈠宸︽粦
+ // UserView.HomePage.Instance.ScrollEnabled = true;//鎭㈠宸︽粦
action();
RemoveFromParent();
};
var middle = new VerticalScrolViewLayout
{
Y = view.topRowLayout.Bottom,
- Height = Application.GetRealHeight(1920 - 184-180),
+ Height = Application.GetRealHeight(Method.H - 184 - 180),
BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
};
this.AddChidren(middle);
@@ -75,10 +75,10 @@
};
logicnamefl.AddChidren(text);
- logicTextBox = new EditText
+ EditText logicTextBox = new EditText
{
Y = Application.GetRealHeight(35),
- Width = Application.GetRealWidth(1080-58-300),
+ Width = Application.GetRealWidth(1080 - 58 - 300),
Height = Application.GetRealHeight(60),
X = text.Right,
TextAlignment = TextAlignment.CenterLeft,
@@ -103,20 +103,21 @@
middle.AddChidren(addconditionview.AddDeviceView());
///娣诲姞鏉′欢鐨勭偣鍑讳簨浠�
- addconditionview.clickBtn.MouseUpEventHandler+= (sender, e) =>
- {
- if (Common.Logic.CurrentLogic.Conditions.Count == 1)
- {
- ConditionView(false);
- }
- else
- {
- var addLogicPage = new AddLogicPage();
- UserView.HomePage.Instance.AddChidren(addLogicPage);
- UserView.HomePage.Instance.PageIndex += 1;
- addLogicPage.Show();
- }
- };
+ addconditionview.clickBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
+ if (Common.Logic.CurrentLogic.Conditions.Count == 1)
+ {
+ new LogicDveiceStatus { }.ConditionView(false, this);
+ }
+ else
+ {
+ var addLogicPage = new AddLogicPage();
+ UserView.HomePage.Instance.AddChidren(addLogicPage);
+ UserView.HomePage.Instance.PageIndex += 1;
+ addLogicPage.Show();
+ }
+ };
List<Dictionary<string, string>> ListConditions = new List<Dictionary<string, string>>();
ListConditions.Clear();
ListConditions.AddRange(Common.Logic.CurrentLogic.Conditions);
@@ -148,529 +149,14 @@
}
EventHandler<MouseEventArgs> editclick = (sender, e) =>
{
-
- ConditionView(true);
+ Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
+ new LogicDveiceStatus { }.ConditionView(true, this);
};
row.MouseUpEventHandler += editclick;
relationship.MouseUpEventHandler += editclick;
}
- for (int i = 0; i < ListConditions.Count; i++)
- {
- if (i == (ListConditions.Count - 1))
- {
- LogicView.AddDeviceView addflview = new LogicView.AddDeviceView();
- addflview.titleBtn.TextID = MyInternationalizationString.addconditions;
- middle.AddChidren(addflview.AddFl());
- addflview.clickBtn.MouseUpEventHandler += (sender, e) =>
- {
- if (Common.Logic.CurrentLogic.Conditions.Count == 1)
- {
- ConditionView(false);
- }
- else
- {
- var addLogicPage = new AddLogicPage();
- UserView.HomePage.Instance.AddChidren(addLogicPage);
- UserView.HomePage.Instance.PageIndex += 1;
- addLogicPage.Show();
- }
- };
- }
- else
- {
- 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];
- string name = "";
- string icon = "";
- string state = "";
- switch (Type)
- {
- /// (0:鏃堕棿鐐规潯浠�;1:璁惧鐘舵�佸彉鍖栨潯浠�;2:鍏朵粬閫昏緫鏉′欢;3:璁℃暟鍣ㄦ潯浠�;4:鍊掕鏃�;5:鏃堕棿娈垫潯浠�;6:瀹夐槻鏉′欢;7:鍦扮悊浣嶇疆)
- case 0:
- {
-
- //"0姝e父鏃堕棿鐐�","1鏃ュ嚭鏃堕棿","2鏃ヨ惤鏃堕棿","3姝e崍鏃堕棿"
- switch (int.Parse(conditions["DateType"]))
- {
- case 0:
- {
- name = Language.StringByID(MyInternationalizationString.immediateexecution);
- icon = "ZigeeLogic/timepoint.png";
- string s = "";
- s = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"];
- state = conditions["StartHour"] + ":" + s;
-
- }
- break;
- case 1:
- {
- name = Language.StringByID(MyInternationalizationString.sunrise);
- icon = "ZigeeLogic/sunrise.png";
- if (int.Parse(conditions["AdjustTime"]) > 0)
- {
- state = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
- }
- else if (int.Parse(conditions["AdjustTime"]) < 0)
- {
- state = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
- }
- else
- {
- //timeTxet.Text = Language.StringByID(MyInternationalizationString.sunrise);
- }
- }
- break;
- case 2:
- {
- name = Language.StringByID(MyInternationalizationString.sunset);
- icon = "ZigeeLogic/sunset.png";
- if (int.Parse(conditions["AdjustTime"]) > 0)
- {
- state = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
- }
- else if (int.Parse(conditions["AdjustTime"]) < 0)
- {
- state = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
- }
- else
- {
- // timevalue.Text = Language.StringByID(MyInternationalizationString.sunset);
- }
- }
- break;
- case 3:
- {
- name = Language.StringByID(MyInternationalizationString.noon);
- icon = "ZigeeLogic/noon.png";
- if (int.Parse(conditions["AdjustTime"]) > 0)
- {
- state = Language.StringByID(MyInternationalizationString.delayed) + conditions["AdjustTime"] + Language.StringByID(MyInternationalizationString.logicminute);
- }
- else if (int.Parse(conditions["AdjustTime"]) < 0)
- {
- state = Language.StringByID(MyInternationalizationString.advance) + Math.Abs(int.Parse(conditions["AdjustTime"])).ToString() + Language.StringByID(MyInternationalizationString.logicminute);
- }
- else
- {
- // timeTxet.Text = Language.StringByID(MyInternationalizationString.noon);
- }
- }
- break;
- }
-
- }
- break;
- case 5:
- {
- icon = "ZigeeLogic/timeparagraph.png";
- string s1 = "", s2 = "";
- s1 = conditions["StartMin"].Length < 2 ? "0" + conditions["StartMin"] : conditions["StartMin"];
- s2 = conditions["StopMin"].Length < 2 ? "0" + conditions["StopMin"] : conditions["StopMin"];
- ///鏄剧ず鏃堕棿
- name = conditions["StartHour"] + ":" + s1 + "-" + conditions["StopHour"] + ":" + s2;
- state =Language.StringByID(MyInternationalizationString.timeframe);
- }
- break;
- case 1:
- {
- var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
- name = deviceinof.DeviceEpointName;
- selecteddevice.regionNameBtn.Visible = true;
- Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof);
-
- switch (deviceinof.Type)
- {
- case DeviceType.OnOffOutput:
- {
- icon = "ZigeeLogic/light.png";
- if (conditions["AttriButeId"] == "0")
- {
- if (conditions["AttriButeData1"] == "1")
- {
- state = Language.StringByID(MyInternationalizationString.open);
- }
- else
- {
- state = Language.StringByID(MyInternationalizationString.close);
- }
-
- }
- }
- break;
- case DeviceType.IASZone:
- {
- var iASZonedevice = deviceinof as IASZone;
- var intvalue = conditions["AttriButeData1"];
- icon = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
- switch (iASZonedevice.IasDeviceType)
- {
- case 13:
- {
- if (intvalue == "1")
- {
- state=Language.StringByID( MyInternationalizationString.someone);
- }
- else
- {
- int minute = int.Parse(conditions["IgnoreTime"]) / 60;
- int second = int.Parse(conditions["IgnoreTime"]) % 60;
- if (minute != 0 && second != 0)
- {
- state = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1);
-
- }
- else
- {
- if (minute == 0 && second != 0)
- {
- state = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1);
-
- }
- if (minute != 0 && second == 0)
- {
- state = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1);
-
- }
-
- }
- }
- }
- break;
- case 21:
- case 22:
- {
- if (intvalue == "1")
- {
- state =Language.StringByID( MyInternationalizationString.logicopen);
- }
- else
- {
- if (conditions.ContainsKey("IgnoreTime"))
- {
-
- int minute = int.Parse(conditions["IgnoreTime"]) / 60;
- int second = int.Parse(conditions["IgnoreTime"]) % 60;
- if (minute != 0 && second != 0)
- {
- state = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime);
-
- }
- else
- {
- if (minute == 0 && second != 0)
- {
- state = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.closetime);
-
- }
- if (minute != 0 && second == 0)
- {
- state = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.closetime);
-
- }
-
- }
-
- }
- else
- {
- state =Language.StringByID(MyInternationalizationString.logicclose);
- }
- }
- }
- break;
- case 40:
- {
- if (intvalue == "1")
- {
- state =Language.StringByID(MyInternationalizationString.smokescreen);
- }
-
- }
- break;
- case 42:
- {
- if (intvalue == "1")
- {
- state =Language.StringByID( MyInternationalizationString.waterleakage);
- }
- else
- {
- state =Language.StringByID( MyInternationalizationString.noleakage);
- }
- }
- break;
- case 43:
- {
- if (intvalue == "1")
- {
- state =Language.StringByID( MyInternationalizationString.gas);
- }
-
- }
- break;
- case 277:
- {
- if (intvalue == "1")
- {
- state =Language.StringByID( MyInternationalizationString.callthepolice);
- }
-
- }
- break;
- default:
- {
- if (intvalue == "1")
- {
- state =Language.StringByID(MyInternationalizationString.callthepolice);
- }
- }
- break;
-
- }
- }
- break;
- case DeviceType.OnOffSwitch:
- {
- icon = "ZigeeLogic/panel.png";
- state = Language.StringByID(MyInternationalizationString.OnOffSwitch) + conditions["Epoint"];
- }
- break;
- case DeviceType.DoorLock:
- {
- icon = "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"])
- {
- state = Common.Logic.CurrentLogic.Accounts[a]["AccountName"];
- break;
-
- }
- }
-
- }
- }
- break;
- case DeviceType.TemperatureSensor:
- {
- // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png";
- 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;
- }
- if (conditions["Cluster_ID"] == "1026")
- {
- icon = "ZigeeLogic/temperature.png";
- state = s + conditions["AttriButeData1"] + "鈩�";
- }
- else
- {
- icon = "ZigeeLogic/humidity.png";
- state = s + conditions["AttriButeData1"] + "%";
- }
- break;
-
- }
-
- }
- }
- break;
- case 6:
- {
- switch (conditions["EnOrWithdrawMode"])
- {
- case "0":
- {
- if (conditions["ModeId"] == "1")
- {
- icon = "ZigeeLogic/athome.png";
- name = Language.StringByID(MyInternationalizationString.logicathomegarrison);
-
- }
- else
- {
- icon = "ZigeeLogic/leavehome.png";
- name = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
- }
- }
- break;
- case "1":
- {
- icon = "ZigeeLogic/withdrawal.png";
- name = Language.StringByID(MyInternationalizationString.withdrawal);
- }
- break;
- case "2":
- {
- icon = "ZigeeLogic/withdrawal.png";
- name = Language.StringByID(MyInternationalizationString.urgentwithdrawal);
- }
- break;
- }
- }
- break;
- case 7:
- {
- icon = "ZigeeLogic/position.png";
- name = Language.StringByID(MyInternationalizationString.geographicalposition);
- foreach (var radius in Common.Logic.CurrentLogic.Accounts)
- {
- if (radius["Type"] == "7")
- {
- if (conditions["AtHome"] == "1")
- {
- state = Language.StringByID(MyInternationalizationString.athome) + radius["Radius"] + "绫�";
- }
- else
- {
- state = Language.StringByID(MyInternationalizationString.leavehome) + radius["Radius"] + "绫�";
- }
- }
- }
- }
- break;
- }
- if (Type != 1)
- {
- selecteddevice.ordinaryBtn.Visible = true;
- selecteddevice.iconBtn.UnSelectedImagePath = icon;
- selecteddevice.ordinaryBtn.Text = name;
- selecteddevice.selecetddevicestateBtn.Text = state;
- }
- else
- {
- //璁惧鐘舵��
- selecteddevice.deviceNameBtn.Visible = true;
- selecteddevice.iconBtn.UnSelectedImagePath = icon;
- selecteddevice.deviceNameBtn.Text = name;
- selecteddevice.selecetddevicestateBtn.Text = state;
- }
- ///缂栬緫
- selecteddevice.edit.MouseUpEventHandler += (sender, e) =>
- {
- switch (Type)
- {
-
- /// (0:鏃堕棿鐐规潯浠�;1:璁惧鐘舵�佸彉鍖栨潯浠�;2:鍏朵粬閫昏緫鏉′欢;3:璁℃暟鍣ㄦ潯浠�;4:鍊掕鏃�;5:鏃堕棿娈垫潯浠�;6:瀹夐槻鏉′欢;7:鍦扮悊浣嶇疆)
- case 0:
- {
- var timePoint = new TimePoint();
- UserView.HomePage.Instance.AddChidren(timePoint);
- UserView.HomePage.Instance.PageIndex += 1;
- timePoint.IsEditor = true;
- timePoint.Show(conditions);
- }
- break;
- case 5:
- {
- var timePage = new TimePage();
- UserView.HomePage.Instance.AddChidren(timePage);
- UserView.HomePage.Instance.PageIndex += 1;
- timePage.str1 = conditions["StartHour"] + ":" + conditions["StartMin"] + "-" + conditions["StopHour"] + ":" + conditions["StopMin"];
- timePage.IsEditor = true;
- timePage.Show();
- }
- break;
- case 1:
- {
- var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
- if (deviceinof.Type != DeviceType.DoorLock)
- {
- var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
- this.AddChidren(flMain);
- CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic");
- }
- else
- {
- var memberList = new MemberList();
- UserView.HomePage.Instance.AddChidren(memberList);
- UserView.HomePage.Instance.PageIndex += 1;
- MemberList.edit = true;
- memberList.Show(deviceinof, conditions);
- }
- }
- break;
- case 6:
- {
- var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
- this.AddChidren(flMain);
- AddLogicPage.SecurityView(flMain, true);
- }
- break;
- case 7:
- {
- var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
- this.AddChidren(flMain);
- AddLogicPage.LocationView(flMain, true);
- }
- break;
- }
- };
- ///鍒犻櫎鎺т欢
- selecteddevice.del.MouseUpEventHandler += (sender, e) =>
- {
-
- var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
- Language.StringByID(MyInternationalizationString.doyouwanttodelete),
- Language.StringByID(MyInternationalizationString.confrim));
- alert.Show();
-
- alert.ConfirmClickEvent += () =>
- {
- Common.Logic.CurrentLogic.Conditions.Remove(conditions);
- var logicCommunalPage = new LogicCommunalPage();
- UserView.HomePage.Instance.AddChidren(logicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- logicCommunalPage.Show(() => { });
- };
-
- };
-
- }
- }
-
+ new LogicDveiceStatus { }.Conditions(this, middle, ListConditions, logicTextBox.Text.Trim());
#endregion
@@ -680,487 +166,17 @@
addactionview.iconBtn.Visible = true;
addactionview.titleBtn.TextID = MyInternationalizationString.execute;
middle.AddChidren(addactionview.AddDeviceView());
-
- addactionview.clickBtn.MouseUpEventHandler+= (sender, e) =>
- {
- Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
- Method.View(IfString.Action_Logic,IfString.Action_LogicScene);
- };
+ addactionview.clickBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
+ Method.View(IfString.Action_Logic, IfString.Action_LogicScene);
+ };
List<Dictionary<string, object>> ListActions = new List<Dictionary<string, object>>();
ListActions.Clear();
ListActions.AddRange(Common.Logic.CurrentLogic.Actions);
ListActions.Add(new Dictionary<string, object>());
-
- for (int i = 0; i < ListActions.Count; i++)
- {
- if (i == (ListActions.Count - 1))
- {
-
- LogicView.AddDeviceView addflview = new LogicView.AddDeviceView();
- addflview.titleBtn.TextID = MyInternationalizationString.addfunction;
- middle.AddChidren(addflview.AddFl());
- addflview.clickBtn.MouseUpEventHandler += (sender, e) =>
- {
- Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
- Method.View(IfString.Action_Logic, IfString.Action_LogicScene);
- };
- }
- else
- {
-
- 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 deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
- name = deviceinof.DeviceEpointName;
- actiondevice.regionNameBtn.Visible = true;
- Method.RoomNmae(actiondevice.regionNameBtn, deviceinof);
- switch (deviceinof.Type)
- {
- case DeviceType.OnOffOutput:
- {
- icon = "ZigeeLogic/light.png";
-
- var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
- if (TaskList == null)
- {
- continue;
- }
- foreach (var status in TaskList)
- {
- if (status["TaskType"].ToString() == "1")
- {
- if (status["Data1"].ToString() == "0")
- {
- state = Language.StringByID(MyInternationalizationString.close);
-
- }
- else if (status["Data1"].ToString() == "1")
- {
- state = Language.StringByID(MyInternationalizationString.open);
-
- }
- else if (status["Data1"].ToString() == "2")
- {
-
- state = Language.StringByID(MyInternationalizationString.onoff);
- }
- }
-
- }
-
- }
- break;
- case DeviceType.DimmableLight:
- {
- icon = "ZigeeLogic/dimmableLight.png";
- var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
- if (TaskList == null)
- {
- continue;
- }
- foreach (var status in TaskList)
- {
- if (status["TaskType"].ToString() == "3")
- {
- var intvalue = int.Parse(status["Data1"]);
- var lightbrightnessvalue = (intvalue * 100) / 254;
- state = lightbrightnessvalue.ToString() + "%";
- }
- else if (status["TaskType"].ToString() == "1")
- {
-
- if (status["Data1"].ToString() == "0")
- {
- state = Language.StringByID(MyInternationalizationString.close);
- }
- else if (status["Data1"].ToString() == "2")
- {
- state = Language.StringByID(MyInternationalizationString.onoff);
- }
- }
-
-
- }
-
- }
- break;
- case DeviceType.WindowCoveringDevice:
- {
- icon = "ZigeeLogic/curtain.png";
- var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
- if (TaskList == null)
- {
- continue;
- }
- foreach (var status in TaskList)
- {
- if (status["TaskType"] == "6")
- {
- if (status["Data1"] == "0")
- {
- state = Language.StringByID(MyInternationalizationString.open);
- }
- else if (status["Data1"] == "1")
- {
- state = Language.StringByID(MyInternationalizationString.close);
- }
- else if (status["Data1"] == "5")
- {
- state = status["Data2"] + "%";
- }
- }
-
- }
- }
- break;
- case DeviceType.AirSwitch:
- {
- icon = "ZigeeLogic/airswitch.png";
-
- var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
- if (TaskList == null)
- {
- continue;
- }
- foreach (var status in TaskList)
- {
- if (status["TaskType"].ToString() == "1")
- {
- if (status["Data1"].ToString() == "0")
- {
- state = Language.StringByID(MyInternationalizationString.close);
-
- }
- else if (status["Data1"].ToString() == "1")
- {
- state = Language.StringByID(MyInternationalizationString.open);
-
- }
- else if (status["Data1"].ToString() == "2")
- {
-
- state = Language.StringByID(MyInternationalizationString.onoff);
- }
- }
-
- }
-
- }
- break;
- case DeviceType.Thermostat:
- {
- icon = "ZigeeLogic/ac.png";
-
- var TaskList = actions["TaskList"] as List<Dictionary<string, string>>;
- if (TaskList == null)
- {
- continue;
- }
- string modetext = "", temperaturetext = "", speedtext = "";
- bool ifclose = false;
- foreach (var status in TaskList)
- {
-
- if (TaskList.Count == 1)
- {
- //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱
- ifclose = false;
- //濡傛灉绌鸿皟鐘舵�佹槸鍏筹紱鐩存帴璺冲嚭for寰潖锛�
- break;
- }
- else
- {
- ifclose = true;
- }
- if (status["TaskType"].ToString() == "5")
- {
- if (status["Data1"] == "3")
- {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍)
- switch (status["Data2"])
- {
- case "3":
- {
- modetext = Language.StringByID(MyInternationalizationString.logiccool);
- }
- break;
- case "4":
- {
- modetext = Language.StringByID(MyInternationalizationString.logicheat);
- }
- break;
- case "1":
- {
- modetext = Language.StringByID(MyInternationalizationString.logicauto);
- }
- break;
- case "8":
- {
- modetext = Language.StringByID(MyInternationalizationString.logicdry);
- }
- break;
- case "7":
- {
- modetext = Language.StringByID(MyInternationalizationString.logicfanonly);
- }
- break;
- }
- }
- else if (status["Data1"] == "6")
- {//6---璁剧疆椋庢墖妯″紡(1:浣庨;2:涓;3:楂橀;)
- switch (status["Data2"])
- {
- case "1":
- {
- speedtext = Language.StringByID(MyInternationalizationString.logiclow);
- }
- break;
-
- case "2":
- {
- speedtext = Language.StringByID(MyInternationalizationString.logicmedium);
- }
- break;
- case "3":
- {
- speedtext = Language.StringByID(MyInternationalizationString.logichigh);
- }
- break;
-
- }
- }
- //4---璁剧疆鍔犵儹搴︽暟;5---璁剧疆鍒跺喎銆侀櫎婀垮害鏁�;7---璁剧疆鑷姩搴︽暟
- else if (status["Data1"] == "4" || status["Data1"] == "5" || status["Data1"] == "7")
- {
- var s = int.Parse(status["Data2"]) / 100;
- temperaturetext = s.ToString();
- }
- else if (status["Data1"] == "20")
- {
- temperaturetext = "鏃�";
- }
-
-
- }
-
- }
- if (ifclose)
- {
- state = modetext + ";" + temperaturetext + "鈩�;" + speedtext;
- }
- else
- {
- 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;
- }
-
- }
- break;
- case 2:
- {
- //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙;
- var sceneinof = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(Convert.ToInt32(actions["DeviceAddr"].ToString()));
- //鏈湴娌℃湁瀛樺湪;
- if (sceneinof == null)
- {
- //瀹炵幇鐩殑:鏄剧ず鍑烘潵璁╁彲浠ヨ嚜宸辨槸鍚﹀垹闄�
- sceneinof = new SceneUI();
- #region --------
- ////鍦ㄧ綉鍏虫煡鎵捐鍦烘櫙;
- ////鏍囪闂:缃戠粶璇锋眰锛屽瓨鍦ㄨ鍥惧姞杞藉揩鎱㈢殑闂锛�
- //sceneinof = await Send.GetScene(int.Parse(actions["DeviceAddr"].ToString()));
- ////缃戝叧娌℃湁瀛樺湪;
- //if (sceneinof == null)
- //{
- // //娉ㄨВ:鏈湴鍜岀綉鍏抽兘涓嶅瓨鍦ㄨ鍦烘櫙,鐣岄潰灏嗕笉浼氭樉绀鸿鍦烘櫙;
- // //sceneinof = new SceneUI();
- // //绉婚櫎璇ュ満鏅暟鎹�;
- // Common.Logic.CurrentLogic.Actions.Remove(actions);
- // //绉婚櫎璇ュ満鏅鍥�;
- // devicesFrameLayout.RemoveFromParent();
- // continue;
- //}
- #endregion
- }
-
- icon = "ZigeeLogic/scene.png";
- name = sceneinof.Name;
- actiondevice.regionNameBtn.Visible = true;
- /////閫氳繃璁惧鎵惧埌鍖哄煙(鎴块棿)鍚嶇О
- Common.Room room = new Common.Room();
- actiondevice.regionNameBtn.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameBySceneId(sceneinof.Id);
-
- }
- break;
- case 6:
- {
-
-
-
- if (actions["SecuritySetting"].ToString() == "0")
- {
- if (actions["Password"].ToString() == "888888")
- {
- icon = "ZigeeLogic/withdrawal.png";
- state = Language.StringByID(MyInternationalizationString.urgentwithdrawal);
- }
- else
- {
- icon = "ZigeeLogic/withdrawal.png";
- state = Language.StringByID(MyInternationalizationString.withdrawal);
-
- }
- }
- else if (actions["SecuritySetting"].ToString() == "1")
- {
- if (actions["SecurityModeId"].ToString() == "1")
- {
- icon = "ZigeeLogic/athome.png";
- state = Language.StringByID(MyInternationalizationString.logicathomegarrison);
- }
- else if (actions["SecurityModeId"].ToString() == "2")
- {
- icon = "ZigeeLogic/leavehome.png";
- state = Language.StringByID(MyInternationalizationString.logicremovehomegarrison);
- }
- }
-
- }
- break;
- case 7:
- {
- var delaytimevalue = int.Parse(actions["DelayTime"].ToString());
- var Minutes = delaytimevalue / 60;
- var seconds = delaytimevalue % 60;
-
- icon = "ZigeeLogic/delay.png";
-
- if (Minutes != 0)
- {
- if (seconds == 0)
- {
- state = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute);
- }
- else
- {
- state = Minutes.ToString() + Language.StringByID(MyInternationalizationString.minute) + seconds.ToString() + Language.StringByID(MyInternationalizationString.second);
- }
- }
- else
- {
- state = seconds.ToString() + Language.StringByID(MyInternationalizationString.second);
- }
- //璁板綍寤舵椂锛�
- actiondevice.edit.Tag = i;
- };
- break;
- }
-
- if (linkType != 2)
- {
- actiondevice.stateRow.AddRightView(actiondevice.edit);
- }
- actiondevice.stateRow.AddRightView(actiondevice.del);
-
- if (linkType == 6 || linkType == 7)
- {
- actiondevice.ordinaryBtn.Visible = true;
- actiondevice.iconBtn.UnSelectedImagePath = icon;
- actiondevice.ordinaryBtn.Text = name;
- actiondevice.selecetddevicestateBtn.Text = state;
- }
- else
- {
- //璁惧鐘舵��
- actiondevice.deviceNameBtn.Visible = true;
- actiondevice.iconBtn.UnSelectedImagePath = icon;
- actiondevice.deviceNameBtn.Text = name;
- actiondevice.selecetddevicestateBtn.Text = state;
- }
- ///缂栬緫
- actiondevice.edit.MouseUpEventHandler += (sender, e) =>
- {
- switch (linkType)
- {
- case 8:
- case 0:
- {
- 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_logic");
- }
- break;
- case 6:
- {
- var securityMode = new SecurityMode();
- UserView.HomePage.Instance.AddChidren(securityMode);
- UserView.HomePage.Instance.PageIndex += 1;
- securityMode.IsDeviceEditor = true;
- securityMode.Show();
- }
- 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);
- }
- break;
-
- }
- };
- ///鍒犻櫎鎺т欢
- actiondevice.del.MouseUpEventHandler += (sender, e) =>
- {
-
- var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
- Language.StringByID(MyInternationalizationString.doyouwanttodelete),
- Language.StringByID(MyInternationalizationString.confrim));
- alert.Show();
- alert.ConfirmClickEvent += () =>
- {
- Common.Logic.CurrentLogic.Actions.Remove(actions);
- // devicesFrameLayout.RemoveFromParent();
- var logicCommunalPage = new LogicCommunalPage();
- UserView.HomePage.Instance.AddChidren(logicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- logicCommunalPage.Show(() => { });
- };
-
- };
- }
- }
+ new LogicDveiceStatus { }.Actions(this, middle, ListActions, logicTextBox.Text.Trim());
#endregion
@@ -1185,16 +201,16 @@
//Text = "姣忓ぉ",
TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
TextID = MyInternationalizationString.everyday,
- Y = Application.GetRealHeight(35+30),
+ Y = Application.GetRealHeight(35 + 30),
X = weekview.titleBtn.Right,
TextSize = 14,
};
weekview.frameLayout.AddChidren(weekBtn);
- Method.UpdateWeek(weekBtn,Common.Logic.CurrentLogic);
+ Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic);
EventHandler<MouseEventArgs> cycleclick = (sender, e) =>
{
/*------淇濈暀姣忔湀,姣忓勾绫诲瀷*/
- var cycle = new Cycle(() => { Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic);});
+ var cycle = new Cycle(() => { Method.UpdateWeek(weekBtn, Common.Logic.CurrentLogic); });
UserView.HomePage.Instance.AddChidren(cycle);
UserView.HomePage.Instance.PageIndex += 1;
cycle.Show();
@@ -1210,164 +226,14 @@
#region ----鎺ㄩ�佽缃�----
Method.Push(middle);
-
+
#endregion
- saveBtn.clickviewBtn.MouseUpEventHandler +=(sender, e) =>
- {
- var name = logicTextBox.Text.Trim();
- Method.SaveLogic(IfString._Logic,name, IfString.Tag, Common.Logic.CurrentLogic);
- };
+ saveBtn.clickviewBtn.MouseUpEventHandler += (sender, e) =>
+ {
+ var name = logicTextBox.Text.Trim();
+ Method.SaveLogic(IfString._Logic, name, IfString.Tag, Common.Logic.CurrentLogic);
+ };
}
-
- void ConditionView(bool edit)
- {
- Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
- #region ------缁勫悎鏉′欢鐣岄潰甯冨眬閮ㄥ垎
- var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
- this.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;
- };
-
- 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)
- {
- Common.Logic.CurrentLogic.Relationship = 0;
-
- }
- if (ormFunview.selectedIconBtn.Visible)
- {
- Common.Logic.CurrentLogic.Relationship = 1;
-
- }
- if (edit)
- {
- if (Common.Logic.CurrentLogic.LogicId != 0)
- {
- Send.LogicControlSwitch(Common.Logic.CurrentLogic);
- }
- var logicCommunalPage = new LogicCommunalPage();
- UserView.HomePage.Instance.AddChidren(logicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- logicCommunalPage.Show(() => { });
- }
- else
- {
- var addLogicPage = new AddLogicPage();
- UserView.HomePage.Instance.AddChidren(addLogicPage);
- UserView.HomePage.Instance.PageIndex += 1;
- addLogicPage.Show();
- }
- };
-
- }
- /// <summary>
- /// 闂幇寮忔彁绀烘鐨勬柟娉�
- /// </summary>
- /// <param name="tipText">鎻愮ず鍐呭</param>
- /// <param name="second">鍋滅暀鏃堕棿鍗曚綅涓簊</param>
- public void TipView(string tipText, int second = 1)
- {
-
- var frameLayout = new FrameLayout { BackgroundColor = 0x50000000 };
- this.AddChidren(frameLayout);
-
- var btn = new Button
- {
- Gravity = Gravity.Center,
- Text = tipText,
- BackgroundColor = 0xff1f1f1f,
- Width = Application.GetRealWidth(500),
- Height = Application.GetRealHeight(100),
- Radius = (uint)Application.GetRealHeight(50),
- };
- frameLayout.AddChidren(btn);
-
- var dateTime1 = DateTime.Now;
- new System.Threading.Thread(() =>
- {
- Application.RunOnMainThread(() =>
- {
- while (true)
- {
- if ((DateTime.Now - dateTime1).TotalMilliseconds > second * 1000)
- {
- //榛樿涓�绉掑叧闂�
- frameLayout.RemoveFromParent();
- break;
- }
- }
- });
- })
- { IsBackground = true }.Start();
-
- }
-
-
-
-
}
}
--
Gitblit v1.8.0