From 0f5a53c7b36c27a0f2bec12e6119207edb6860f8 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期二, 29 十月 2019 14:29:21 +0800 Subject: [PATCH] 修改主页卡死问题 --- ZigbeeApp/GateWay.Droid/Assets/Language.ini | 3 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 8 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs | 21 ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs | 5 ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj | 12 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs | 262 ++++++ ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/EditorCommonForm.cs | 36 ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorTargetSelectForm.cs | 15 ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs | 711 ++++------------- ZigbeeApp/Shared/R.cs | 14 ZigbeeApp/Shared/Common/DeviceUI.cs | 4 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs | 170 ++++ ZigbeeApp/Shared/Shared.projitems | 3 ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs | 17 /dev/null | 260 ------ ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs | 12 ZigbeeApp/Shared/Phone/Device/Logic/Send.cs | 128 +- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs | 23 ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs | 17 ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs | 48 - ZigbeeApp/Shared/Common/Device.cs | 6 ZigbeeApp/Shared/Phone/UserView/UserPage.cs | 439 ++++------ ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs | 29 23 files changed, 1,011 insertions(+), 1,232 deletions(-) diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini index 25ab4d2..b45939a 100755 --- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini +++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini @@ -1495,6 +1495,9 @@ 15853=闄ゆ箍 15854=鎵撳紑绌鸿皟澶辫触 15855=鍏抽棴绌鸿皟澶辫触 +15856=璇锋敞鎰忔竻娲楁护缃戝摝 +15857=鏃犲彲鍏变韩鐨勫満鏅� +15858=鏃犲彲鍏变韩鐨勮澶� ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� 18004=鎸囧畾缃戝叧宸茬粡琚粦瀹� diff --git a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj index f15e4cb..2f9c150 100755 --- a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj +++ b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj @@ -92,12 +92,6 @@ <Reference Include="MQTTnet.Core, Version=2.4.0.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\MQTTnet.2.4.0\lib\netstandard1.3\MQTTnet.Core.dll</HintPath> </Reference> - <Reference Include="Shared.Droid.GDMapKit"> - <HintPath>..\Shared\DLL\Shared.Droid.GDMapKit.dll</HintPath> - </Reference> - <Reference Include="Shared.Droid.PickerView"> - <HintPath>..\Shared\DLL\Shared.Droid.PickerView.dll</HintPath> - </Reference> <Reference Include="Shared.Droid.TouchID"> <HintPath>..\Shared\DLL\Shared.Droid.TouchID.dll</HintPath> </Reference> @@ -142,12 +136,6 @@ </Reference> <Reference Include="Microsoft.AppCenter.Analytics"> <HintPath>..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.dll</HintPath> - </Reference> - <Reference Include="Shared.Droid.TBL"> - <HintPath>..\Shared\DLL\Shared.Droid.TBL.dll</HintPath> - </Reference> - <Reference Include="Shared.Droid.TCL"> - <HintPath>..\Shared\DLL\Shared.Droid.TCL.dll</HintPath> </Reference> <Reference Include="Shared.Droid.HDLWidget"> <HintPath>..\Shared\DLL\Shared.Droid.HDLWidget.dll</HintPath> diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs index 15b7c71..c175a45 100755 --- a/ZigbeeApp/Shared/Common/Device.cs +++ b/ZigbeeApp/Shared/Common/Device.cs @@ -1163,14 +1163,14 @@ public DeviceUI GetDeviceUI(string filePath) { string[] arry = filePath.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); - if (arry.Length != 5) + if (arry.Length != 4) { return null; } //鍒涘缓涓�涓柊鐨勪笢瑗跨粰杩囧幓 var deviceUi = new DeviceUI(); - deviceUi.DeviceAddr = arry[3]; - deviceUi.DeviceEpoint = Convert.ToInt32(arry[4]); + deviceUi.DeviceAddr = arry[2]; + deviceUi.DeviceEpoint = Convert.ToInt32(arry[3]); return deviceUi; } diff --git a/ZigbeeApp/Shared/Common/DeviceUI.cs b/ZigbeeApp/Shared/Common/DeviceUI.cs index 01b042b..7bad709 100755 --- a/ZigbeeApp/Shared/Common/DeviceUI.cs +++ b/ZigbeeApp/Shared/Common/DeviceUI.cs @@ -35,9 +35,9 @@ var myDevice = Common.LocalDevice.Current.GetDevice(DeviceAddr, DeviceEpoint); if (myDevice != null) { - return $"DeviceUI_{myDevice.FilePath}"; + return myDevice.FilePath; } - return $"DeviceUI_Unkwon"; + return $"Device_Unkwon"; } } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs index a4e865e..4c72631 100755 --- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs @@ -76,7 +76,7 @@ /// 鑾峰彇Logic鐨勬柟娉� /// </summary> /// <returns>The logic identifier.</returns> - public static async System.Threading.Tasks.Task<Common.Logic> GetLogic(int LogicId,int LogicType) + public static async System.Threading.Tasks.Task<Common.Logic> GetLogic(int LogicId, int LogicType) { return await System.Threading.Tasks.Task.Run(async () => { @@ -452,13 +452,26 @@ } } var accounts = new JArray(); - foreach (var dictionary in logic.Accounts) { + foreach (var dictionary in logic.Accounts) + { var Type = int.Parse(dictionary["Type"]); switch (Type) { - case 1: { + case 1: + { /// - } break; + if (logic.LogicType == 1) + { + var accounts1 = new JObject + { + ["Type"] = int.Parse(dictionary["Type"]), + ["Account"] = dictionary["Account"], + + }; + accounts.Add(accounts1); + } + } + break; case 7: { var location = new JObject @@ -481,6 +494,7 @@ { "IsEnable", logic.IsEnable} , { "LogicName", logic.LogicName}, { "Relationship",logic.Relationship} , + { "LogicType",logic.LogicType} , { "LogicCustomPushText",logic.LogicCustomPushText} , { "TimeAttribute", timeAttribute} , { "Conditions", conditions }, @@ -569,13 +583,13 @@ /// 鑾峰彇Logic鍒楄〃鐨勬柟娉� /// </summary> /// <returns>The logic identifier.</returns> - public static async System.Threading.Tasks.Task<List<Common.Logic>> ReadList(int sum,int LogicType) + public static async System.Threading.Tasks.Task<List<Common.Logic>> ReadList(int sum, int LogicType) { return await System.Threading.Tasks.Task.Run(async () => { - var listLogic = new List<Common.Logic>(); - // bool @bool = false; + var listLogic = new List<Common.Logic>(); + // bool @bool = false; Action<string, string> action = (topic, data) => { var gatewayID = topic.Split('/')[0]; @@ -706,57 +720,57 @@ System.Collections.Specialized.NameValueCollection postValues = new System.Collections.Specialized.NameValueCollection(); postValues.Add("RequestVersion", CommonPage.RequestVersion); postValues.Add("ReqDto.LoginAccessToken", Config.Instance.Token); - System.Threading.Tasks.Task.Run(() => - { - try - { - - byte[] responseArray = webClient.UploadValues(url, postValues); - var str = System.Text.Encoding.UTF8.GetString(responseArray); - var jObject = JObject.Parse(str); - if (jObject == null || jObject["StateCode"].ToString() != "Success") - { - return; - } - var pageData = jObject["ResponseData"]["PageData"].ToString(); - var datalist = JArray.Parse(pageData); - for (int i = 0; i < datalist.Count; i++) - { - var data = JObject.Parse(datalist[i].ToString()); - if (Config.Instance.HomeId == data["Id"].ToString()) - { - Residential residential = new Residential(); - - if (Convert.ToBoolean(data["IsOthreShare"].ToString())) - { + System.Threading.Tasks.Task.Run(() => + { + try + { + + byte[] responseArray = webClient.UploadValues(url, postValues); + var str = System.Text.Encoding.UTF8.GetString(responseArray); + var jObject = JObject.Parse(str); + if (jObject == null || jObject["StateCode"].ToString() != "Success") + { + return; + } + var pageData = jObject["ResponseData"]["PageData"].ToString(); + var datalist = JArray.Parse(pageData); + for (int i = 0; i < datalist.Count; i++) + { + var data = JObject.Parse(datalist[i].ToString()); + if (Config.Instance.HomeId == data["Id"].ToString()) + { + Residential residential = new Residential(); + + if (Convert.ToBoolean(data["IsOthreShare"].ToString())) + { //鍒嗕韩鑰匢D residential.Id = data["Id"].ToString(); //鏄惁鏄垎浜处鍙穂true(鏄垎浜�);false;(涓嶆槸鍒嗕韩)]; residential.IsOthreShare = Convert.ToBoolean(data["IsOthreShare"].ToString()); //鍒嗕韩鑰呬綇瀹匢D - residential.MainUserDistributedMark = data["MainUserDistributedMark"].ToString(); - residential.IsOtherAccountCtrl = true; - residential.doorlockmac = doorlockMac; - list = ReadToken(residential); - } - else - { - residential.Url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/DoorLock/GetDoorLockPager"; - residential.Token = Config.Instance.Token; - residential.Id = Config.Instance.HomeId; - residential.IsOtherAccountCtrl = false; - residential.doorlockmac = doorlockMac; - list = ReadDoorLock(residential); - - } - } - - } - } - catch { } - }); + residential.MainUserDistributedMark = data["MainUserDistributedMark"].ToString(); + residential.IsOtherAccountCtrl = true; + residential.doorlockmac = doorlockMac; + list = ReadToken(residential); + } + else + { + residential.Url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/DoorLock/GetDoorLockPager"; + residential.Token = Config.Instance.Token; + residential.Id = Config.Instance.HomeId; + residential.IsOtherAccountCtrl = false; + residential.doorlockmac = doorlockMac; + list = ReadDoorLock(residential); + + } + } + + } + } + catch { } + }); var datetime = DateTime.Now; - while ((DateTime.Now - datetime).TotalMilliseconds < 3*1000) + while ((DateTime.Now - datetime).TotalMilliseconds < 3 * 1000) { if (list.Count != 0) { @@ -815,7 +829,7 @@ public static List<DoorLock> ReadDoorLock(Residential lockifon) { List<DoorLock> list = new List<DoorLock>(); - System.Net.WebClient webClient = new System.Net.WebClient(); + System.Net.WebClient webClient = new System.Net.WebClient(); System.Collections.Specialized.NameValueCollection postValues = new System.Collections.Specialized.NameValueCollection(); postValues.Add("RequestVersion", CommonPage.RequestVersion); postValues.Add("LoginAccessToken", lockifon.Token); @@ -895,13 +909,13 @@ public class MembershipIfon { public string MembershipId = string.Empty; - public List<string> UserIdMode=new List<string>(); + public List<string> UserIdMode = new List<string>(); public string MembershipName = string.Empty; } - public static List<MembershipIfon> UserList = new List<MembershipIfon>(); - - + public static List<MembershipIfon> UserList = new List<MembershipIfon>(); + + #endregion } } diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SuperGateway.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SuperGateway.cs deleted file mode 100755 index 4c74570..0000000 --- a/ZigbeeApp/Shared/Phone/Device/Logic/SuperGateway.cs +++ /dev/null @@ -1,260 +0,0 @@ -锘�//using System; -//using System.Text; -//using System.Collections.Generic; -//using System.Threading; -//using Newtonsoft.Json; -//using Shared; -//using Shared.SimpleControl.Phone; -//using Newtonsoft.Json.Linq; -//using SmartHome; - -//namespace SuperGateWay -//{ - -// class SuperGateway11111 : FrameLayout -// { -// class DeviceInfo{} - -// public static SuperGateway11111 mSuperGateway; -// FrameLayout mFrameLayout; -// List<DeviceInfo> DevicesList = new List<DeviceInfo> (); -// List<Scene> SceneList = new List<Scene> (); - -// ///绋嬪簭涓诲叆鍙� 浼犲叆楂樼骇缃戝叧璁惧鍙凤紝瀛愮綉鍙凤紱 -// //public void SuperGateway (byte subnet_id, byte device_id) -// public void Show () -// { -// mSuperGateway = this; - -// iniView (); -// } - - -// /// <summary> -// /// 瑙f瀽璁惧淇℃伅 -// /// </summary> -// /// <param name="jsonData">Json data.</param> -// void resolveDevice (string jsonData) -// { -// var o = JObject.Parse (jsonData); -// if (o == null) { -// return; -// } -// var type = o ["type"]; -// if (type == null) { -// return; -// } -// switch (type.ToString ()) { -// case "light": -// var light = JsonConvert.DeserializeObject<Light> (jsonData); -// break; -// case "curtain": -// break; -// case "air_conditioner": -// break; -// } -// } - -// public override void RemoveFromParent () -// { -// base.RemoveFromParent (); -// mSuperGateway = null; -// } - -// void iniView () -// { - -// AddChidren (new Button { -// Height = Application.GetRealHeight (30), -// BackgroundColor = 0xFF1B1B1B, -// }); - -// var topFrameLayout = new FrameLayout { -// Height = Application.GetRealHeight (100), -// Y = Application.GetRealHeight (30), -// BackgroundColor = 0xFF1F1F1F, -// }; -// AddChidren (topFrameLayout); - -// var devuidnnamelist = new Button { -// //TextID = MyInternationalizationString.Musiclike, -// Text = "璁惧鍒楄〃" -// }; -// topFrameLayout.AddChidren (devuidnnamelist); - -// var back = new Button { -// Width = Application.GetRealWidth (82), -// Height = Application.GetRealHeight (89), -// X = Application.GetRealWidth (10), -// Gravity = Gravity.CenterVertical, -// UnSelectedImagePath = "MusicIcon/HomepageBack.png", -// }; -// topFrameLayout.AddChidren (back); -// back.MouseDownEventHandler += (sender, e) => { -// RemoveFromParent (); -// }; - -// VerticalScrolViewLayout middle = new VerticalScrolViewLayout { -// Y = topFrameLayout.Bottom, -// Height = Application.GetRealHeight (1136 - 130), -// BackgroundColor = 0xff2F2F2F, -// }; -// AddChidren (middle); - -// foreach (var uidlist in DevicesList) { -// var uidrow = new RowLayout { -// Height = Application.GetRealHeight (100), -// }; -// middle.AddChidren (uidrow); - -// var btnuid = new Button { -// Height = Application.GetRealHeight (100), -// X = Application.GetRealWidth (60), -// Gravity = Gravity.CenterLeft, -// }; -// uidrow.AddChidren (btnuid); -// } - -// } - - -// /// <summary> -// /// 鑾峰彇鎵�鏈夎澶嘦ID -// /// </summary> -// /// <returns>The devices uid list.</returns> -// public static async System.Threading.Tasks.Task<string> GetDevicesUidList () -// { -// var packetInfo = new PacketInfo () { -// command = "devices_get", -// messageType = "CON", -// }; -// var dd = await sendData (packetInfo); -// return dd; - -// } -// /// <summary> -// /// 鏍规嵁UID鏉ヨ幏鍙栬澶囦俊鎭� -// /// </summary> -// /// <returns>The device by uid.</returns> -// /// <param name="uid">Uid.</param> -// public static async System.Threading.Tasks.Task<string> getDeviceByUID (string uid) -// { -// JObject jo = new JObject (); -// jo.Add ("uid", uid); -// var packetInfo = new PacketInfo () { -// command = "device_get", -// messageType = "CON", -// buffer = System.Text.Encoding.UTF8.GetBytes (jo.ToString ()), -// }; -// var deviceuid = await sendData (packetInfo); - -// return deviceuid; -// } - - -// #region 鍦烘櫙 -// /// <summary> -// /// 娣诲姞鍦烘櫙 -// /// </summary> -// /// <param name="sceneName">Scene name.</param> -// /// <param name="action">Action.</param> -// public static async void AppendScene (string sceneName, Action<SuperGateWay.Scene> action) -// { -// var jo = new JObject (); -// jo.Add ("name", sceneName); -// //string sss = "{\"name\":\"home\",\"actions\":{}}"; -// var packetInfo = new PacketInfo () { -// command = "scene_append", -// messageType = "CON", -// buffer = System.Text.Encoding.UTF8.GetBytes (jo.ToString ()), -// }; -// var result = await sendData (packetInfo); -// if (result == null) { -// action (null); -// } else { -// var dd = Newtonsoft.Json.JsonConvert.DeserializeObject<SuperGateWay.Scene> (result); -// action (dd); -// } -// } - -// /// <summary> -// /// 鑾峰彇鎵�鏈夊満鏅疘D -// /// </summary> -// /// <returns>The devices uid list.</returns> -// System.Threading.Tasks.Task<string> getSceneList () -// { -// var packetInfo = new PacketInfo () { -// command = "scenes_get", -// messageType = "CON", -// }; -// return sendData (packetInfo); -// } -// /// <summary> -// /// 鏍规嵁UID鏉ヨ幏鍙栧満鏅俊鎭� -// /// </summary> -// /// <returns>The device by uid.</returns> -// /// <param name="uid">Uid.</param> -// System.Threading.Tasks.Task<string> getSceneByUID (string uid) -// { -// var jo = new JObject (); -// jo.Add ("uid", uid); -// var packetInfo = new PacketInfo () { -// command = "scene_get", -// messageType = "CON", -// buffer = System.Text.Encoding.UTF8.GetBytes (jo.ToString ()), -// }; -// return sendData (packetInfo); -// } -// #endregion - -// /// <summary> -// /// 鐪熸鍙戦�佹暟鎹殑鍦版柟 -// /// </summary> -// /// <returns>The data.</returns> -// /// <param name="sendDatas">Send datas.</param> -// static async System.Threading.Tasks.Task<string> sendData (PacketInfo sendDatas) -// { -// var startDateTime = DateTime.Now; -// var haveSendCount = 0; -// SendAndReceiveDatas.IsACK = false; -// SendAndReceiveDatas.IsFinished = false; -// //鏈�澶氬彂閫�3娆� -// while (haveSendCount < 3 && !SendAndReceiveDatas.IsACK) { -// switch (haveSendCount) { -// case 0: -// startDateTime = DateTime.Now; -// haveSendCount++; -// //SendAndReceiveDatas.Send (sendDatas); -// break; -// case 1: -// if (500 <= (DateTime.Now - startDateTime).TotalMilliseconds) { -// haveSendCount++; -// //SendAndReceiveDatas.Send (sendDatas); -// } -// break; -// case 2: -// if (1000 <= (DateTime.Now - startDateTime).TotalMilliseconds) { -// haveSendCount++; -// //SendAndReceiveDatas.Send (sendDatas); -// } -// break; -// } - -// Thread.Sleep (10); -// } -// while (true) { -// System.Threading.Thread.Sleep (10); -// if (SendAndReceiveDatas.IsFinished) { -// System.Console.WriteLine ("鏁版嵁鎺ユ敹瀹屾瘯"); -// var tempData = System.Text.Encoding.UTF8.GetString (SendAndReceiveDatas.SplicePacket ()); -// return tempData; -// } -// if (3000 <= (DateTime.Now - startDateTime).TotalMilliseconds) { -// //瓒呮椂 -// System.Console.WriteLine ("鏁版嵁瓒呮椂"); -// return null; -// } -// } -// } -// } -//} \ No newline at end of file diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs new file mode 100755 index 0000000..056f16c --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs @@ -0,0 +1,262 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 鎴块棿缁勫悎鎴栬�呰澶囩粍鍚堢殑鑿滃崟鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟) + /// </summary> + public class RoomDeviceGroupMenuControl : FrameLayout + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鎴块棿閫夋嫨浜嬩欢 + /// </summary> + public Action<Common.Room> SelectRoomEvent = null; + /// <summary> + /// 璁惧閫夋嫨浜嬩欢 + /// </summary> + public Action<List<CommonDevice>> SelectDeviceEvent = null; + /// <summary> + /// 褰撳墠閫夋嫨鐨勪富閿� + /// </summary> + public string nowSelectKeys + { + get + { + if (dicDevice != null) + { + return oldSelectKeys.ToString(); + } + return dicRoom[oldSelectKeys].Id; + } + } + + /// <summary> + /// 褰撳墠閫夋嫨鐨勪富閿�(鍐呴儴浣跨敤) + /// </summary> + private int oldSelectKeys = -1; + /// <summary> + /// 鎴块棿瀵硅薄 + /// </summary> + private Dictionary<int, Common.Room> dicRoom = null; + /// <summary> + /// 璁惧瀵硅薄 + /// </summary> + private Dictionary<int, List<CommonDevice>> dicDevice = null; + /// <summary> + /// 鍓嶅洖閫夋嫨鐨勬帶浠� + /// </summary> + private FrameLayoutControl oldFrameBack = null; + /// <summary> + /// 鍓嶅洖閫夋嫨鐨勬帶浠� + /// </summary> + private NormalViewControl oldBtnText = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鎴块棿缁勫悎鐨勮彍鍗曟帶浠�(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟) + /// </summary> + /// <param name="i_listRoom">鎴块棿鍒楄〃</param> + public RoomDeviceGroupMenuControl(List<Common.Room> i_listRoom) + { + this.dicRoom = new Dictionary<int, Common.Room>(); + for (int i = 0; i < i_listRoom.Count; i++) + { + this.dicRoom[i] = i_listRoom[i]; + } + this.Height = Application.GetRealHeight(204); + } + + /// <summary> + /// 璁惧缁勫悎鐨勮彍鍗曟帶浠� + /// </summary> + /// <param name="i_dicDevice">璁惧鍒楄〃,keys:R鏂囦欢閲岄潰鐨勬暟瀛楃紪鍙�</param> + public RoomDeviceGroupMenuControl(Dictionary<int, List<CommonDevice>> i_dicDevice) + { + this.dicDevice = i_dicDevice; + this.Height = Application.GetRealHeight(204); + } + + /// <summary> + /// 鍒濆鍖栨帶浠�(浜嬩欢瑕佽嚦浜庡畠涔嬪墠) + /// </summary> + public void InitControl() + { + var scrolContr = new HorizontalScrolViewLayout(); + scrolContr.Gravity = Gravity.CenterVertical; + scrolContr.Height = this.Height; + this.AddChidren(scrolContr); + + //寮勪釜绌虹殑杩涘幓鍗犱綅缃� + var frameTemp = new FrameLayout(); + frameTemp.Height = this.Height; + frameTemp.Width = ControlCommonResourse.XXLeft / 2; + scrolContr.AddChidren(frameTemp); + + if (this.dicRoom != null) + { + //鍒濆鍖栨埧闂存ā寮忕殑鎺т欢 + foreach (int keys in dicRoom.Keys) + { + if (oldSelectKeys == -1) + { + //鍒濆鍊� + oldSelectKeys = keys; + } + this.DoInitControl(scrolContr, keys, dicRoom[keys].Name); + } + } + else + { + //鍒濆鍖栬澶囨ā寮忕殑鎺т欢 + foreach (int keys in dicDevice.Keys) + { + if (oldSelectKeys == -1) + { + //鍒濆鍊� + oldSelectKeys = keys; + } + this.DoInitControl(scrolContr, keys, Language.StringByID(keys)); + } + } + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="scrolContr">鍒楄〃鎺т欢</param> + /// <param name="keys">瀛楀吀鐨勪富閿�</param> + /// <param name="text">鏄剧ず鏂囨湰</param> + private void DoInitControl(HorizontalScrolViewLayout scrolContr, int keys, string text) + { + //甯﹀浘鐗囩殑 + var frameBack = new FrameLayoutControl(); + frameBack.UseClickStatu = false; + frameBack.Gravity = Gravity.Center; + frameBack.Height = Application.GetRealHeight(159); + frameBack.Width = Application.GetRealWidth(255); + if (oldSelectKeys == keys) + { + frameBack.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; + oldFrameBack = frameBack; + } + else + { + frameBack.BackgroundImagePath = "Item/RoomIconBackground.png"; + } + scrolContr.AddChidren(frameBack); + //鏂囧瓧 + var btnText = new NormalViewControl(frameBack.Width - (int)(frameBack.Height * 0.47), frameBack.Height, false); + btnText.Gravity = Gravity.CenterHorizontal; + btnText.Text = text; + btnText.TextSize = 12; + btnText.TextAlignment = TextAlignment.Center; + if (oldSelectKeys == keys) + { + btnText.TextColor = UserCenterColor.Current.White; + oldBtnText = btnText; + } + else + { + btnText.TextColor = UserCenterColor.Current.TextGrayColor1; + } + frameBack.AddChidren(btnText, ChidrenBindMode.BindEventOnly); + + frameBack.ButtonClickEvent += (sender, e) => + { + if (oldSelectKeys == keys) + { + //鍚屼竴涓笢瑗� + return; + } + oldSelectKeys = keys; + + //鐘舵�佸彉鏇� + frameBack.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; + btnText.TextColor = UserCenterColor.Current.White; + + oldFrameBack.BackgroundImagePath = "Item/RoomIconBackground.png"; + oldBtnText.TextColor = UserCenterColor.Current.TextGrayColor1; + oldFrameBack = frameBack; + oldBtnText = btnText; + //璋冪敤鍥炶皟鍑芥暟 + if (this.dicDevice != null) + { + this.SelectDeviceEvent?.Invoke(this.dicDevice[keys]); + } + else if (this.dicRoom != null) + { + this.SelectRoomEvent?.Invoke(this.dicRoom[keys]); + } + }; + + //璋冪敤鍥炶皟鍑芥暟 + if (oldSelectKeys == keys) + { + if (this.dicDevice != null) + { + this.SelectDeviceEvent?.Invoke(this.dicDevice[keys]); + } + else if (this.dicRoom != null) + { + this.SelectRoomEvent?.Invoke(this.dicRoom[keys]); + } + } + } + + #endregion + + #region 鈻� 鎺т欢鎽ф瘉___________________________ + + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + this.SelectDeviceEvent = null; + this.SelectRoomEvent = null; + + base.RemoveFromParent(); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 璁剧疆鍒濆閫夋嫨(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) + /// </summary> + /// <param name="keys">鎴块棿ID 鎴栬�� R鏂囦欢閲岄潰鐨勬暟鍊肩紪鍙�(杞负瀛楃涓茬被鍨�)</param> + public void SetDefultIndex(string keys) + { + if (dicRoom != null) + { + foreach (int index in dicRoom.Keys) + { + if (dicRoom[index].Id == keys) + { + oldSelectKeys = index; + break; + } + } + } + else if (keys != string.Empty) + { + int textId = Convert.ToInt32(keys); + if (dicDevice.ContainsKey(textId) == true) + { + oldSelectKeys = textId; + } + } + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs new file mode 100755 index 0000000..eba5ae8 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs @@ -0,0 +1,170 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 鍦烘櫙鍜屽姛鑳戒箣闂寸浉浜掑垏鎹㈢殑Tab鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟) + /// </summary> + public class SceneFunctionSwitchControl : FrameLayout + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 閫夋嫨浜嬩欢 1:鍦烘櫙 2:鍔熻兘 + /// </summary> + public Action<int> SelectTabEvent = null; + + private int m_nowSelectIndex = 1; + /// <summary> + /// 褰撳墠閫夋嫨鐨勫垎鏀� 1锛氬満鏅� 2锛氬姛鑳� + /// </summary> + public int nowSelectIndex + { + get { return m_nowSelectIndex; } + } + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍦烘櫙鍜屽姛鑳戒箣闂寸浉浜掑垏鎹㈢殑Tab鎺т欢(瀹屾垚鍒濆鍖栧悗,浼氭牴鎹粯璁ら�夋嫨璋冪敤鍥炶皟鍑芥暟) + /// </summary> + public SceneFunctionSwitchControl() + { + this.Height = Application.GetRealHeight(90); + } + + /// <summary> + /// 鍒濆鍖栨帶浠�(浜嬩欢瑕佽嚦浜庡畠涔嬪墠) + /// </summary> + public void InitControl() + { + var btnTemp = new NormalViewControl(10, 10, false); + btnTemp.TextID = R.MyInternationalizationString.uScence; + + //鍦烘櫙妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) + var frameScene = new FrameLayoutControl(); + frameScene.UseClickStatu = false; + frameScene.Height = Application.GetRealHeight(90); + frameScene.Width = btnTemp.GetRealWidthByText(16); + frameScene.X = ControlCommonResourse.XXLeft; + this.AddChidren(frameScene); + //鍦烘櫙 + var btnScene = new NormalViewControl(frameScene.Width, Application.GetRealHeight(63), false); + btnScene.Text = btnTemp.Text; + btnScene.TextSize = 16; + btnScene.TextColor = UserCenterColor.Current.TextColor2; + frameScene.AddChidren(btnScene, ChidrenBindMode.BindEventOnly); + //搴曠嚎 + var btnSceneLine = new NormalViewControl(40, 10, true); + btnSceneLine.Y = btnScene.Bottom + Application.GetRealHeight(14); + btnSceneLine.X = btnScene.X + btnScene.Width / 2 - Application.GetRealWidth(40) / 2; + btnSceneLine.Radius = (uint)Application.GetRealHeight(10) / 2; + btnSceneLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + frameScene.AddChidren(btnSceneLine, ChidrenBindMode.BindEventOnly); + + btnTemp.TextID = R.MyInternationalizationString.uFunction; + //鍔熻兘妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) + var frameFunc = new FrameLayoutControl(); + frameFunc.UseClickStatu = false; + frameFunc.Height = Application.GetRealHeight(90); + frameFunc.Width = btnTemp.GetRealWidthByText(16); + frameFunc.X = frameScene.Right + Application.GetRealWidth(58); + this.AddChidren(frameFunc); + //鍔熻兘 + var btnFunc = new NormalViewControl(frameFunc.Width, Application.GetRealHeight(63), false); + btnFunc.Text = btnTemp.Text; + btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3; + frameFunc.AddChidren(btnFunc, ChidrenBindMode.BindEventOnly); + //搴曠嚎 + var btnFuncLine = new NormalViewControl(40, 10, true); + btnFuncLine.Y = btnFunc.Bottom + Application.GetRealHeight(14); + btnFuncLine.X = btnFunc.X + btnFunc.Width / 2 - Application.GetRealWidth(40) / 2; + btnFuncLine.Radius = (uint)Application.GetRealHeight(10) / 2; + btnFuncLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; + frameFunc.AddChidren(btnFuncLine, ChidrenBindMode.BindEventOnly); + btnFuncLine.Visible = false; + + frameScene.ButtonClickEvent += (sender, e) => + { + //鍦烘櫙鍒嗘敮閫夋嫨 + if (this.m_nowSelectIndex == 1) + { + return; + } + this.m_nowSelectIndex = 1; + + btnScene.TextSize = 16; + btnScene.TextColor = UserCenterColor.Current.TextColor2; + btnFunc.TextSize = 14; + btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3; + btnSceneLine.Visible = true; + btnFuncLine.Visible = false; + + this.SelectTabEvent?.Invoke(1); + }; + + frameFunc.ButtonClickEvent += (sender, e) => + { + //鍔熻兘鍒嗘敮閫夋嫨 + if (this.m_nowSelectIndex == 2) + { + return; + } + this.m_nowSelectIndex = 2; + + btnScene.TextSize = 14; + btnScene.TextColor = UserCenterColor.Current.TextGrayColor3; + btnFunc.TextSize = 16; + btnFunc.TextColor = UserCenterColor.Current.TextColor2; + btnFuncLine.Visible = true; + btnSceneLine.Visible = false; + + this.SelectTabEvent?.Invoke(2); + }; + //鍥炶皟鏂规硶 + if (this.m_nowSelectIndex == 1) + { + this.m_nowSelectIndex = 0; + frameScene.ButtonClickEvent?.Invoke(null, null); + } + if (this.m_nowSelectIndex == 2) + { + this.m_nowSelectIndex = 0; + frameFunc.ButtonClickEvent?.Invoke(null, null); + } + } + + #endregion + + #region 鈻� 鎺т欢鎽ф瘉___________________________ + + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + this.SelectTabEvent = null; + + base.RemoveFromParent(); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 璁剧疆鍒濆閫夋嫨(璇峰湪鍒濆鍖栧畬鎴愪箣鍓嶈皟鐢�) + /// </summary> + /// <param name="index">1锛氬満鏅� 2锛氬姛鑳�</param> + public void SetDefultIndex(int index) + { + this.m_nowSelectIndex = index; + } + + #endregion + } +} diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/EditorCommonForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/EditorCommonForm.cs index 2bde57d..c9d5faf 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/EditorCommonForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/EditorCommonForm.cs @@ -247,22 +247,40 @@ /// <param name="imageHeight">鍥惧儚楂樺害(闈炵湡瀹炲��)</param> public void ShowNotDataImage(FrameLayout frameTable, string i_Text, string Imagepath = "Item/NoFunction.png", int imageWith = 683, int imageHeight = 392) { - //杩樻病鏈夌粦瀹氱綉鍏冲摝 + this.ShowNotDataImage(frameTable, new string[] { i_Text }, Imagepath, imageWith, imageHeight); + } + + /// <summary> + /// 鏄剧ず娌℃湁鏁版嵁鐨勫浘鍍忔樉绀虹壒鏁� + /// </summary> + /// <param name="frameTable">瀹瑰櫒</param> + /// <param name="listText">鏄剧ず鏂囧瓧</param> + /// <param name="Imagepath">鍥惧儚鍦板潃</param> + /// <param name="imageWith">鍥惧儚瀹藉害(闈炵湡瀹炲��)</param> + /// <param name="imageHeight">鍥惧儚楂樺害(闈炵湡瀹炲��)</param> + public void ShowNotDataImage(FrameLayout frameTable, string[] listText, string Imagepath = "Item/NoFunction.png", int imageWith = 683, int imageHeight = 392) + { var btnPic = new PicViewControl(imageWith, imageHeight); btnPic.UnSelectedImagePath = Imagepath; btnPic.Y = (int)(frameTable.Height * 0.382) - Application.GetRealHeight(imageHeight / 2); btnPic.Gravity = Gravity.CenterHorizontal; frameTable.AddChidren(btnPic); - var btnView = new NormalViewControl(frameTable.Width, Application.GetRealHeight(50), false); - btnView.Y = btnPic.Bottom + Application.GetRealHeight(32); - btnView.Text = i_Text; - btnView.TextAlignment = TextAlignment.Center; - btnView.TextSize = 12; - btnView.TextColor = UserCenterColor.Current.TextGrayColor1; - frameTable.AddChidren(btnView); - return; + int yy = btnPic.Bottom + Application.GetRealHeight(32); + for (int i = 0; i < listText.Length; i++) + { + var btnView = new NormalViewControl(frameTable.Width, Application.GetRealHeight(50), false); + btnView.Y = yy; + btnView.Text = listText[i]; + btnView.TextAlignment = TextAlignment.Center; + btnView.TextSize = 12; + btnView.TextColor = UserCenterColor.Current.TextGrayColor1; + frameTable.AddChidren(btnView); + + yy = btnView.Bottom; + } } + #endregion #region 鈻� 娓呯┖BodyFrame______________________ diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs index df93dac..12b2406 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlLogLogic.cs @@ -66,14 +66,21 @@ // return; //} //Log鏂囦欢 - string fileName = this.GetLogFile(div); - string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.LogDirectory, fileName); - - strLog = "[" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "] " + strLog + "\r\n"; - var sw = new System.IO.StreamWriter(fullName, true, Encoding.UTF8); - sw.WriteLine(strLog); - sw.Close(); - sw = null; + System.IO.StreamWriter sw = null; + try + { + string fileName = this.GetLogFile(div); + string fullName = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, DirNameResourse.LogDirectory, fileName); + strLog = "[" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "] " + strLog + "\r\n"; + sw = new System.IO.StreamWriter(fullName, true, Encoding.UTF8); + sw.WriteLine(strLog); + } + catch { } + finally + { + sw?.Close(); + sw = null; + } } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs index ef0bb03..66555a5 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlShardLogic.cs @@ -282,26 +282,33 @@ { //杩樺師璁惧瀵硅薄 tempRoom.DeviceUIList.Clear(); - foreach (string uiPath in tempRoom.DeviceUIFilePathList) + for (int i = 0; i < tempRoom.DeviceUIFilePathList.Count; i++) { - string deviceFile = uiPath.Replace("DeviceUI_", string.Empty); + string deviceFile = tempRoom.DeviceUIFilePathList[i]; //杩欎釜璁惧鏂囦欢鍖归厤寰楀埌鎴块棿 listDeviceFile.Remove(deviceFile); if (this.IsFileExists(deviceFile) == false) { + //绉婚櫎鎺夎繖涓笉瀵瑰姴鐨勮矾寰� + tempRoom.DeviceUIFilePathList.RemoveAt(i); + i--; continue; } - tempRoom.DeviceUIList.Add(Common.LocalDevice.Current.GetDeviceUI(uiPath)); + tempRoom.DeviceUIList.Add(Common.LocalDevice.Current.GetDeviceUI(deviceFile)); } //杩樺師鍦烘櫙瀵硅薄 tempRoom.SceneUIList.Clear(); - foreach (string uiPath in tempRoom.SceneUIFilePathList) + for (int i = 0; i < tempRoom.SceneUIFilePathList.Count; i++) { + string uiPath = tempRoom.SceneUIFilePathList[i]; //杩欎釜鍦烘櫙鏂囦欢鍖归厤寰楀埌鎴块棿 listSceneFile.Remove(uiPath); var byteData = this.GetShardFileContent(uiPath); if (byteData == null) { + //绉婚櫎鎺夎繖涓笉瀵瑰姴鐨勮矾寰� + tempRoom.SceneUIFilePathList.RemoveAt(i); + i--; continue; } string valueData = System.Text.Encoding.UTF8.GetString(byteData); @@ -813,7 +820,7 @@ this.AddShardFile(device.FilePath); //璁惧鐨刄I - var deviceUi = $"DeviceUI_{device.FilePath}"; + var deviceUi = device.FilePath; if (roomTemp.DeviceUIFilePathList.Contains(deviceUi) == false) { roomTemp.DeviceUIFilePathList.Add(deviceUi); @@ -1229,7 +1236,7 @@ string deviceFileName = device.FilePath; //绉婚櫎璺緞鍒楄〃 - roomTemp.DeviceUIFilePathList.Remove($"DeviceUI_{device.FilePath}"); + roomTemp.DeviceUIFilePathList.Remove(device.FilePath); if (listHadShard.Contains(deviceFileName) == true) { //鍏朵粬鍦烘櫙鍒嗕韩鏈夎繖涓澶�,鎵�浠ヤ笉鍒犻櫎杩欎釜璁惧鐨勬牴婧愭枃浠�,鍙槸鎶婃埧闂寸殑璁惧鍒楄〃璺緞绉婚櫎 @@ -1564,7 +1571,7 @@ //璁惧 foreach (var deviceUi in roomTemp.DeviceUIFilePathList) { - string deviceFile = deviceUi.Replace("DeviceUI_", string.Empty); + string deviceFile = deviceUi; if (listDeleteFile.Contains(deviceFile) == true) { //鍥犱负涓�涓洖璺彧鑳藉垎閰嶄竴涓尯鍩�,鎵�浠ュ彲浠ョ洿鎺ュ垽鏂� diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index 07c4654..6ac2ad1 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs @@ -572,11 +572,6 @@ //涓嶈兘鍒犻櫎Config鏂囦欢 return true; } - else if (fileName.StartsWith("DeviceUI_") == true) - { - //涓嶈兘鍒犻櫎璁惧UI鏂囦欢 - return true; - } else if (fileName.StartsWith("House_") == true) { //涓嶈兘鍒犻櫎浣忓畢鏂囦欢 @@ -839,6 +834,9 @@ //鍚屾浜戠鐨勭綉鍏砳d锛屽鏋滄湰鍦版嫢鏈変簯绔笉瀛樺湪鐨刬d锛屽垯琛ㄧず搴旇琚崲缁戜簡锛岀洿鎺ュ垹闄� HdlGatewayLogic.Current.SynchronizeDbGateway(); + //鍒濆鍖栦綇瀹呭璞� + Common.Config.Instance.Home = House.GetHouseByHouseId(Common.Config.Instance.HomeId); + //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�) Room.RefreshAllRoomByLocation(); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs index 2c63cd3..ad4b485 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs @@ -123,10 +123,11 @@ btnRoom.Text = Common.Room.CurrentRoom.GetRoomNameByDevice(device); frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEventOnly); //鎽勬皬搴� - var btnValue = new NormalViewControl(150, 60, true); + var btnValue = new NormalViewControl(300, 60, true); btnValue.Y = Application.GetRealHeight(58); - btnValue.X = frameTable.Width - Application.GetRealWidth(150 + 58); + btnValue.X = frameTable.Width - Application.GetRealWidth(300 + 58); btnValue.TextAlignment = TextAlignment.CenterRight; + btnValue.TextID = R.MyInternationalizationString.uGetting; frameTable.AddChidren(btnValue, ChidrenBindMode.BindEventOnly); rowInfo.btnValue = btnValue; //璀﹀憡鍥炬爣 @@ -215,6 +216,8 @@ ((AC)listDevice[i]).ReadLocalTemperature(); //鑾峰彇寮�鍏崇姸鎬�(澶勪簬鏌愮宸ヤ綔鐘舵��,鍗充负鎵撳紑鐘舵��) ((AC)listDevice[i]).ReadSystemMode(); + //娓呮礂婊ょ綉 + listDevice[i].ReadAttri(Cluster_ID.Thermostat, AttriButeId.FilterCleaningStatus); } }); } @@ -275,6 +278,16 @@ rowInfo.btnIconBack.BackgroundColor = 0xfffef1ed; } } + else if (data.AttributeId == 4097) + { + //42:闇�瑕佹竻娲楁护缃� + if (data.AttriButeData == 42) + { + rowInfo.btnWarningIcon.Visible = true; + //璇锋敞鎰忔竻娲楁护缃戝摝 + rowInfo.btnWarningMsg.TextID = R.MyInternationalizationString.uPleaseClreanACfilter; + } + } } }); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs index 202f732..137ab61 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitSettionForm.cs @@ -129,18 +129,6 @@ form.AddForm(deviceAc); }; - //鎽嗛 - var rowSwing = new FrameRowControl(listview.rowSpace / 2); - rowSwing.UseClickStatu = false; - listview.AddChidren(rowSwing); - rowSwing.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uAirConditionerSwing), 600); - rowSwing.AddBottomLine(); - var btnSwicth = rowSwing.AddMostRightSwitchIcon(); - btnSwicth.ButtonClickEvent += (sender, e) => - { - btnSwicth.IsSelected = !btnSwicth.IsSelected; - }; - //鍒濆鍖栨甯冨畬鎴� tableContr.FinishInitControl(bodyFrameLayout, this.listview); tableContr = null; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorTargetSelectForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorTargetSelectForm.cs index 3f560b3..46cdbef 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorTargetSelectForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/PirSensor/PirSensorTargetSelectForm.cs @@ -99,20 +99,7 @@ else { //娌℃湁鍙互娣诲姞鐨勭洰鏍� - var btnPic = new PicViewControl(683, 392); - btnPic.UnSelectedImagePath = "Item/NoFunction.png"; - btnPic.Y = (int)(bodyFrameLayout.Height * 0.382) - Application.GetRealHeight(392 / 2); - btnPic.Gravity = Gravity.CenterHorizontal; - bodyFrameLayout.AddChidren(btnPic); - - var btnView = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); - btnView.Y = btnPic.Bottom + Application.GetRealHeight(32); - btnView.TextID = R.MyInternationalizationString.uNotHadAddTarget; - btnView.TextAlignment = TextAlignment.Center; - btnView.TextSize = 12; - btnView.TextColor = UserCenterColor.Current.TextGrayColor1; - bodyFrameLayout.AddChidren(btnView); - return; + this.ShowNotDataImage(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uNotHadAddTarget)); } }); } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs index 1b9661e..311d28a 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/MasterManagementPage.cs @@ -129,11 +129,30 @@ unLockMethod.Show(); } else - { - var userDoorLockPage = new UserDoorLockPage(doorLock, accountObj); - Shared.Phone.UserView.HomePage.Instance.AddChidren(userDoorLockPage); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - userDoorLockPage.Show(); + { + ///璁板綍褰撳墠鐢ㄦ埛淇℃伅 --娓╁眳鍩� + Phone.Device.Logic.DoorLockLogic.LockIfon.UserMemberInfoRes = accountObj; + Phone.Device.Logic.DoorLockLogic.LockIfon.DoorLock = doorLock; + if (accountObj == null) + { + ///闃叉鎶涘紓甯� + Phone.Device.Logic.DoorLockLogic.LockIfon.UserMemberInfoRes = new MemberInfoRes(); + } + if (doorLock == null) + { + ///闃叉鎶涘紓甯� + Phone.Device.Logic.DoorLockLogic.LockIfon.DoorLock = new ZigBee.Device.DoorLock(); + } + ///杩涙潵鍒锋柊涓�娆¤澶囧垪琛紱 + Common.Logic.LogicDviceList.Clear(); + if (Common.Logic.LogicDviceList.Count == 0) + { + Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray()); + } + var doorLockLogicList = new Phone.Device.Logic.DoorLockLogic.LockLogicList(); + UserView.HomePage.Instance.AddChidren(doorLockLogicList); + UserView.HomePage.Instance.PageIndex += 1; + doorLockLogicList.Show(); } }; btnRight.MouseUpEventHandler += eHandler; diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs index 5749ce1..03a1c54 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedContentForm.cs @@ -13,341 +13,6 @@ { #region 鈻� 鍙橀噺澹版槑___________________________ - ///// <summary> - ///// 璁惧鍒楄〃鎺т欢 - ///// </summary> - //private VerticalScrolViewLayout listDeviceView = null; - ///// <summary> - ///// 鍦烘櫙鍒楄〃鎺т欢 - ///// </summary> - //private VerticalScrolViewLayout listSceneView = null; - ///// <summary> - ///// 鎴愬憳淇℃伅 - ///// </summary> - //private MemberInfoRes memberResult = null; - - ///// <summary> - ///// 鎴块棿瀵硅薄 - ///// </summary> - //private Common.Room room = null; - ///// <summary> - ///// Tab鐨勯�夋嫨銆�1锛氬姛鑳絋ab 2锛氬満鏅疶ab - ///// </summary> - //private int TabSelectIndex = 1; - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - ///// <summary> - ///// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - ///// </summary> - ///// <param name="i_room">鎴块棿瀵硅薄</param> - ///// <param name="i_memberResult">鎴愬憳淇℃伅</param> - ///// <param name="i_memberShardInfo">鎴愬憳鐨勫垎浜暟鎹�</param> - //public void ShowForm(Common.Room i_room, MemberInfoRes i_memberResult, MemberShardInfoData i_memberShardInfo) - //{ - // this.memberResult = i_memberResult; - // this.memberShardInfo = i_memberShardInfo; - // this.room = i_room; - - // //璁剧疆澶撮儴淇℃伅 - // base.SetTitleText(this.room.Name); - - // //鍒嗕韩 - // //var btnShard = new TopLayoutFinshView(); - // //btnShard.TextID = R.MyInternationalizationString.uShared; - // //topFrameLayout.AddChidren(btnShard); - // //btnShard.MouseUpEventHandler += (sender, e) => - // //{ - // // HdlThreadLogic.Current.Run(() => - // // { - // // //纭鍒嗕韩 - // // this.DoSaveSharedContent(); - // // }); - // //}; - - // ////鍒濆鍖栦腑閮ㄤ俊鎭� - // //this.InitMiddleFrame(); - //} - - ///// <summary> - ///// 鍒濆鍖栦腑閮ㄤ俊鎭� - ///// </summary> - //private void InitMiddleFrame() - //{ - // //娓呯┖bodyFrame - // this.ClearBodyFrame(); - - // //鍒濆鍖朤ab鎺т欢 - // var frame = this.InitTabControl(); - - // this.listDeviceView = new VerticalScrolViewLayout(); - // listDeviceView.Y = frame.Bottom; - // listDeviceView.Height = bodyFrameLayout.Height - frame.Bottom; - // listDeviceView.Visible = this.TabSelectIndex == 1; - // bodyFrameLayout.AddChidren(listDeviceView); - - // this.listSceneView = new VerticalScrolViewLayout(); - // listSceneView.Y = frame.Bottom; - // listSceneView.Height = bodyFrameLayout.Height - frame.Bottom; - // listSceneView.Visible = this.TabSelectIndex == 2; - // bodyFrameLayout.AddChidren(listSceneView); - - // HdlThreadLogic.Current.Run(() => - // { - // //鍒濆鍖栧姛鑳絋ab鍒楄〃 - // this.InitFunctionTabList(); - // //鍒濆鍖栧満鏅疶ab鍒楄〃 - // this.InitSceneTabList(); - // }); - //} - - #endregion - - //#region 鈻� 鍒濆鍖朤ab鎺т欢______________________ - - ///// <summary> - ///// 鍒濆鍖朤ab鎺т欢 - ///// </summary> - ///// <returns></returns> - //private FrameLayout InitTabControl() - //{ - // //Tab鍒囨崲鎺т欢 - // var frameSwich = new FrameLayout(); - // frameSwich.Height = Application.GetRealHeight(150); - // frameSwich.BackgroundColor = UserCenterColor.Current.TopFrameLayout; - // bodyFrameLayout.AddChidren(frameSwich); - - // //鍔熻兘 - // var btnFunction = new NormalViewControl(frameSwich.Width / 2, Application.GetRealHeight(100)); - // btnFunction.Gravity = Gravity.CenterVertical; - // btnFunction.TextID = R.MyInternationalizationString.uFunction; - // btnFunction.TextAlignment = TextAlignment.Center; - // btnFunction.TextColor = UserCenterColor.Current.SelectTextColor; - // btnFunction.TextAlignment = TextAlignment.Center; - // frameSwich.AddChidren(btnFunction); - - // //鍦烘櫙 - // var btnScene = new NormalViewControl(frameSwich.Width / 2, Application.GetRealHeight(100)); - // btnScene.Gravity = Gravity.CenterVertical; - // btnScene.X = frameSwich.Width / 2; - // btnScene.TextID = R.MyInternationalizationString.uScence; - // btnScene.TextAlignment = TextAlignment.Center; - // frameSwich.AddChidren(btnScene); - - // //绾� - // var btnLine = new ProgressLine(); - // btnLine.Gravity = Gravity.BottomLeft; - // frameSwich.AddChidren(btnLine); - // btnLine.SetValue(50, true); - - // if (this.TabSelectIndex == 2) - // { - // btnScene.TextColor = UserCenterColor.Current.SelectTextColor; - // btnFunction.TextColor = Common.ZigbeeColor.Current.TextColor; - // btnLine.SetValue(50, false); - // } - - // //鍔熻兘Tab - // btnFunction.MouseUpEventHandler += (sender, e) => - // { - // if (this.TabSelectIndex == 1) - // { - // return; - // } - // btnScene.TextColor = Common.ZigbeeColor.Current.TextColor; - // btnFunction.TextColor = UserCenterColor.Current.SelectTextColor; - // btnLine.SetValue(50); - // this.TabSelectIndex = 1; - - // //闅愯棌鍦烘櫙鍒楄〃鎺т欢,鏄剧ず璁惧鍒楄〃鎺т欢 - // this.listSceneView.Visible = false; - // this.listDeviceView.Visible = true; - // }; - - // //鍦烘櫙Tab - // btnScene.MouseUpEventHandler += (sender, e) => - // { - // if (this.TabSelectIndex == 2) - // { - // return; - // } - // btnScene.TextColor = UserCenterColor.Current.SelectTextColor; - // btnFunction.TextColor = Common.ZigbeeColor.Current.TextColor; - // btnLine.SetValue(50, false); - // this.TabSelectIndex = 2; - - // //闅愯棌璁惧鍒楄〃鎺т欢,鏄剧ず鍦烘櫙鍒楄〃鎺т欢 - // this.listDeviceView.Visible = false; - // this.listSceneView.Visible = true; - // }; - - // return frameSwich; - //} - - //#endregion - - //#region 鈻� 鏄剧ず鍔熻兘Tab鍒楄〃____________________ - - ///// <summary> - ///// 鍒濆鍖栧姛鑳絋ab鍒楄〃 - ///// </summary> - //private void InitFunctionTabList() - //{ - // if (memberShardInfo.dicAllMemberShard.ContainsKey(this.room.FileName) == false) - // { - // memberShardInfo.dicAllMemberShard[this.room.FileName] = new HashSet<string>(); - // } - // var listCheck = memberShardInfo.dicAllMemberShard[this.room.FileName]; - - // foreach (var deviceUi in this.room.DeviceUIList) - // { - // var device = deviceUi.CommonDevice; - // if (device == null || listCheck.Contains(device.FilePath) == true) - // { - // //寮傚父锛屾垨鑰呭凡缁忓垎浜簡鐨勶紝涓嶅啀鏄剧ず - // continue; - // } - // Application.RunOnMainThread(() => - // { - // if (this.listDeviceView != null) - // { - // //娣诲姞璁惧琛� - // var deviceRow = new DeviceSelectControl(device); - // this.listDeviceView.AddChidren(deviceRow); - // deviceRow.InitControl(); - // //涓嶉渶瑕佹埧闂存帶浠� - // deviceRow.RemoveRoomControl(); - // } - // }); - // } - //} - - //#endregion - - //#region 鈻� 鏄剧ず鍦烘櫙Tab鍒楄〃____________________ - - ///// <summary> - ///// 鍒濆鍖栧満鏅疶ab鍒楄〃 - ///// </summary> - //private void InitSceneTabList() - //{ - // if (memberShardInfo.dicAllMemberShard.ContainsKey(this.room.FileName) == false) - // { - // memberShardInfo.dicAllMemberShard[this.room.FileName] = new HashSet<string>(); - // } - // var listCheck = memberShardInfo.dicAllMemberShard[this.room.FileName]; - - // foreach (var sceneUi in this.room.SceneUIList) - // { - // if (sceneUi == null || listCheck.Contains(sceneUi.FileName) == true) - // { - // //寮傚父锛屾垨鑰呭凡缁忓垎浜簡鐨勶紝涓嶅啀鏄剧ず - // continue; - // } - // Application.RunOnMainThread(() => - // { - // if (this.listSceneView != null) - // { - // //娣诲姞鍦烘櫙琛� - // var sceneRow = new SceneSelectRow(this.listSceneView, sceneUi); - // } - // }); - // } - //} - - //#endregion - - //#region 鈻� 鑾峰彇閫夋嫨鐨勮澶嘷____________________ - - ///// <summary> - ///// 鑾峰彇閫夋嫨鐨勮澶� - ///// </summary> - ///// <param name="listCheck">閲嶅妫�娴�</param> - ///// <returns></returns> - //private List<CommonDevice> GetSelectedDevice(HashSet<string> listCheck) - //{ - // var listDevice = new List<CommonDevice>(); - // for (int i = 0; i < listDeviceView.ChildrenCount; i++) - // { - // var myView = listDeviceView.GetChildren(i); - // var selectRow = (DeviceSelectControl)myView; - // if (selectRow.IsSelected == true && listCheck.Contains(selectRow.device.FilePath) == false) - // { - // listCheck.Add(selectRow.device.FilePath); - // listDevice.Add(selectRow.device); - // } - // } - // return listDevice; - //} - - //#endregion - - //#region 鈻� 鑾峰彇閫夋嫨鐨勫満鏅痏____________________ - - ///// <summary> - ///// 鑾峰彇閫夋嫨鐨勫満鏅� - ///// </summary> - ///// <param name="listCheck">閲嶅妫�娴�</param> - ///// <returns></returns> - //private List<Common.SceneUI> GetSelectedSceneUI(HashSet<string> listCheck) - //{ - // var listSceneUI = new List<Common.SceneUI>(); - // for (int i = 0; i < listSceneView.ChildrenCount; i++) - // { - // var myView = listSceneView.GetChildren(i); - // var selectRow = (SceneSelectRow)myView; - // if (selectRow.IsSelected == true && listCheck.Contains(selectRow.sceneUI.Id.ToString()) == false) - // { - // listCheck.Add(selectRow.sceneUI.Id.ToString()); - // listSceneUI.Add(selectRow.sceneUI); - // } - // } - // return listSceneUI; - //} - - //#endregion - - //#region 鈻� 纭鍒嗕韩___________________________ - - ///// <summary> - ///// 纭鍒嗕韩 - ///// </summary> - //private async void DoSaveSharedContent() - //{ - // var listCheck = new HashSet<string>(); - // //閫夋嫨鐨勮澶� - // var listSelectDevice = this.GetSelectedDevice(listCheck); - // //閫夋嫨鐨勫満鏅� - // var listSelectScene = this.GetSelectedSceneUI(listCheck); - // if (listSelectDevice.Count == 0 && listSelectScene.Count == 0) - // { - // //璇烽�夋嫨鐩爣鍚庡啀鎵ц鍒嗕韩鎿嶄綔 - // string msg = Language.StringByID(R.MyInternationalizationString.uNotSelectDeviceBeforeSave); - // this.ShowErrorMsg(msg); - // return; - // } - // //鎵ц涓婁紶鍒嗕韩鍐呭 - // var result = await HdlShardLogic.Current.DoUploadSharedContent(memberShardInfo, this.room, listSelectDevice, listSelectScene); - // if (result == true) - // { - // Application.RunOnMainThread(() => - // { - // //閲嶆柊鍒锋柊鐣岄潰 - // this.InitMiddleFrame(); - // //鍒嗕韩鎴愬姛 - // string msg = Language.StringByID(R.MyInternationalizationString.uShardSuccess); - // this.ShowMassage(msg); - // }); - // } - //} - - //#endregion - - - #region 鈻� 鍙橀噺澹版槑___________________________ - /// <summary> /// 鏌ョ湅鐨勬埧闂村璞� /// </summary> @@ -356,10 +21,6 @@ /// 鎴愬憳鐨勫垎浜暟鎹� /// </summary> private MemberShardInfoData memberShardInfo = null; - /// <summary> - /// 褰撳墠閫夋嫨鐨勫垎鏀紝1锛氬満鏅� 2锛氬姛鑳� - /// </summary> - private int nowSelectIndex = 1; /// <summary> /// 璁惧妗屽竷鎺т欢 /// </summary> @@ -372,6 +33,22 @@ /// 鍔熻兘鎸夐挳 /// </summary> private BottomClickButton btnShard = null; + /// <summary> + /// 閫夋嫨鐨勫満鏅� + /// </summary> + private Dictionary<int, Common.SceneUI> dicSelectScene = new Dictionary<int, Common.SceneUI>(); + /// <summary> + /// 閫夋嫨鐨勮澶� + /// </summary> + private Dictionary<string, CommonDevice> dicSelectDevice = new Dictionary<string, CommonDevice>(); + /// <summary> + /// 褰撳墠閫夋嫨鐨勫垎鏀� 1锛氬満鏅� 2锛氬姛鑳� + /// </summary> + private int nowSwitchIndex = 1; + /// <summary> + /// 褰撳墠閫夋嫨鐨勮澶囩储寮� + /// </summary> + private string nowDeviceIndex = string.Empty; #endregion @@ -400,9 +77,8 @@ { //娓呯┖bodyFrame this.ClearBodyFrame(); - - //鍒濆鍖栧垎鏀帶浠� - this.InitSwitchControl(); + this.dicSelectDevice = new Dictionary<string, CommonDevice>(); + this.dicSelectScene = new Dictionary<int, Common.SceneUI>(); //鍒濆鍖栨甯冩帶浠� this.frameSceneTable = new FrameLayout(); @@ -416,6 +92,9 @@ bodyFrameLayout.AddChidren(frameDeviceTable); frameDeviceTable.Visible = false; + //鍒濆鍖栧垎鏀帶浠� + this.InitSwitchControl(); + //鎴块棿 var btnRoom = new NormalViewControl(400, 63, true); btnRoom.Y = Application.GetRealHeight(40); @@ -424,12 +103,15 @@ btnRoom.TextAlignment = TextAlignment.CenterRight; bodyFrameLayout.AddChidren(btnRoom); + //鍒嗕韩鎸夐挳 this.btnShard = new BottomClickButton(); btnShard.TextID = R.MyInternationalizationString.uShared2; bodyFrameLayout.AddChidren(btnShard); btnShard.Visible = false; btnShard.ButtonClickEvent += (sender, e) => { + //淇濆瓨鍒嗕韩 + this.SaveShardData(); }; //鍒濆鍖栧満鏅垪琛� @@ -443,95 +125,28 @@ /// </summary> private void InitSwitchControl() { - var btnTemp = new NormalViewControl(10, 10, false); - btnTemp.TextID = R.MyInternationalizationString.uScence; - - //鍦烘櫙妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) - var frameScene = new FrameLayoutControl(); - frameScene.UseClickStatu = false; - frameScene.Height = Application.GetRealHeight(90); - frameScene.Width = btnTemp.GetRealWidthByText(16); - frameScene.X = ControlCommonResourse.XXLeft; - frameScene.Y = Application.GetRealHeight(40); - bodyFrameLayout.AddChidren(frameScene); - //鍦烘櫙 - var btnScene = new NormalViewControl(frameScene.Width, Application.GetRealHeight(63), false); - btnScene.Text = btnTemp.Text; - btnScene.TextSize = 16; - btnScene.TextColor = UserCenterColor.Current.TextColor2; - frameScene.AddChidren(btnScene, ChidrenBindMode.BindEventOnly); - //搴曠嚎 - var btnSceneLine = new NormalViewControl(40, 10, true); - btnSceneLine.Y = btnScene.Bottom + Application.GetRealHeight(14); - btnSceneLine.X = btnScene.X + btnScene.Width / 2 - Application.GetRealWidth(40) / 2; - btnSceneLine.Radius = (uint)Application.GetRealHeight(10) / 2; - btnSceneLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; - frameScene.AddChidren(btnSceneLine, ChidrenBindMode.BindEventOnly); - - btnTemp.TextID = R.MyInternationalizationString.uFunction; - //鍔熻兘妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) - var frameFunc = new FrameLayoutControl(); - frameFunc.UseClickStatu = false; - frameFunc.Height = Application.GetRealHeight(90); - frameFunc.Width = btnTemp.GetRealWidthByText(16); - frameFunc.X = frameScene.Right + Application.GetRealWidth(58); - frameFunc.Y = Application.GetRealHeight(40); - bodyFrameLayout.AddChidren(frameFunc); - //鍔熻兘 - var btnFunc = new NormalViewControl(frameFunc.Width, Application.GetRealHeight(63), false); - btnFunc.Text = btnTemp.Text; - btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3; - frameFunc.AddChidren(btnFunc, ChidrenBindMode.BindEventOnly); - //搴曠嚎 - var btnFuncLine = new NormalViewControl(40, 10, true); - btnFuncLine.Y = btnFunc.Bottom + Application.GetRealHeight(14); - btnFuncLine.X = btnFunc.X + btnFunc.Width / 2 - Application.GetRealWidth(40) / 2; - btnFuncLine.Radius = (uint)Application.GetRealHeight(10) / 2; - btnFuncLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; - frameFunc.AddChidren(btnFuncLine, ChidrenBindMode.BindEventOnly); - btnFuncLine.Visible = false; - - frameScene.ButtonClickEvent += (sender, e) => + var tabControl = new SceneFunctionSwitchControl(); + tabControl.Y = Application.GetRealHeight(40); + bodyFrameLayout.AddChidren(tabControl); + //璁剧疆鍒濆鍖栧�� + tabControl.SetDefultIndex(nowSwitchIndex); + tabControl.SelectTabEvent += (tabIndex) => { - //鍦烘櫙鍒嗘敮閫夋嫨 - if (this.nowSelectIndex == 1) + this.nowSwitchIndex = tabIndex; + if (tabIndex == 1) { - return; + //鏄剧ず鍦烘櫙鍒楄〃 + this.frameSceneTable.Visible = true; + this.frameDeviceTable.Visible = false; } - this.nowSelectIndex = 1; - - btnScene.TextSize = 16; - btnScene.TextColor = UserCenterColor.Current.TextColor2; - btnFunc.TextSize = 14; - btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3; - btnSceneLine.Visible = true; - btnFuncLine.Visible = false; - - //鏄剧ず鍦烘櫙鍒楄〃 - this.frameSceneTable.Visible = true; - this.frameDeviceTable.Visible = false; - }; - - frameFunc.ButtonClickEvent += (sender, e) => - { - //鍔熻兘鍒嗘敮閫夋嫨 - if (this.nowSelectIndex == 2) + else { - return; + //鏄剧ず鍔熻兘鍒楄〃 + this.frameSceneTable.Visible = false; + this.frameDeviceTable.Visible = true; } - this.nowSelectIndex = 2; - - btnScene.TextSize = 14; - btnScene.TextColor = UserCenterColor.Current.TextGrayColor3; - btnFunc.TextSize = 16; - btnFunc.TextColor = UserCenterColor.Current.TextColor2; - btnFuncLine.Visible = true; - btnSceneLine.Visible = false; - - //鏄剧ず鍔熻兘鍒楄〃 - this.frameSceneTable.Visible = false; - this.frameDeviceTable.Visible = true; }; + tabControl.InitControl(); } #endregion @@ -546,14 +161,39 @@ //娓呯┖妗屽竷 this.frameSceneTable.RemoveAll(); - var listView = new VerticalFrameControl(29); - listView.Y = Application.GetRealHeight(53); - listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(187); - frameSceneTable.AddChidren(listView); + //鍦烘櫙鏈夌偣鐗规畩,濡傛灉鍚屼竴涓埧闂村唴,宸茬粡鍒嗕韩浜�,鍒欎笉鍐嶆樉绀� + //濡傛灉杩欎釜鍦烘櫙鏄敱宓屽鑰屽垎浜殑,杩欎釜鏃跺��,瀹冨彲浠ユ樉绀哄嚭鏉� + var listScene = new List<Common.SceneUI>(); + if (memberShardInfo.dicShardRoom.ContainsKey(lookRoom.FileName) == false) + { + listScene.AddRange(lookRoom.SceneUIList); + } + else + { + var tempRoom = memberShardInfo.dicShardRoom[lookRoom.FileName]; + foreach (var data in lookRoom.SceneUIList) + { + if (tempRoom.SceneUIFilePathList.Contains(data.FileName) == false) + { + listScene.Add(data); + } + } + } + if (listScene.Count == 0) + { + //鏃犲彲鍏变韩鐨勫満鏅� + this.ShowNotDataImage(frameSceneTable, Language.StringByID(R.MyInternationalizationString.uNotCanShardSceneMsg), "Item/NotShardPic.png", 383, 279); + return; + } HdlThreadLogic.Current.RunMainInThread(() => { - foreach (var data in lookRoom.SceneUIList) + var listView = new VerticalFrameControl(29); + listView.Y = Application.GetRealHeight(53); + listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(187); + frameSceneTable.AddChidren(listView); + + foreach (var data in listScene) { //鍦烘櫙鍥剧墖 var frameContr = new FrameLayoutControl(); @@ -570,9 +210,30 @@ btnSelect.X = Application.GetRealWidth(786); btnSelect.Y = Application.GetRealHeight(35); frameContr.AddChidren(btnSelect, ChidrenBindMode.BindEventOnly); + if (dicSelectScene.ContainsKey(data.Id) == true) + { + btnSelect.IsSelected = true; + } frameContr.ButtonClickEvent += (sender, e) => { + //閫夋嫨 btnSelect.IsSelected = !btnSelect.IsSelected; + if (btnSelect.IsSelected == true) + { + dicSelectScene[data.Id] = data; + if (this.btnShard.Visible == false) + { + this.btnShard.Visible = true; + } + } + else + { + dicSelectScene.Remove(data.Id); + if (dicSelectScene.Count == 0 && dicSelectDevice.Count == 0) + { + this.btnShard.Visible = false; + } + } }; } }); @@ -590,26 +251,33 @@ //娓呯┖妗屽竷 this.frameDeviceTable.RemoveAll(); - var frameBack = new FrameLayoutControl(false); - frameBack.X = ControlCommonResourse.XXLeft; - frameBack.Y = Application.GetRealHeight(178); - frameBack.BackgroundColor = UserCenterColor.Current.White; - frameBack.Width = bodyFrameLayout.Width; - frameBack.Height = Application.GetRealHeight(1650); - frameBack.RadiusEx = 20; - frameDeviceTable.AddChidren(frameBack); - - var listView = new VerticalListControl(23); - listView.Y = Application.GetRealHeight(23); - listView.Height = Application.GetRealHeight(1437 - 23); - frameBack.AddChidren(listView); - HdlThreadLogic.Current.RunMainInThread(() => { //鑾峰彇鍒嗙粍鍚庣殑璁惧鍒楄〃 var dicGroupDevice = this.GetAllGroupDevice(); - //鍒濆鍖栬澶囩被鍨嬭 - this.InitDeviceObjectRow(dicGroupDevice, listView); + if (dicGroupDevice.Count == 0) + { + //鏃犲彲鍏变韩鐨勮澶� + this.ShowNotDataImage(frameDeviceTable, Language.StringByID(R.MyInternationalizationString.uNotCanShardDeviceMsg), "Item/NotShardPic.png", 383, 279); + } + else + { + var frameBack = new FrameLayoutControl(false); + frameBack.X = ControlCommonResourse.XXLeft; + frameBack.Y = Application.GetRealHeight(178); + frameBack.BackgroundColor = UserCenterColor.Current.White; + frameBack.Width = bodyFrameLayout.Width; + frameBack.Height = Application.GetRealHeight(1650); + frameBack.RadiusEx = 20; + frameDeviceTable.AddChidren(frameBack); + + var listView = new VerticalListControl(23); + listView.Y = Application.GetRealHeight(23); + listView.Height = Application.GetRealHeight(1437 - 23); + frameBack.AddChidren(listView); + //鍒濆鍖栬澶囩被鍨嬭 + this.InitDeviceObjectRow(dicGroupDevice, listView); + } }); } @@ -624,82 +292,17 @@ /// <param name="listView"></param> private void InitDeviceObjectRow(Dictionary<int, List<CommonDevice>> dicData, VerticalListControl listView) { - var scrolContr = new HorizontalScrolViewLayout(); - scrolContr.X = ControlCommonResourse.XXLeft / 2; - scrolContr.Width = bodyFrameLayout.Width - ControlCommonResourse.XXLeft / 2; - scrolContr.Height = Application.GetRealHeight(160); + var scrolContr = new RoomDeviceGroupMenuControl(dicData); this.frameDeviceTable.AddChidren(scrolContr); - - int oldTextId = 0; - FrameLayout oldFrameBack = null; - NormalViewControl oldBtnText = null; - - foreach (int textId in dicData.Keys) + //璁剧疆鍒濆鍊� + scrolContr.SetDefultIndex(nowDeviceIndex); + scrolContr.SelectDeviceEvent += (listdevice) => { - var frameMain = new FrameLayout(); - frameMain.Height = scrolContr.Height; - frameMain.Width = Application.GetRealWidth(250) + ControlCommonResourse.XXLeft; - scrolContr.AddChidren(frameMain); - var frameBack = new FrameLayoutControl(); - frameBack.UseClickStatu = false; - frameBack.Gravity = Gravity.CenterHorizontal; - frameBack.Height = frameMain.Height; - frameBack.Width = Application.GetRealWidth(187); - if (scrolContr.ChildrenCount == 1) - { - oldTextId = textId; - frameBack.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; - oldFrameBack = frameBack; - } - else - { - frameBack.BackgroundImagePath = "Item/RoomIconBackground.png"; - } - frameMain.AddChidren(frameBack); - var btnText = new NormalViewControl(frameBack.Width - frameBack.Height, frameBack.Height, false); - btnText.Gravity = Gravity.CenterHorizontal; - btnText.TextID = textId; - btnText.TextSize = 12; - btnText.TextAlignment = TextAlignment.Center; - if (scrolContr.ChildrenCount == 1) - { - btnText.TextColor = UserCenterColor.Current.White; - oldBtnText = btnText; - } - else - { - btnText.TextColor = UserCenterColor.Current.TextGrayColor1; - } - frameBack.AddChidren(btnText, ChidrenBindMode.BindEventOnly); - - frameBack.ButtonClickEvent += (sender, e) => - { - if (oldTextId == textId) - { - //鍚屼竴涓笢瑗� - return; - } - oldTextId = textId; - - //鐘舵�佸彉鏇� - frameBack.BackgroundImagePath = "Room/RoomIconBackgroundSelected.png"; - btnText.TextColor = UserCenterColor.Current.White; - - oldFrameBack.BackgroundImagePath = "Room/RoomIconBackground.png"; - oldBtnText.TextColor = UserCenterColor.Current.TextGrayColor1; - oldFrameBack = frameBack; - oldBtnText = btnText; - //娣诲姞璁惧琛� - this.AddDeviceRow(dicData[textId], listView); - }; - } - - //娣诲姞璁惧琛� - foreach (int textId in dicData.Keys) - { - this.AddDeviceRow(dicData[textId], listView); - break; - } + this.nowDeviceIndex = scrolContr.nowSelectKeys; + //娣诲姞璁惧琛� + this.AddDeviceRow(listdevice, listView); + }; + scrolContr.InitControl(); } #endregion @@ -718,7 +321,6 @@ foreach (var device in listDevice) { var frameRow = new FrameRowControl(listView.rowSpace / 2); - frameRow.UseClickStatu = false; frameRow.LeftOffset = Application.GetRealWidth(46) - ControlCommonResourse.XXLeft; frameRow.RightOffset = -ControlCommonResourse.XXLeft; listView.AddChidren(frameRow); @@ -735,10 +337,32 @@ var btnSelect = frameRow.AddMostRightEmptyIcon(69, 69); btnSelect.UnSelectedImagePath = "Item/ItemUnSelected.png"; btnSelect.SelectedImagePath = "Item/ItemSelected.png"; - frameRow.ChangedChidrenBindMode(btnSelect, ChidrenBindMode.NotBind); - btnSelect.ButtonClickEvent += (sender, e) => + + string mainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); + if (dicSelectDevice.ContainsKey(mainKeys) == true) { + btnSelect.IsSelected = true; + } + frameRow.ButtonClickEvent += (sender, e) => + { + //閫夋嫨 btnSelect.IsSelected = !btnSelect.IsSelected; + if (btnSelect.IsSelected == true) + { + dicSelectDevice[mainKeys] = device; + if (this.btnShard.Visible == false) + { + this.btnShard.Visible = true; + } + } + else + { + dicSelectDevice.Remove(mainKeys); + if (dicSelectScene.Count == 0 && dicSelectDevice.Count == 0) + { + this.btnShard.Visible = false; + } + } }; } } @@ -758,6 +382,11 @@ var dic = new Dictionary<int, List<CommonDevice>>(); foreach (var device in listDevice) { + if (memberShardInfo.dicAllShardKeys.ContainsKey(device.FilePath) == true) + { + //濡傛灉宸茬粡鍒嗕韩浜�,鍒欎笉鏄剧ず + continue; + } var typeInfo = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { device }); if (device.Type == DeviceType.IASZone) { @@ -803,5 +432,41 @@ } #endregion + + #region 鈻� 淇濆瓨鍒嗕韩___________________________ + + /// <summary> + /// 淇濆瓨鍒嗕韩 + /// </summary> + private void SaveShardData() + { + //閫夋嫨鐨勮澶� + var listDevice = new List<CommonDevice>(); + foreach (var device in dicSelectDevice.Values) + { + listDevice.Add(device); + } + //閫夋嫨鐨勫満鏅� + var listScene = new List<Common.SceneUI>(); + foreach (var scene in dicSelectScene.Values) + { + listScene.Add(scene); + } + HdlThreadLogic.Current.RunThread(async () => + { + //涓婁紶鏂囦欢 + var result = await HdlShardLogic.Current.DoUploadSharedContent(memberShardInfo, this.lookRoom, listDevice, listScene); + if (result == true) + { + HdlThreadLogic.Current.RunMain(() => + { + //閲嶆柊鍒濆鍖栫晫闈� + this.InitMiddleFrame(); + }); + } + }); + } + + #endregion } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs index 1a76109..57e9242 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/AddNewSharedListRoomForm.cs @@ -203,22 +203,8 @@ { //濡傛灉娌℃湁鑳藉鍏变韩鐨勬埧闂� bodyFrameLayout.RemoveAll(); - - //鍥剧墖 - var btnPic = new PicViewControl(383, 279); - btnPic.Gravity = Gravity.CenterHorizontal; - btnPic.Y = Application.GetRealHeight(498); - btnPic.UnSelectedImagePath = "Item/NotShardPic.png"; - bodyFrameLayout.AddChidren(btnPic); - //鏃犲彲鍏变韩鐨勬埧闂� - var btnMsg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); - btnMsg1.Y = Application.GetRealHeight(962); - btnMsg1.TextAlignment = TextAlignment.Center; - btnMsg1.TextSize = 12; - btnMsg1.TextColor = UserCenterColor.Current.TextGrayColor1; - btnMsg1.TextID = R.MyInternationalizationString.uNotShardDeviceInAllRoomMsg; - bodyFrameLayout.AddChidren(btnMsg1); + this.ShowNotDataImage(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uNotCanShardRoomMsg), "Item/NotShardPic.png", 383, 279); } }); } @@ -249,7 +235,6 @@ var form = new AddNewSharedContentForm(); form.AddForm(room, memberShardInfo); }; - //閫夋嫨 var btnSelect = row.AddMostRightEmptyIcon(69, 69); diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs index d34fc96..515d242 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SharedContent/LookSharedListRoomForm.cs @@ -98,8 +98,11 @@ { HdlThreadLogic.Current.RunMain(() => { - //鏄剧ず娌℃湁鍒嗕韩鏁版嵁妯″紡 - this.ShowNotShardMode(); + bodyFrameLayout.RemoveAll(); + //杩樻病鏈夊叡浜尯鍩熺粰鎴愬憳{0}鍙偣鍑诲彸涓婅鈥�+鈥濇坊鍔� + string msg = Language.StringByID(R.MyInternationalizationString.uNotShardComtentMsg); + string[] Arry = msg.Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); + this.ShowNotDataImage(bodyFrameLayout, Arry, "Item/NotShardPic.png", 383, 279); }); } else @@ -264,7 +267,7 @@ var device = deviceUi.CommonDevice; if (device == null) { - string deviceFile = deviceUi.FileName.Replace("DeviceUI_", string.Empty); + string deviceFile = deviceUi.FileName; var byteData = HdlShardLogic.Current.GetShardFileContent(deviceFile); if (byteData == null) { @@ -308,45 +311,6 @@ //閲嶆柊鍒锋柊鐣岄潰 this.InitMiddleFrame(); return 1; - } - - #endregion - - #region 鈻� 涓�鑸柟娉昣__________________________ - - /// <summary> - /// 鏄剧ず娌℃湁鍒嗕韩鏁版嵁妯″紡 - /// </summary> - private void ShowNotShardMode() - { - bodyFrameLayout.RemoveAll(); - //鍥剧墖 - var btnPic = new PicViewControl(383, 279); - btnPic.Gravity = Gravity.CenterHorizontal; - btnPic.Y = Application.GetRealHeight(498); - btnPic.UnSelectedImagePath = "Item/NotShardPic.png"; - bodyFrameLayout.AddChidren(btnPic); - - //杩樻病鏈夊叡浜尯鍩熺粰鎴愬憳{0}鍙偣鍑诲彸涓婅鈥�+鈥濇坊鍔� - string msg = Language.StringByID(R.MyInternationalizationString.uNotShardComtentMsg); - string[] Arry = msg.Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries); - var btnMsg1 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); - btnMsg1.Y = Application.GetRealHeight(962); - btnMsg1.TextAlignment = TextAlignment.Center; - btnMsg1.TextSize = 12; - btnMsg1.TextColor = UserCenterColor.Current.TextGrayColor1; - btnMsg1.Text = Arry[0]; - bodyFrameLayout.AddChidren(btnMsg1); - if (Arry.Length > 1) - { - var btnMsg2 = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(50), false); - btnMsg2.Y = btnMsg1.Bottom; - btnMsg2.TextAlignment = TextAlignment.Center; - btnMsg2.TextSize = 12; - btnMsg2.TextColor = UserCenterColor.Current.TextGrayColor1; - btnMsg2.Text = Arry[1]; - bodyFrameLayout.AddChidren(btnMsg2); - } } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs index 13ca839..8d00507 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs @@ -67,208 +67,192 @@ /// <param name="typeTag">Type tag.</param> public void DeviceInfoChange(CommonDevice common, string typeTag) { - /// + var myDevice = LocalDevice.Current.GetDevice(common.DeviceAddr, common.DeviceEpoint); + if (myDevice == null) + { + return; + } //璁惧涓婃姤鐘舵�佷腑 褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� if (typeTag == "DeviceStatusReport") { try - { - for (int i = 0; i < Room.AllRoomDeviceUIList.Count; i++) - { - var deviceUI = Room.AllRoomDeviceUIList[i]; - if (deviceUI.CommonDevice == null) - { - //璁惧涓虹┖ - continue; - } - if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint) - { - //鍒ゆ柇鏄惁涓哄綋鍓嶈澶� - continue; - } - switch (deviceUI.CommonDevice.Type) - { - case DeviceType.OnOffOutput: - //寮�鍏冲姛鑳� - if (common.DeviceStatusReport.CluterID == 6) - { - var onOffOutputLight = deviceUI.CommonDevice as ZigBee.Device.ToggleLight; - onOffOutputLight.DeviceStatusReport = common.DeviceStatusReport; - //璁板綍銆佹洿鏂扮姸鎬� - if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0) - { - continue; - } - onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData; - //璁板綍鍥炲鏃堕棿 - onOffOutputLight.LastDateTime = DateTime.Now; - } - //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� - if (common.DeviceStatusReport.CluterID == 3) - { - var onOffOutputLight = deviceUI.CommonDevice as ToggleLight; - onOffOutputLight.IsOnline = 1; - //璁板綍鍥炲鏃堕棿 - onOffOutputLight.LastDateTime = DateTime.Now; - } - break; - - case DeviceType.AirSwitch: - //寮�鍏冲姛鑳� - if (common.DeviceStatusReport.CluterID == 6) - { - var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch; - airSwitch.DeviceStatusReport = common.DeviceStatusReport; - //璁板綍銆佹洿鏂扮姸鎬� - if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0) - { - return; - } - airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData; - //璁板綍鍥炲鏃堕棿 - airSwitch.LastDateTime = DateTime.Now; - - } - //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� - if (common.DeviceStatusReport.CluterID == 3) - { - var airSwitch = deviceUI.CommonDevice as AirSwitch; - airSwitch.IsOnline = 1; - //璁板綍鍥炲鏃堕棿 - airSwitch.LastDateTime = DateTime.Now; - } - break; - - case DeviceType.WindowCoveringDevice: - if (common.DeviceStatusReport.CluterID == 258) - { - var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade; - rollershade.DeviceStatusReport = common.DeviceStatusReport; - var attriButeList = rollershade.DeviceStatusReport.AttriBute; - if (attriButeList == null || attriButeList.Count == 0) - { - continue; - } - switch (attriButeList[0].AttributeId) - { - case 0: - rollershade.WcdType = attriButeList[0].AttriButeData; - rollershade.LastDateTime = DateTime.Now; - break; - } - } - if (common.DeviceStatusReport.CluterID == 3) - { - var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade; - rollershade.IsOnline = 1; - //璁板綍鍥炲鏃堕棿 - rollershade.LastDateTime = DateTime.Now; - } - break; - - case DeviceType.Thermostat: - //AC鍔熻兘 - if (common.DeviceStatusReport.CluterID == 513) - { - var ac = deviceUI.CommonDevice as ZigBee.Device.AC; - ac.DeviceStatusReport = common.DeviceStatusReport; - var attriButeList = ac.DeviceStatusReport.AttriBute; - if (attriButeList == null || attriButeList.Count == 0) - { - continue; - } - switch (attriButeList[0].AttributeId) - { - case 0: - //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝 - ac.currentLocalTemperature = attriButeList[0].AttriButeData / 100; - ac.LastDateTime = DateTime.Now; - break; - - case 17: - //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鍐锋俯搴︼紝瀹為檯娓╁害涓衡�淐oolingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆� - ac.currentCoolingSetpoint = attriButeList[0].AttriButeData / 100; - ac.LastDateTime = DateTime.Now; - break; - - case 18: - //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鐑俯搴︼紝瀹為檯娓╁害涓衡�淗eatingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆� - ac.currentHeatingSetpoint = attriButeList[0].AttriButeData / 100; - ac.LastDateTime = DateTime.Now; - break; - - case 4096: - //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勮嚜鍔ㄦ俯搴︼紝瀹為檯娓╁害涓衡�淎utoSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆� - ac.currentAutoSetpoint = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default; - ac.LastDateTime = DateTime.Now; - break; - - case 28: - //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡 - //Off = 0 Auto = 1 Cool = 3 Heat = 4 FanOnly = 7 Dry = 8 - ac.currentSystemMode = attriButeList[0].AttriButeData; - ac.LastDateTime = DateTime.Now; - break; - - } - - } - //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� - if (common.DeviceStatusReport.CluterID == 3) - { - var ac = deviceUI.CommonDevice as AC; - ac.IsOnline = 1; - //璁板綍鍥炲鏃堕棿 - ac.LastDateTime = DateTime.Now; - - } - break; - - case DeviceType.DimmableLight: - //璋冨厜鐏姛鑳� - //寮�鍏冲姛鑳� - if (common.DeviceStatusReport.CluterID == 6) - { - var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; - dimmableLight.DeviceStatusReport = common.DeviceStatusReport; - //璁板綍銆佹洿鏂扮姸鎬� - if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) - { - return; - } - dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData; - //璁板綍鍥炲鏃堕棿 - dimmableLight.LastDateTime = DateTime.Now; - } - //浜害 - if (common.DeviceStatusReport.CluterID == 8) - { - var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; - dimmableLight.DeviceStatusReport = common.DeviceStatusReport; - var attriButeList = dimmableLight.DeviceStatusReport.AttriBute; - if (attriButeList == null || attriButeList.Count == 0) - { - continue; - } - switch (attriButeList[0].AttributeId) - { - case 0: - //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴� - dimmableLight.Level = attriButeList[0].AttriButeData; - dimmableLight.LastDateTime = DateTime.Now; - break; - } - } - //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� - if (common.DeviceStatusReport.CluterID == 3) - { - var dimmableLight = deviceUI.CommonDevice as DimmableLight; - dimmableLight.IsOnline = 1; - //璁板綍鍥炲鏃堕棿 - dimmableLight.LastDateTime = DateTime.Now; - } - break; - } + { + switch (myDevice.Type) + { + case DeviceType.OnOffOutput: + //寮�鍏冲姛鑳� + if (common.DeviceStatusReport.CluterID == 6) + { + var onOffOutputLight = (ToggleLight)myDevice; + onOffOutputLight.DeviceStatusReport = common.DeviceStatusReport; + //璁板綍銆佹洿鏂扮姸鎬� + if (onOffOutputLight.DeviceStatusReport.AttriBute == null || onOffOutputLight.DeviceStatusReport.AttriBute.Count == 0) + { + return; + } + onOffOutputLight.OnOffStatus = onOffOutputLight.DeviceStatusReport.AttriBute[0].AttriButeData; + //璁板綍鍥炲鏃堕棿 + onOffOutputLight.LastDateTime = DateTime.Now; + } + //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� + if (common.DeviceStatusReport.CluterID == 3) + { + myDevice.IsOnline = 1; + //璁板綍鍥炲鏃堕棿 + myDevice.LastDateTime = DateTime.Now; + } + break; + + case DeviceType.AirSwitch: + //寮�鍏冲姛鑳� + if (common.DeviceStatusReport.CluterID == 6) + { + var airSwitch = (AirSwitch)myDevice; + airSwitch.DeviceStatusReport = common.DeviceStatusReport; + //璁板綍銆佹洿鏂扮姸鎬� + if (airSwitch.DeviceStatusReport.AttriBute == null || airSwitch.DeviceStatusReport.AttriBute.Count == 0) + { + return; + } + airSwitch.OnOffStatus = airSwitch.DeviceStatusReport.AttriBute[0].AttriButeData; + //璁板綍鍥炲鏃堕棿 + airSwitch.LastDateTime = DateTime.Now; + + } + //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� + if (common.DeviceStatusReport.CluterID == 3) + { + myDevice.IsOnline = 1; + //璁板綍鍥炲鏃堕棿 + myDevice.LastDateTime = DateTime.Now; + } + break; + + case DeviceType.WindowCoveringDevice: + if (common.DeviceStatusReport.CluterID == 258) + { + var rollershade = (Rollershade)myDevice; + rollershade.DeviceStatusReport = common.DeviceStatusReport; + var attriButeList = rollershade.DeviceStatusReport.AttriBute; + if (attriButeList == null || attriButeList.Count == 0) + { + return; + } + switch (attriButeList[0].AttributeId) + { + case 0: + rollershade.WcdType = attriButeList[0].AttriButeData; + rollershade.LastDateTime = DateTime.Now; + break; + } + } + if (common.DeviceStatusReport.CluterID == 3) + { + myDevice.IsOnline = 1; + //璁板綍鍥炲鏃堕棿 + myDevice.LastDateTime = DateTime.Now; + } + break; + + case DeviceType.Thermostat: + //AC鍔熻兘 + if (common.DeviceStatusReport.CluterID == 513) + { + var ac = (AC)myDevice; + ac.DeviceStatusReport = common.DeviceStatusReport; + var attriButeList = ac.DeviceStatusReport.AttriBute; + if (attriButeList == null || attriButeList.Count == 0) + { + return; + } + switch (attriButeList[0].AttributeId) + { + case 0: + //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝 + ac.currentLocalTemperature = attriButeList[0].AttriButeData / 100; + ac.LastDateTime = DateTime.Now; + break; + + case 17: + //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鍐锋俯搴︼紝瀹為檯娓╁害涓衡�淐oolingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆� + ac.currentCoolingSetpoint = attriButeList[0].AttriButeData / 100; + ac.LastDateTime = DateTime.Now; + break; + + case 18: + //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勫埗鐑俯搴︼紝瀹為檯娓╁害涓衡�淗eatingSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆� + ac.currentHeatingSetpoint = attriButeList[0].AttriButeData / 100; + ac.LastDateTime = DateTime.Now; + break; + + case 4096: + //姝ゅ睘鎬ц〃鏄庢璁惧褰撳墠鐨勮嚜鍔ㄦ俯搴︼紝瀹為檯娓╁害涓衡�淎utoSetpoint / 100鈥濓紝鍗曚綅锛氣剝銆� + ac.currentAutoSetpoint = (attriButeList[0].AttriButeData / 100 > ACControlBase.Temperature_High || attriButeList[0].AttriButeData / 100 < ACControlBase.Temperature_Low) ? attriButeList[0].AttriButeData / 100 : ACControlBase.Temperature_Default; + ac.LastDateTime = DateTime.Now; + break; + + case 28: + //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡 + //Off = 0 Auto = 1 Cool = 3 Heat = 4 FanOnly = 7 Dry = 8 + ac.currentSystemMode = attriButeList[0].AttriButeData; + ac.LastDateTime = DateTime.Now; + break; + + } + + } + //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� + if (common.DeviceStatusReport.CluterID == 3) + { + myDevice.IsOnline = 1; + //璁板綍鍥炲鏃堕棿 + myDevice.LastDateTime = DateTime.Now; + } + break; + + case DeviceType.DimmableLight: + //璋冨厜鐏姛鑳� + //寮�鍏冲姛鑳� + if (common.DeviceStatusReport.CluterID == 6) + { + var dimmableLight = (DimmableLight)myDevice; + dimmableLight.DeviceStatusReport = common.DeviceStatusReport; + //璁板綍銆佹洿鏂扮姸鎬� + if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) + { + return; + } + dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData; + //璁板綍鍥炲鏃堕棿 + dimmableLight.LastDateTime = DateTime.Now; + } + //浜害 + if (common.DeviceStatusReport.CluterID == 8) + { + var dimmableLight = (DimmableLight)myDevice; + dimmableLight.DeviceStatusReport = common.DeviceStatusReport; + var attriButeList = dimmableLight.DeviceStatusReport.AttriBute; + if (attriButeList == null || attriButeList.Count == 0) + { + return; + } + switch (attriButeList[0].AttributeId) + { + case 0: + //姝ゅ睘鎬ц〃鏄庡綋鍓嶄寒搴︾▼搴� + dimmableLight.Level = attriButeList[0].AttriButeData; + dimmableLight.LastDateTime = DateTime.Now; + break; + } + } + //褰揅luterID=3,灏辫瘉鏄庤璁惧鍦ㄧ嚎锛岀洿鎺ユ爣璁� + if (common.DeviceStatusReport.CluterID == 3) + { + myDevice.IsOnline = 1; + //璁板綍鍥炲鏃堕棿 + myDevice.LastDateTime = DateTime.Now; + } + break; } } catch (Exception ex) @@ -278,61 +262,10 @@ } //璁惧鍦ㄧ嚎鐘舵�佷笂鎶� else if (typeTag == "OnlineStatusChange") - { - try - { - for (int i = 0; i < Room.AllRoomDeviceUIList.Count; i++) - { - var deviceUI = Room.AllRoomDeviceUIList[i]; - if (deviceUI.CommonDevice == null) - { - //璁惧涓虹┖鎴栬�呮帶浠朵负绌� - continue; - } - if (common.DeviceAddr != deviceUI.CommonDevice.DeviceAddr || common.DeviceEpoint != deviceUI.CommonDevice.DeviceEpoint) - { - //鍒ゆ柇鏄惁涓哄綋鍓嶈澶� - continue; - } - switch (deviceUI.CommonDevice.Type) - { - case DeviceType.OnOffOutput: - var onOffOutputLight = deviceUI.CommonDevice as ToggleLight; - onOffOutputLight.IsOnline = common.IsOnline; - //璁板綍鍥炲鏃堕棿 - onOffOutputLight.LastDateTime = DateTime.Now; - break; - case DeviceType.AirSwitch: - var airSwitch = deviceUI.CommonDevice as AirSwitch; - airSwitch.IsOnline = common.IsOnline; - //璁板綍鍥炲鏃堕棿 - airSwitch.LastDateTime = DateTime.Now; - break; - case DeviceType.WindowCoveringDevice: - var rollershade = deviceUI.CommonDevice as ZigBee.Device.Rollershade; - rollershade.IsOnline = common.IsOnline; - //璁板綍鍥炲鏃堕棿 - rollershade.LastDateTime = DateTime.Now; - break; - case DeviceType.Thermostat: - var ac = deviceUI.CommonDevice as ZigBee.Device.AC; - ac.IsOnline = common.IsOnline; - //璁板綍鍥炲鏃堕棿 - ac.LastDateTime = DateTime.Now; - break; - case DeviceType.DimmableLight: - var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; - dimmableLight.IsOnline = common.IsOnline; - //璁板綍鍥炲鏃堕棿 - dimmableLight.LastDateTime = DateTime.Now; - break; - } - } - } - catch (Exception ex) - { - System.Console.WriteLine($"userpage鍔熻兘鍒锋柊-Error:{ex.Message}"); - } + { + myDevice.IsOnline = common.IsOnline; + //璁板綍鍥炲鏃堕棿 + myDevice.LastDateTime = DateTime.Now; } } /// <summary> diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs index 0ff39e6..9256d23 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs @@ -248,6 +248,11 @@ /// </summary> FanModeSequence = 1, + /// <summary> + /// 杩囪檻缃戞竻娲楁爣蹇�,濡傛灉杩斿洖鍗佽繘鍒躲��42銆戝垯浠h〃闇�瑕佹竻娲楁护缃� + /// </summary> + FilterCleaningStatus = 4097, + #endregion #region 绉佹湁鎸夐敭灞炴�� diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs index 990a82a..084b7f1 100755 --- a/ZigbeeApp/Shared/R.cs +++ b/ZigbeeApp/Shared/R.cs @@ -3390,7 +3390,7 @@ /// <summary> /// 鏃犲彲鍏变韩鐨勬埧闂� /// </summary> - public const int uNotShardDeviceInAllRoomMsg = 15583; + public const int uNotCanShardRoomMsg = 15583; /// <summary> /// 纭畾绉婚櫎閫変腑鐨勫満鏅紵 /// </summary> @@ -4443,6 +4443,18 @@ /// 鍏抽棴绌鸿皟澶辫触 /// </summary> public const int uCloseAirConditionerFail = 15855; + /// <summary> + /// 璇锋敞鎰忔竻娲楁护缃戝摝 + /// </summary> + public const int uPleaseClreanACfilter = 15856; + /// <summary> + /// 鏃犲彲鍏变韩鐨勫満鏅� + /// </summary> + public const int uNotCanShardSceneMsg = 15857; + /// <summary> + /// 鏃犲彲鍏变韩鐨勮澶� + /// </summary> + public const int uNotCanShardDeviceMsg = 15858; //鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� /// <summary> diff --git a/ZigbeeApp/Shared/Shared.projitems b/ZigbeeApp/Shared/Shared.projitems index 2d36486..21e5b9f 100755 --- a/ZigbeeApp/Shared/Shared.projitems +++ b/ZigbeeApp/Shared/Shared.projitems @@ -107,7 +107,6 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SelectedLogicState.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SelectedLogicStatus.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\Send.cs" /> - <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\SuperGateway.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TemplateDeviceAction.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TemplateDeviceCondition.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\Device\Logic\TemplatePage.cs" /> @@ -124,6 +123,8 @@ <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Common\AccountOption.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\BelongAreaControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\InformationEditorControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\RoomDeviceGroupMenuControl.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\SceneFunctionSwitchControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Controls\CompoundControls\VerificationCodeControl.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\GesturePswSecirityForm.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Phone\UserCenter\CommonBase\Form\SecondaryPswSecurityForm.cs" /> -- Gitblit v1.8.0