From 7a23bcdf0fe5f7442aa95ec2203cd5b6670a910d Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期四, 19 十二月 2019 17:59:33 +0800 Subject: [PATCH] 2019-12-19-1 --- ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs | 129 ++++++++++++++++++++----------------------- 1 files changed, 60 insertions(+), 69 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs index ef89b3c..2b0054e 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs @@ -18,7 +18,7 @@ Tag = "LockLogic"; } EditText logicTextBox; - public void Show(Action action) + public async void Show(Action action) { #region 鏈�涓婇潰鐨勫竷灞�浠g爜 @@ -40,6 +40,7 @@ Height = Application.GetRealHeight(69), Y = Application.GetRealHeight(92), TextID = MyInternationalizationString.selection, + IsBold = true, }; topRowLayout.AddChidren(titleName); if (Common.Logic.CurrentLogic.LogicId != 0) @@ -193,11 +194,7 @@ ///娣诲姞鏉′欢鐨勭偣鍑讳簨浠� EventHandler<MouseEventArgs> conditionaddclick = (sender, e) => { - var addCondition = new AddCondition(); - addCondition.conditionsIndex = -1; - UserView.HomePage.Instance.AddChidren(addCondition); - UserView.HomePage.Instance.PageIndex += 1; - addCondition.Show(); + AddCondition(-1); }; conditionadd.MouseUpEventHandler += conditionaddclick; conditionadd1.MouseUpEventHandler += conditionaddclick; @@ -234,19 +231,14 @@ Y = Application.GetRealHeight(45 + 30), TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, TextID = MyInternationalizationString.selectunlockingmode, - X = Application.GetRealWidth(390), + X = Application.GetRealWidth(290), TextSize = 14, }; addfl.AddChidren(addtextbtn); EventHandler<MouseEventArgs> addconditionsclick = (sender, e) => { - var addCondition = new AddCondition(); - ///璁板綍绱㈠紩 - addCondition.conditionsIndex = -1; - UserView.HomePage.Instance.AddChidren(addCondition); - UserView.HomePage.Instance.PageIndex += 1; - addCondition.Show(); + AddCondition(-1); }; addbtn.MouseUpEventHandler += addconditionsclick; addtextbtn.MouseUpEventHandler += addconditionsclick; @@ -291,7 +283,8 @@ var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return obj.DeviceAddr == conditions["MacAddr"] && obj.DeviceEpoint.ToString() == conditions["Epoint"]; }); if (deviceinof == null) { - continue; + deviceinof = new ZigBee.Device.CommonDevice(); + //continue; } ///鏄剧ず璁惧鍚嶇О var btndevice = new Button @@ -326,17 +319,14 @@ BackgroundColor = ZigbeeColor.Current.LogicEditBlackColor1, Text = Language.StringByID(MyInternationalizationString.edit), TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, - Tag=i, + Tag = i, }; conditionsRowLayout.AddRightView(deviceedit); deviceedit.MouseUpEventHandler += (sender, e) => { - var addCondition = new AddCondition(); - ///璁板綍绱㈠紩 - addCondition.conditionsIndex = int.Parse(deviceedit.Tag.ToString()); - UserView.HomePage.Instance.AddChidren(addCondition); - UserView.HomePage.Instance.PageIndex += 1; - addCondition.Show(); + + int intvalue = int.Parse(deviceedit.Tag.ToString()); + AddCondition(intvalue); }; ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� @@ -357,39 +347,17 @@ case DeviceType.DoorLock: { conditionIcon.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["Account"]; - // break; - // } - // } - //} - - //(0鎸夐敭/3鍗�/15鎸囩汗) - switch (conditions["AttriButeId"]) + for (int a = 0; a < Common.Logic.CurrentLogic.Accounts.Count; a++) { - case "0": + if (Common.Logic.CurrentLogic.Accounts[a]["Type"] == "1") + { + if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"]) { - devicestatus.Text = Language.StringByID(MyInternationalizationString.lockpassword); + devicestatus.Text = Common.Logic.CurrentLogic.Accounts[a]["Account"]; + break; } - break; - case "3": - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.ic); - } - break; - case "15": - { - devicestatus.Text = Language.StringByID(MyInternationalizationString.fingerprint); - } - break; - + } } - } break; } @@ -404,10 +372,8 @@ Text = Language.StringByID(MyInternationalizationString.del), }; conditionsRowLayout.AddRightView(del); - del.MouseUpEventHandler += (sender, e) => { - var alert = new Alert(Language.StringByID(MyInternationalizationString.tip), Language.StringByID(MyInternationalizationString.doyouwanttodelete), Language.StringByID(MyInternationalizationString.cancel), Language.StringByID(MyInternationalizationString.confrim)); alert.ResultEventHandler += (sender1, e1) => @@ -589,7 +555,8 @@ var deviceinof = Common.Logic.LogicDviceList.Find((obj) => { return ((obj.DeviceAddr == obj1) && (obj.DeviceEpoint.ToString() == obj2)); }); if (deviceinof == null) { - continue; + deviceinof = new ZigBee.Device.CommonDevice(); + //continue; } ///璁惧鍚嶇ОButton @@ -643,7 +610,7 @@ ///缂栬緫鐐瑰嚮浜嬩欢 deviceedit.MouseUpEventHandler += (sender, e) => { - + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; this.AddChidren(flMain); LockAddDevice.CurrentDeviceStateView(flMain, deviceinof, true); @@ -796,22 +763,19 @@ bool ifclose = false; foreach (var status in TaskList) { - if (status["TaskType"].ToString() == "1") + if (TaskList.Count == 1) { - if (status["Data1"].ToString() == "0") - { - // devicestatus.Text = Language.StringByID(MyInternationalizationString.close); - - ifclose = false; - } - else if (status["Data1"].ToString() == "1") - { - //devicestatus.Text = Language.StringByID(MyInternationalizationString.open); - ifclose = true; - } - + //鏁扮粍鍙湁涓�涓厓绱犺鏄庡綋鍓嶇┖璋冪姸鎬佷负鍏筹紱 + ifclose = false; + //濡傛灉绌鸿皟鐘舵�佹槸鍏筹紱鐩存帴璺冲嚭for寰潖锛� + break; } - else if (status["TaskType"].ToString() == "5") + else + { + ifclose = true; + } + + if (status["TaskType"].ToString() == "5") { if (status["Data1"] == "3") {//3---璁剧疆宸ヤ綔妯″紡(1:鑷姩;3:鍒跺喎;4:鍒剁儹;7:閫侀;8:闄ゆ箍) @@ -902,11 +866,29 @@ case 2: { + //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙; var sceneinof = Common.Room.AllRoomSceneUIList.Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); }); + //鏈湴娌℃湁瀛樺湪; if (sceneinof == null) { - continue; + //鍦ㄧ綉鍏虫煡鎵捐鍦烘櫙; + sceneinof = await Send.GetScene(int.Parse(actions["DeviceAddr"].ToString())); + //缃戝叧娌℃湁瀛樺湪; + if (sceneinof == null) + { + + //娉ㄨВ:鏈湴鍜岀綉鍏抽兘涓嶅瓨鍦ㄨ鍦烘櫙,鐣岄潰灏嗕笉浼氭樉绀鸿鍦烘櫙; + //sceneinof = new SceneUI(); + //绉婚櫎璇ュ満鏅暟鎹�; + Common.Logic.CurrentLogic.Actions.Remove(actions); + //绉婚櫎璇ュ満鏅鍥�; + devicesFrameLayout.RemoveFromParent(); + continue; + } } + + + actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png"; ///璁惧鍚嶇ОButton @@ -1156,5 +1138,14 @@ }; } + public void AddCondition(int value) + { + var addCondition = new AddCondition(); + addCondition.conditionsIndex = value; + UserView.HomePage.Instance.AddChidren(addCondition); + UserView.HomePage.Instance.PageIndex += 1; + addCondition.Show(); + + } } } -- Gitblit v1.8.0