| | |
| | | /// 加载自动化列表界面 |
| | | /// </summary> |
| | | /// <param name="refresview">Refresview.</param> |
| | | |
| | | static RowLayout selectedRow = new RowLayout() { Tag="0"};//记录左滑状态 |
| | | |
| | | private static async void Automationview(VerticalRefreshLayout refresview, bool no) |
| | | { |
| | | refresview.RemoveAll(); |
| | |
| | | var noIconBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(294 - 55), |
| | | Width = Application.GetMinRealAverage(756), |
| | | Height = Application.GetMinRealAverage(434), |
| | | Width = Application.GetMinRealAverage(757), |
| | | Height = Application.GetMinRealAverage(435), |
| | | UnSelectedImagePath = "Item/NoFunction.png", |
| | | X = Application.GetRealWidth(104), |
| | | }; |
| | |
| | | LineColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | SubViewWidth = Application.GetRealWidth(184),//改变编辑控件宽度多少; |
| | | Tag = i.ToString(), |
| | | |
| | | }; |
| | | fLayout.AddChidren(logicRowlayout); |
| | | //左滑菜单事件 |
| | | logicRowlayout.OpenMenuAction += () => |
| | | { |
| | | if (selectedRow.Tag.ToString() != logicRowlayout.Tag.ToString()) |
| | | { //保留左滑只有一个; |
| | | selectedRow.HideMenu();// |
| | | } |
| | | selectedRow = logicRowlayout; |
| | | }; |
| | | if (i == 1) |
| | | { |
| | | //实现android显示逻辑列表的圆角; |
| | | fLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); |
| | | logicRowlayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); |
| | | i = 2; |
| | | |
| | | }
|
| | |
|
| | | i++;
|
| | | var logicnameBtn = new Button |
| | | { |
| | | Height = Application.GetRealHeight(58), |
| | |
| | | } |
| | | return false;//表示添加失败; |
| | | |
| | | } |
| | | |
| | | ///<summary> |
| | | /// s-one门锁是否存在自动化的方法(true为存在) |
| | | /// </summary> |
| | | public static async System.Threading.Tasks.Task<bool> Exist(int valueInt = 2) |
| | | { |
| | | bool exist = false; |
| | | var Idlist = await Send.GetLogicId(valueInt); |
| | | if (Idlist.Count != 0) |
| | | { |
| | | }
|
| | |
|
| | | ///<summary>
|
| | | /// s-one门锁是否存在自动化的方法;
|
| | | /// 注意(参数2;3):valueInt=3是删除设置失效时间自动化;valueInt=2判断是否存在自动化;
|
| | | /// 返回值:0不存在;1存在;2删除成功;3删除失败; |
| | | /// </summary>
|
| | | public static async System.Threading.Tasks.Task<int> Exist(int valueInt = 2)
|
| | | {
|
| | | int exist = 0;
|
| | | var Idlist = await Send.GetLogicId(valueInt);
|
| | | if (Idlist.Count != 0)
|
| | | {
|
| | | if (valueInt == 3)
|
| | | { |
| | | for (int i = 0; i < Idlist.Count; i++) |
| | | { |
| | | //valueInt=3一条特殊的自动化(用来设置失效时间) |
| | | Send.DelLogic(Idlist[i]); |
| | | } |
| | | } |
| | | exist = true; |
| | | {
|
| | | for (int i = 0; i < Idlist.Count; i++)
|
| | | {
|
| | | //valueInt=3一条特殊的自动化(用来设置失效时间)
|
| | | var d=await Send.DelLogic(Idlist[i]);
|
| | | if (d != 0)
|
| | | {
|
| | | //删除成功
|
| | | exist = 2;
|
| | | }
|
| | | else
|
| | | {
|
| | | //删除失败 |
| | | exist = 3;
|
| | | }
|
| | | return exist;
|
| | | |
| | | } |
| | | } |
| | | exist = 1;
|
| | | } |
| | | return exist; |
| | | } |
| | | |
| | | ///<summary> |
| | | /// s-one门锁确认取消(使满足条件所有逻辑失能一次)发送的方法 |
| | | /// </summary> |
| | | public static async void LockCloseLogic(CommonDevice common) |
| | | { |
| | | //读取系统当前时间:时-分 |
| | | int h = int.Parse(DateTime.Now.ToString("HH")); |
| | | int m = int.Parse(DateTime.Now.ToString("mm")); |
| | | //转化为多少分钟; |
| | | int s = h * 60 + m; |
| | | var logicList = new List<Common.Logic>(); |
| | | logicList.Clear(); |
| | | var Idlist = await Send.GetLogicId(2); |
| | | if (Idlist.Count != 0) |
| | | { //先去读取网关看是否存在数据; |
| | | var list = await Send.ReadList(Idlist.Count, 2); |
| | | for (int j = 0; j < list.Count; j++) |
| | | { |
| | | var logic = list[j]; |
| | | foreach (var conditions in logic.Conditions) |
| | | { |
| | | var linkType = conditions["Type"]; |
| | | if (linkType == "5") |
| | | { |
| | | int startMin = int.Parse(conditions["StartMin"]); |
| | | int startHour = int.Parse(conditions["StartHour"]); |
| | | int stopMin = int.Parse(conditions["StopMin"]); |
| | | int stopHour = int.Parse(conditions["StopHour"]); |
| | | int s1 = startMin + startHour * 60;//开始时间值 |
| | | int s2 = stopMin + stopHour * 60;//结束时间值 |
| | | if (s >= s1 && s <= s2) |
| | | {
|
| | | //查找系统时间值是否属于这个范围;
|
| | | logicList.Add(logic); |
| | | } |
| | | } |
| | | }
|
| | |
|
| | | } |
| | | } |
| | | foreach (var logic in logicList) |
| | | { |
| | | logic.IsEnable = 3;//改变逻辑使能状态; |
| | | //用foreach发送命令; |
| | | Send.AddModifyLogic(logic); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |