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/GateWay.Droid/Assets/Language.ini | 1 ZigbeeApp/Shared/Phone/Device/Logic/Send.cs | 64 +++++++++++++++++++++ ZigbeeApp/Home.Ios/Resources/Language.ini | 1 ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs | 5 + ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs | 28 ++++++++- ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs | 60 ++++++++++++------- ZigbeeApp/Shared/R.cs | 1 ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 6 + 8 files changed, 137 insertions(+), 29 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini index 7ab8de0..5b3b596 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini +++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini @@ -607,6 +607,7 @@ 5370=璇烽�夋嫨鐢ㄦ埛锛屽惁鍒欐棤娉曟墽琛屼笅涓�姝�. 5371=璇烽�夋嫨鍦烘櫙锛屽惁鍒欐棤娉曟墽琛屼笅涓�姝�. 5372=璇烽�夋嫨瀹夐槻妯″紡锛屽惁鍒欐棤娉曟墽琛屼笅涓�姝�. +5373=鑷姩鍖栧凡鎵ц. diff --git a/ZigbeeApp/Home.Ios/Resources/Language.ini b/ZigbeeApp/Home.Ios/Resources/Language.ini index de0af4d..2ec9073 100755 --- a/ZigbeeApp/Home.Ios/Resources/Language.ini +++ b/ZigbeeApp/Home.Ios/Resources/Language.ini @@ -607,6 +607,7 @@ 5370=璇烽�夋嫨鐢ㄦ埛锛屽惁鍒欐棤娉曟墽琛屼笅涓�姝�. 5371=璇烽�夋嫨鍦烘櫙锛屽惁鍒欐棤娉曟墽琛屼笅涓�姝�. 5372=璇烽�夋嫨瀹夐槻妯″紡锛屽惁鍒欐棤娉曟墽琛屼笅涓�姝�. +5373=鑷姩鍖栧凡鎵ц. diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs index 7cf94cd..49660bf 100644 --- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs +++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs @@ -722,6 +722,7 @@ //new涓�涓柊閫昏緫瀵硅薄锛� Common.Logic.CurrentLogic = new Common.Logic(); Common.Logic.CurrentLogic.IsEnable = 1;//榛樿涓哄紑 + Common.Logic.CurrentLogic.LogicCustomPushText = Language.StringByID(MyInternationalizationString.defaulttext); Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.automation1); var addLogicPage = new Shared.Phone.Device.Logic.AddLogicPage(); UserView.HomePage.Instance.AddChidren(addLogicPage); @@ -1747,7 +1748,8 @@ private void ShowAutotion() { - functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; + functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; + var bjFrameLayout = new FrameLayout { Width = Application.GetRealWidth(1080 - 58), @@ -1807,7 +1809,7 @@ var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout { Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30), - BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, X = Application.GetRealWidth(58), //Radius = (uint)Application.GetRealHeight(50), Y = scenehorizontalScrol.Bottom, diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs index a110acf..b44fd18 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/AddLogicPage.cs @@ -925,8 +925,13 @@ { LocationConditionsInfo.Remove("IsValid"); } + if (LocationConditionsInfo.ContainsKey("WhoSiteUId")) + { + LocationConditionsInfo.Remove("WhoSiteUId"); + } LocationConditionsInfo.Add("Type", "7"); LocationConditionsInfo.Add("IsValid", "1"); + LocationConditionsInfo.Add("WhoSiteUId", Config.Instance.Guid); if (leavehomeSelected.Visible) { if (LocationConditionsInfo.ContainsKey("AtHome")) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs index 8c63dd5..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爜 @@ -283,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 @@ -554,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 @@ -864,12 +866,30 @@ 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 var btndevicename = new Button diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs index be44d89..a8167b2 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs @@ -18,7 +18,7 @@ Tag = "Logic"; } EditText logicTextBox; - public void Show(Action action) + public async void Show(Action action) { #region 鏈�涓婇潰鐨勫竷灞�浠g爜 @@ -497,7 +497,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 @@ -1195,9 +1196,11 @@ 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 var btndevicename = new Button { @@ -1503,11 +1506,25 @@ break; 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"; @@ -1539,7 +1556,6 @@ Common.Room room = new Common.Room(); btnregionname.Text = room.GetRoomNameBySceneId(sceneinof.Id); //Send.RoomNmae(btnregionname, deviceinof); - } @@ -1752,6 +1768,7 @@ if (e1) { Common.Logic.CurrentLogic.Actions.Remove(actions); + // devicesFrameLayout.RemoveFromParent(); var logicCommunalPage = new LogicCommunalPage(); UserView.HomePage.Instance.AddChidren(logicCommunalPage); UserView.HomePage.Instance.PageIndex += 1; @@ -1888,23 +1905,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); @@ -1952,7 +1957,18 @@ btncustompush.MouseUpEventHandler += customclick; custompushback.MouseUpEventHandler += customclick; custompushRowLayout.MouseUpEventHandler += customclick; - + btnswitch.MouseUpEventHandler += (sender1, e1) => + { + btnswitch.IsSelected = !btnswitch.IsSelected; + if (btnswitch.IsSelected) + { + custompushFrameLayout.Height = Application.GetRealHeight(160); + } + else + { + custompushFrameLayout.Height = Application.GetRealHeight(0); + } + }; #endregion @@ -2523,7 +2539,7 @@ } /// <summary> - /// 闂幇鎻愮ず妗嗙殑鏂规硶 + /// 闂幇寮忔彁绀烘鐨勬柟娉� /// </summary> /// <param name="tipText">鎻愮ず鍐呭</param> /// <param name="second">鍋滅暀鏃堕棿鍗曚綅涓簊</param> diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs index d7fa0b9..e82a359 100644 --- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs @@ -380,6 +380,16 @@ }; conditions.Add(sInfo); break; + case 7: + var diliInfo = new JObject + { + ["Type"] = int.Parse(dictionary["Type"]), + ["IsValid"] = int.Parse(dictionary["IsValid"]), + ["AtHome"] = int.Parse(dictionary["AtHome"]), + ["WhoSiteUId"] =dictionary["WhoSiteUId"], + }; + conditions.Add(diliInfo); + break; } } var actions = new JArray(); @@ -735,7 +745,59 @@ //return list1; } - + + /// <summary> + /// 鑾峰彇鍦烘櫙淇℃伅鐨勬柟娉� + /// </summary> + /// <param name="SceneId"></param> + /// <returns></returns> + public static async System.Threading.Tasks.Task<SceneUI> GetScene(int SceneId) + { + SceneUI sceneui = null; + return await System.Threading.Tasks.Task.Run(async () => + { + Action<string, string> action = (topic, data) => + { + var gatewayID = topic.Split('/')[0]; + var jObjectdata = JObject.Parse(data); + if (jObjectdata == null) + { + return; + } + + if (topic == $"{gatewayID}/Scene/GetDeviceList_Respon") + { + sceneui = new SceneUI(); + sceneui.Name = jObjectdata["Data"]["ScenesName"].ToString(); + sceneui.Id = int.Parse(jObjectdata["Data"]["ScenesId"].ToString()); + + } + }; + var mainGateWay = ZbGateway.MainGateWay; + if (mainGateWay == null) + { + Console.WriteLine("娌℃湁涓荤綉鍏�"); + return sceneui; + } + mainGateWay.GwResDataAction += action; + + var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 806 } }; + var jObjectdata1 = new JObject { { "ScenesId", SceneId } }; + jObject.Add("Data", jObjectdata1); + mainGateWay?.Send("Scene/GetDeviceList", jObject.ToString()); + var dateTime = DateTime.Now; + while ((DateTime.Now - dateTime).TotalMilliseconds < 3 * 1000) + { + await System.Threading.Tasks.Task.Delay(100); + if (sceneui!=null) + { + break; + } + } + ZbGateway.MainGateWay.GwResDataAction -= action; + return sceneui; + }); + } #endregion #region ----鑾峰彇闂ㄩ攣 diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs index 4c348f8..6d23c75 100644 --- a/ZigbeeApp/Shared/R.cs +++ b/ZigbeeApp/Shared/R.cs @@ -577,6 +577,7 @@ public readonly static int usertip = 5370; public readonly static int scenetip = 5371; public readonly static int securitytip = 5372; + public readonly static int defaulttext = 5373; #region 鐧诲綍娉ㄥ唽 /// <summary> -- Gitblit v1.8.0