From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 28 二月 2020 15:25:13 +0800 Subject: [PATCH] 2020.2.28 --- ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs | 267 ++++++++++++++++++++++++++++++----------------------- 1 files changed, 150 insertions(+), 117 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs index 37ff757..f594023 100755 --- 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爜 @@ -32,14 +32,15 @@ var titleName = new Button { - TextSize = 16, + TextSize = 17, TextColor = ZigbeeColor.Current.LogicTextBlackColor, TextAlignment = TextAlignment.CenterLeft, X = Application.GetRealWidth(176), - Width = Application.GetRealWidth(400), + Width = Application.GetRealWidth(600), Height = Application.GetRealHeight(69), Y = Application.GetRealHeight(92), TextID = MyInternationalizationString.selection, + IsBold = true, }; topRowLayout.AddChidren(titleName); if (Common.Logic.CurrentLogic.LogicId != 0) @@ -109,6 +110,7 @@ TextID = MyInternationalizationString.automationname, TextColor = ZigbeeColor.Current.LogicTextBlackColor, Y = Application.GetRealHeight(35), + TextSize = 15, }; logicnamefl.AddChidren(text); @@ -120,7 +122,7 @@ X = text.Right, TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.LogicBtnCancelColor, - TextSize = 13, + TextSize = 14, Text = Common.Logic.CurrentLogic.LogicName, //TextID=MyInternationalizationString.automation1, }; @@ -163,7 +165,7 @@ TextColor = ZigbeeColor.Current.LogicTextBlackColor, Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(60), - TextSize = 16, + TextSize = 15, Gravity = Gravity.CenterVertical, }); @@ -192,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; @@ -229,22 +227,18 @@ var addtextbtn = new Button { Height = Application.GetRealHeight(58), - Width = Application.GetRealWidth(300), + Width = Application.GetRealWidth(500), 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; @@ -289,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 @@ -300,6 +295,7 @@ TextAlignment = TextAlignment.CenterLeft, Text = deviceinof.DeviceEpointName, TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, }; conditionsRowLayout.AddChidren(btndevice); @@ -323,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); }; ///鏄剧ず璁惧鏉′欢鐘舵�佹帶浠� @@ -345,6 +338,7 @@ TextAlignment = TextAlignment.CenterRight, X = Application.GetRealWidth(400), TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; conditionsRowLayout.AddChidren(devicestatus); @@ -353,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 = conditions["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; } @@ -400,23 +372,20 @@ 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) => - { - if (e1) - { - var lockLogicCommunalPage = new LockLogicCommunalPage(); - UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); - UserView.HomePage.Instance.PageIndex += 1; - lockLogicCommunalPage.Show(() => { }); - } - }; + 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 lockLogicCommunalPage = new LockLogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + lockLogicCommunalPage.Show(() => { }); + }; }; @@ -455,7 +424,7 @@ TextColor = ZigbeeColor.Current.LogicTextBlackColor, Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(60), - TextSize = 16, + TextSize = 15, Gravity = Gravity.CenterVertical, }; targetRowLayout.AddChidren(btntargettitle); @@ -525,6 +494,7 @@ TextColor = ZigbeeColor.Current.LogicBlankBackgroundColor, TextID = MyInternationalizationString.lockaddaction, X = Application.GetRealWidth(390), + TextSize = 14, }; addfl.AddChidren(addtextbtn); EventHandler<MouseEventArgs> addfunctionclick = (sender, e) => @@ -583,7 +553,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 @@ -595,6 +566,7 @@ TextAlignment = TextAlignment.CenterLeft, Text = deviceinof.DeviceEpointName, TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, }; actionsrowLayout.AddChidren(btndevicename); @@ -620,6 +592,7 @@ TextAlignment = TextAlignment.CenterRight, X = Application.GetRealWidth(450), TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 14, }; actionsrowLayout.AddChidren(devicestatus); @@ -635,7 +608,7 @@ ///缂栬緫鐐瑰嚮浜嬩欢 deviceedit.MouseUpEventHandler += (sender, e) => { - + var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; this.AddChidren(flMain); LockAddDevice.CurrentDeviceStateView(flMain, deviceinof, true); @@ -788,22 +761,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:闄ゆ箍) @@ -894,11 +864,33 @@ case 2: { + //鍦ㄦ湰鍦版煡鎵捐鍦烘櫙; var sceneinof = Common.Room.AllRoomSceneUIList.Find((obj) => { return obj.Id.ToString() == actions["DeviceAddr"].ToString(); }); + //鏈湴娌℃湁瀛樺湪; if (sceneinof == null) { - continue; + //瀹炵幇鐩殑:鏄剧ず鍑烘潵璁╁彲浠ヨ嚜宸辨槸鍚﹀垹闄� + 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 } + + + actionsIcon.UnSelectedImagePath = "ZigeeLogic/scene.png"; ///璁惧鍚嶇ОButton @@ -910,6 +902,7 @@ TextAlignment = TextAlignment.CenterLeft, Text = sceneinof.Name, TextColor = ZigbeeColor.Current.LogicTextBlackColor, + TextSize = 14, }; actionsrowLayout.AddChidren(btndevicename); @@ -945,16 +938,19 @@ 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) => - { - if (e1) - { - Common.Logic.CurrentLogic.Actions.Remove(actions); - } - }; + 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); + var lockLogicCommunalPage = new LockLogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + lockLogicCommunalPage.Show(() => { }); + }; }; @@ -996,6 +992,7 @@ Height = Application.GetRealHeight(60), Gravity = Gravity.CenterVertical, TextID = MyInternationalizationString.pushswitch, + TextSize = 14, }; pushswitchRowlayout.AddChidren(btnswitchtxet); @@ -1009,23 +1006,11 @@ Gravity = Gravity.CenterVertical, }; pushswitchRowlayout.AddChidren(btnswitch); - btnswitch.MouseUpEventHandler += (sender1, e1) => - { - btnswitch.IsSelected = !btnswitch.IsSelected; - if (btnswitch.IsSelected) - { - - } - else - { - - } - }; - + var custompushFrameLayout = new FrameLayout { - Height = Application.GetRealHeight(160), + Height = Application.GetRealHeight(0), BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, }; middle.AddChidren(custompushFrameLayout); @@ -1048,6 +1033,7 @@ Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(60), Gravity = Gravity.CenterVertical, + TextSize = 14, }; custompushRowLayout.AddChidren(btncustompush); @@ -1075,7 +1061,37 @@ #endregion + bool tag = false;//鏍囪寮�鍏崇姸鎬�; + btnswitch.MouseUpEventHandler += (sender1, e1) => + { + btnswitch.IsSelected = !btnswitch.IsSelected; + if (btnswitch.IsSelected) + { + tag = true; + custompushFrameLayout.Height = Application.GetRealHeight(160); + Common.Logic.CurrentLogic.LogicIsCustomPushText = 1; + } + else + { + tag = false; + custompushFrameLayout.Height = Application.GetRealHeight(0); + Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; + } + Send.Zj(tag, Common.Logic.CurrentLogic); + }; + if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) + { + tag = false; + btnswitch.IsSelected = false; + custompushFrameLayout.Height = Application.GetRealHeight(0); + } + else + { + tag = true; + btnswitch.IsSelected = true; + custompushFrameLayout.Height = Application.GetRealHeight(160); + } var saveFrameLayout = new FrameLayout { Y = middle.Bottom, @@ -1093,6 +1109,7 @@ BackgroundColor = ZigbeeColor.Current.LogicBtnSaveBackgroundColor, TextID = MyInternationalizationString.Save, TextColor = ZigbeeColor.Current.LogicBtnSaveTextColor, + TextSize = 16, }; saveFrameLayout.AddChidren(btnsave); btnsave.MouseUpEventHandler += async (sender, e) => @@ -1100,15 +1117,18 @@ var name = logicTextBox.Text.Trim(); if (string.IsNullOrEmpty(logicTextBox.Text.Trim())) { - new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), Language.StringByID(MyInternationalizationString.Close)).Show(); + var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal, + Language.StringByID(MyInternationalizationString.PleaseEnterLogicName), + Language.StringByID(MyInternationalizationString.confrim)); + alert.Show(); return; } - var logicname = Common.Logic.LockLogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name); - if (logicname != null) - { - new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show(); - return; - } + //var logicname = Common.Logic.LockLogicList.Find((logic) => Common.Logic.CurrentLogic.LogicId != logic.LogicId && logic.LogicName == name); + //if (logicname != null) + //{ + // new Alert(Language.StringByID(MyInternationalizationString.Tip), Language.StringByID(MyInternationalizationString.Rename), Language.StringByID(MyInternationalizationString.Close)).Show(); + // return; + //} Common.Logic.CurrentLogic.LogicName = name; @@ -1122,6 +1142,10 @@ { Common.Logic.CurrentLogic.LogicId = logicifon.LogicId; Common.Logic.LockLogicList.Add(Common.Logic.CurrentLogic); + if (tag) + { + Send.Zj(tag, Common.Logic.CurrentLogic); + } } } else @@ -1140,5 +1164,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