| | |
| | | /// </summary> |
| | | public static void SkipAddLogic(int intvalue, DoorLock doorLock = null, UserCenter.MemberInfoRes accountObj = null) |
| | | { |
| | | /// 0.正常自动化;1.门锁自动化;2.门锁常开.关; |
| | | /// 0.正常自动化;1.门锁自动化;2.Sone门锁; |
| | | switch (intvalue) |
| | | { |
| | | case 0:
|
| | |
| | | UserView.HomePage.Instance.AddChidren(addLogicPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addLogicPage.Show(); |
| | | |
| | | }
|
| | | break; |
| | | case 1:
|
| | |
| | | break; |
| | | case 2:
|
| | | { |
| | | ///Sone门锁主入口 |
| | | if (doorLock == null) |
| | | { |
| | | ///防止抛异常 |
| | | doorLock = new DoorLock(); |
| | | } |
| | | Send.CurrentDoorLock = doorLock; |
| | | ///进来刷新一次设备列表; |
| | | Common.Logic.LogicDviceList.Clear(); |
| | | if (Common.Logic.LogicDviceList.Count == 0) |
| | | { |
| | | Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); |
| | | } |
| | | //读取系统当前时间:时-分 |
| | | //读取系统当前时间:时-分 |
| | | var h = DateTime.Now.ToString("HH"); |
| | | var m = DateTime.Now.ToString("mm"); |
| | | Dictionary<string, string> timeConditionsInfo = new Dictionary<string, string>(); |
| | | timeConditionsInfo.Add("Type", "0"); |
| | | timeConditionsInfo.Add("IsValid", "1"); |
| | | timeConditionsInfo.Add("DateType", "0"); |
| | | timeConditionsInfo.Add("RemindTime", "0"); |
| | | timeConditionsInfo.Add("EnDelay", "0"); |
| | | timeConditionsInfo.Add("DelayTime", "0"); |
| | | timeConditionsInfo.Add("DoorLockOpenDelayTime", "0"); |
| | | timeConditionsInfo.Add("StartHour", h); |
| | | timeConditionsInfo.Add("StartMin", m); |
| | | Dictionary<string, object> actionsInfo = new Dictionary<string, object>(); |
| | | actionsInfo.Add("LinkType", 8); |
| | | actionsInfo.Add("DeviceAddr", doorLock.DeviceAddr); |
| | | actionsInfo.Add("Epoint", "200"); |
| | | actionsInfo.Add("PassData", "055704010113");//默认门锁常关 |
| | | |
| | | //new一个新逻辑对象; |
| | | //新增门锁常开模式自动化入口; |
| | | Common.Logic.CurrentLogic = new Common.Logic(); |
| | | Common.Logic.CurrentLogic.IsEnable = 1;//默认为开 |
| | | Common.Logic.CurrentLogic.LogicType = 2;//标记逻辑类型 |
| | | Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.openmode); |
| | | Common.Logic.CurrentLogic.Conditions.Add(timeConditionsInfo);//添加条件 |
| | | Common.Logic.CurrentLogic.Actions.Add(actionsInfo);//添加目标 |
| | | var oneLogic = new OneLogic(); |
| | | UserView.HomePage.Instance.AddChidren(oneLogic); |
| | | var addLogicPage = new SoneLogicList(); |
| | | UserView.HomePage.Instance.AddChidren(addLogicPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | oneLogic.Show(false); |
| | | addLogicPage.Show(); |
| | | |
| | | }
|
| | | break; |
| | | } |
| | |
| | | |
| | | |
| | | #region ◆ 自动化__________________________ |
| | | |
| | | /// <summary> |
| | | /// 自动化功能代码入口 |
| | | /// </summary> |
| | |
| | | Automationview(logicScrolView, no); |
| | | CommonPage.Loading.Hide(); |
| | | } |
| | | static RowLayout selectedRow = new RowLayout() { Tag = "0" };//记录左滑状态 |
| | | /// <summary> |
| | | /// 加载自动化列表界面 |
| | | /// </summary> |
| | | /// <param name="refresview">Refresview.</param> |
| | | |
| | | static RowLayout selectedRow = new RowLayout() { Tag="0"};//记录左滑状态 |
| | | |
| | | private static async void Automationview(VerticalRefreshLayout refresview, bool no) |
| | | { |
| | | refresview.RemoveAll(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | |
| | | currentLogic.LogicName = Language.StringByID(R.MyInternationalizationString.openmode); |
| | | currentLogic.Conditions.Add(timeConditionsInfo); |
| | | currentLogic.Actions.Add(actionsInfo); |
| | | Exist(3);//查找是否存在设置过失效时间(有的话删除,再添加)
|
| | | var logicIfon = await Send.AddModifyLogic(currentLogic); |
| | | if (logicIfon != null && logicIfon.LogicId != 0)
|
| | | {
|
| | |
| | |
|
| | | ///<summary>
|
| | | /// s-one门锁是否存在自动化的方法;
|
| | | /// 注意(参数2;3):valueInt=3是删除设置失效时间自动化;valueInt=2判断是否存在自动化;
|
| | | /// 返回值:0不存在;1存在;2删除成功;3删除失败; |
| | | /// 注意(参数:2-常开自动化;3-失效时间自动化); |
| | | /// 返回值:0不存在;其它值都存在; |
| | | /// </summary>
|
| | | public static async System.Threading.Tasks.Task<int> Exist(int valueInt = 2)
|
| | | public static async System.Threading.Tasks.Task<int> Exist(int valueInt) |
| | | {
|
| | | 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一条特殊的自动化(用来设置失效时间)
|
| | | var d=await Send.DelLogic(Idlist[i]);
|
| | | if (d == 0)
|
| | | {
|
| | | //删除成功
|
| | | exist = 2;
|
| | | }
|
| | | else
|
| | | {
|
| | | //删除失败 |
| | | exist = 3;
|
| | | }
|
| | | return exist;
|
| | | //默认取第一个逻辑ID |
| | | exist = Idlist[0]; |
| | | |
| | | } |
| | | } |
| | | exist = 1;
|
| | | } |
| | | return exist; |
| | | } |
| | | |
| | | |
| | | ///<summary> |
| | | ///获取逻辑信息 |
| | | /// 返回值:null不存在;其它值都存在; |
| | | /// </summary> |
| | | public static async System.Threading.Tasks.Task<Common.Logic> GetLogicIfon() |
| | | { |
| | | Common.Logic logic = null; |
| | | var Idlist = await Send.GetLogicId(3); |
| | | if (Idlist.Count != 0) |
| | | { |
| | | //默认取第一个逻辑ID(时效性只有一条逻辑) |
| | | int exist = Idlist[0]; |
| | | logic = await Send.GetLogic(exist, 3); |
| | | } |
| | | return logic; |
| | | } |
| | | } |
| | | } |
| | | |