ZigbeeApp/GateWay.Droid/Assets/Language.ini
@@ -1495,6 +1495,9 @@ 15853=除湿 15854=打开空调失败 15855=关闭空调失败 15856=请注意清洗滤网哦 15857=无可共享的场景 15858=无可共享的设备 ;★★★★下面这些是接口的返回信息翻译,从18000开始★★★★ 18004=指定网关已经被绑定 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> 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; } 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"; } } 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())) { //分享者ID residential.Id = data["Id"].ToString(); //是否是分享账号[true(是分享);false;(不是分享)]; residential.IsOthreShare = Convert.ToBoolean(data["IsOthreShare"].ToString()); //分享者住宅ID 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 } } ZigbeeApp/Shared/Phone/Device/Logic/SuperGateway.cs
File was deleted ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/RoomDeviceGroupMenuControl.cs
New file @@ -0,0 +1,262 @@ using 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 } } ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SceneFunctionSwitchControl.cs
New file @@ -0,0 +1,170 @@ using 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 } } 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______________________ 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; } } } 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); //设备的UI 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) { //因为一个回路只能分配一个区域,所以可以直接判断 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 @@ //同步云端的网关id,如果本地拥有云端不存在的id,则表示应该被换绑了,直接删除 HdlGatewayLogic.Current.SynchronizeDbGateway(); //初始化住宅对象 Common.Config.Instance.Home = House.GetHouseByHouseId(Common.Config.Instance.HomeId); //初始化房间(郭雪城那边不做处理,需要这里特殊执行一步) Room.RefreshAllRoomByLocation(); 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; } } } }); } 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; 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)); } }); } 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; 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:功能Tab 2:场景Tab ///// </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(); // //初始化Tab控件 // 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(() => // { // //初始化功能Tab列表 // this.InitFunctionTabList(); // //初始化场景Tab列表 // this.InitSceneTabList(); // }); //} #endregion //#region ■ 初始化Tab控件______________________ ///// <summary> ///// 初始化Tab控件 ///// </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> ///// 初始化功能Tab列表 ///// </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> ///// 初始化场景Tab列表 ///// </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 } } 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); 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 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; } //设备上报状态中 当CluterID=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; } //当CluterID=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; } //当CluterID=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,实际温度为“LocalTemperature / 100”,单位:℃ ac.currentLocalTemperature = attriButeList[0].AttriButeData / 100; ac.LastDateTime = DateTime.Now; break; case 17: //此属性表明此设备当前的制冷温度,实际温度为“CoolingSetpoint / 100”,单位:℃。 ac.currentCoolingSetpoint = attriButeList[0].AttriButeData / 100; ac.LastDateTime = DateTime.Now; break; case 18: //此属性表明此设备当前的制热温度,实际温度为“HeatingSetpoint / 100”,单位:℃。 ac.currentHeatingSetpoint = attriButeList[0].AttriButeData / 100; ac.LastDateTime = DateTime.Now; break; case 4096: //此属性表明此设备当前的自动温度,实际温度为“AutoSetpoint / 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; } } //当CluterID=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; } } //当CluterID=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; } //当CluterID=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; } //当CluterID=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,实际温度为“LocalTemperature / 100”,单位:℃ ac.currentLocalTemperature = attriButeList[0].AttriButeData / 100; ac.LastDateTime = DateTime.Now; break; case 17: //此属性表明此设备当前的制冷温度,实际温度为“CoolingSetpoint / 100”,单位:℃。 ac.currentCoolingSetpoint = attriButeList[0].AttriButeData / 100; ac.LastDateTime = DateTime.Now; break; case 18: //此属性表明此设备当前的制热温度,实际温度为“HeatingSetpoint / 100”,单位:℃。 ac.currentHeatingSetpoint = attriButeList[0].AttriButeData / 100; ac.LastDateTime = DateTime.Now; break; case 4096: //此属性表明此设备当前的自动温度,实际温度为“AutoSetpoint / 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; } } //当CluterID=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; } } //当CluterID=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> ZigbeeApp/Shared/Phone/ZigBee/Device/Enum.cs
@@ -248,6 +248,11 @@ /// </summary> FanModeSequence = 1, /// <summary> /// 过虑网清洗标志,如果返回十进制【42】则代表需要清洗滤网 /// </summary> FilterCleaningStatus = 4097, #endregion #region 私有按键属性 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; //★★★★下面这些是接口的返回信息翻译,从18000开始★★★★ /// <summary> 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" />