| | |
| | | |
| | | 11010=没有功能 {\r\n} 请在个人中心--设备管理处添加 |
| | | 11011=编辑 |
| | | 11012=设置功能 |
| | | 11012=功能设置 |
| | | 11013=信息编辑 |
| | | 11014=功能名称 |
| | | 11015=所属区域 |
| | |
| | | 11034=确定要移除该功能? |
| | | 11035=添加功能 |
| | | 11036=添加延时 |
| | | |
| | | 11037=空调模式为空,请先配置 |
| | | |
| | | |
| | | 12100=未知设备 |
| | |
| | | 16058=我的家 |
| | | 16059=长按“我的家”{0}可切换我的住宅 |
| | | 16060=办公室 |
| | | 16061=电机数据异常,请重置电机 |
| | | 16062=获取空调摆风状态失败 |
| | | 16063=设置空调摆风失败 |
| | | |
| | | ;★★★★下面这些是接口的返回信息翻译,从18000开始★★★★
|
| | | 18004=指定网关已经被绑定
|
old mode 100644
new mode 100755
| | |
| | | <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
| | | <AndroidSupportedAbis />
|
| | | <AndroidDexTool>d8</AndroidDexTool>
|
| | | <AotAssemblies>false</AotAssemblies>
|
| | | <EnableLLVM>false</EnableLLVM>
|
| | | <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
|
| | | <BundleAssemblies>false</BundleAssemblies>
|
| | | </PropertyGroup>
|
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
| | | <DebugSymbols>true</DebugSymbols>
|
| | |
| | | <MandroidI18n>cjk</MandroidI18n>
|
| | | <DefineConstants>Android,Release</DefineConstants>
|
| | | <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
| | | <AotAssemblies>false</AotAssemblies>
|
| | | <EnableLLVM>false</EnableLLVM>
|
| | | <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
|
| | | <BundleAssemblies>false</BundleAssemblies>
|
| | | <AndroidDexTool>d8</AndroidDexTool>
|
| | | <AndroidUseAapt2>false</AndroidUseAapt2>
|
| | | </PropertyGroup>
|
old mode 100644
new mode 100755
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="2020010601" android:installLocation="auto" android:versionName="1.0.20010601"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.home" android:versionCode="2020010701" android:installLocation="auto" android:versionName="1.0.20010701"> |
| | | <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" /> |
| | | <permission android:name="com.hdl.home.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> |
| | | <uses-permission android:name="android.permission.WAKE_LOCK" /> |
| | |
| | | <meta-data android:name="JPUSH_APPKEY" android:value="f4a3322fbc45e58d04c85191" /> |
| | | <!-- </>值来自开发者平台取得的AppKey--> |
| | | <!-- 极光推送结束 --> |
| | | <!-- 设置高德地图key --> |
| | | <meta-data android:name="com.amap.api.v2.apikey" android:value="1f753413955012c9594c5df69eaa0aff" /> |
| | | <!-- 设置高德地图key --> |
| | | <meta-data android:name="com.amap.api.v2.apikey" android:value="1f753413955012c9594c5df69eaa0aff" /> |
| | | </application> |
| | | </manifest> |
old mode 100644
new mode 100755
Diff too large |
| | |
| | | |
| | | 11010=没有功能 {\r\n} 请在个人中心--设备管理处添加 |
| | | 11011=编辑 |
| | | 11012=设置功能 |
| | | 11012=功能设置 |
| | | 11013=信息编辑 |
| | | 11014=功能名称 |
| | | 11015=所属区域 |
| | |
| | | 11034=确定要移除该功能? |
| | | 11035=添加功能 |
| | | 11036=添加延时 |
| | | |
| | | 11037=空调模式为空,请先配置 |
| | | |
| | | |
| | | 12100=未知设备 |
| | |
| | | 16058=我的家 |
| | | 16059=长按“我的家”{0}可切换我的住宅 |
| | | 16060=办公室 |
| | | 16061=电机数据异常,请重置电机 |
| | | 16062=获取空调摆风状态失败 |
| | | 16063=设置空调摆风失败 |
| | | |
| | | ;★★★★下面这些是接口的返回信息翻译,从18000开始★★★★
|
| | | 18004=指定网关已经被绑定
|
| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string CodeIDString = "1.0.20010601"; |
| | | public static string CodeIDString = "1.0.20010701"; |
| | | /// <summary> |
| | | /// 注册来源(0:HDL On 1:Zigbee) |
| | | /// </summary> |
| | |
| | | #region ■ 添加设备___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 将指定网关的设备存入缓存中(从新获取镜像)
|
| | | /// <para>将指定网关的设备存入缓存中(从新获取镜像)</para>
|
| | | /// <para>-1:异常 1:正常 2:设备信息缺损</para>
|
| | | /// </summary>
|
| | | /// <param name="zbGateway">网关对象</param>
|
| | | /// <param name="deviceComingAction">接收到设备时的事件,设备对象为null时,代表接收完成</param>
|
| | | /// <returns>一直返回true</returns>
|
| | | public bool SetDeviceToMemmoryByGateway(ZbGateway zbGateway, Action<CommonDevice> deviceComingAction = null)
|
| | | public int SetDeviceToMemmoryByGateway(ZbGateway zbGateway)
|
| | | {
|
| | | //从网关获取全部的设备
|
| | | int statu = 0;
|
| | | List<CommonDevice> listDevice = new List<CommonDevice>();
|
| | | List<CommonDevice> list = this.GetDeviceListFromGateway(zbGateway, true, deviceComingAction);
|
| | |
|
| | | List<CommonDevice> list = this.GetDeviceListFromGateway(zbGateway, ref statu, true);
|
| | | if (list == null)
|
| | | {
|
| | | return false;
|
| | | return -1;
|
| | | }
|
| | | listDevice.AddRange(list);
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | //如果本地和网关的设备不一致的时候,暂时删除本地的设备
|
| | | //注意:只是删除设备文件,房间内容什么的还存在着
|
| | | foreach (var device in dicExist.Values)
|
| | | //只有完全获取的时候,才会去处理删除的问题
|
| | | if (statu == 1)
|
| | | {
|
| | | this.DeleteMemmoryDevice(device, false);
|
| | | //如果本地和网关的设备不一致的时候,删除本地的设备
|
| | | foreach (var device in dicExist.Values)
|
| | | {
|
| | | this.DeleteMemmoryDevice(device, true);
|
| | | }
|
| | | }
|
| | |
|
| | | return true;
|
| | | return statu;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | {
|
| | | //不存在则使用共通图片
|
| | | string[] arry = strSpecific.Split(new string[] { "_" }, StringSplitOptions.None);
|
| | | if (arry.Length == 1)
|
| | | //如果它自己就是共通图片的话,不再处理
|
| | | if (arry.Length > 1)
|
| | | {
|
| | | //如果它自己就是共通图片的话,不再处理
|
| | | return;
|
| | | imageFilePath = "Device/" + arry[0] + ".png";
|
| | | imageSelectFilePath = "Device/" + arry[0] + "Selected.png";
|
| | | }
|
| | | imageFilePath = "Device/" + arry[0] + ".png";
|
| | | imageSelectFilePath = "Device/" + arry[0] + "Selected.png";
|
| | | }
|
| | | //如果那款设备连共通图片都没有的话
|
| | | if (string.IsNullOrEmpty(IO.FileUtils.GetImageFilePath(imageFilePath)) == true)
|
| | | {
|
| | | imageFilePath = "Device/ThirdPartyDevice.png";
|
| | | imageSelectFilePath = "Device/ThirdPartyDeviceSelected.png";
|
| | | }
|
| | | //设置图片
|
| | | unSelectPath = imageFilePath;
|
| | |
| | | #region ■ 获取设备列表的接口_________________
|
| | |
|
| | | /// <summary>
|
| | | /// 从网关重新获取设备列表(★★★★★★★接收到设备时的事件★★★★★★★)
|
| | | /// <para>从网关重新获取设备列表(返回的设备为虚拟出来的)</para>
|
| | | /// <para>statu状态 -1:异常,会返回null, 1:没有异常, 2:数据接收不全</para>
|
| | | /// </summary>
|
| | | /// <param name="zbGateway">网关对象</param>
|
| | | /// <param name="ignoreTime">是否无视时间,true:每次调用都去网关获取,false:3分钟内返回的是本地的设备</param>
|
| | | /// <param name="deviceComingAction">接收到设备时的事件</param>
|
| | | /// <param name="statu">状态-> -1:异常,会返回null, 1:没有异常, 2:数据接收不全</param>
|
| | | /// <param name="ignoreTime">是否无视时间(此变量是给获取在线状态用的),true:每次调用都去网关获取,false:3分钟内返回的是本地的设备</param>
|
| | | /// <param name="mode">是否显示错误</param>
|
| | | /// <returns></returns> |
| | | public List<CommonDevice> GetDeviceListFromGateway(ZbGateway zbGateway, bool ignoreTime, Action<CommonDevice> deviceComingAction = null, ShowErrorMode mode = ShowErrorMode.YES) |
| | | public List<CommonDevice> GetDeviceListFromGateway(ZbGateway zbGateway, ref int statu, bool ignoreTime, ShowErrorMode mode = ShowErrorMode.YES) |
| | | {
|
| | | if (ignoreTime == false)
|
| | | {
|
| | | if ((DateTime.Now - zbGateway.LastDateTime).TotalMilliseconds < 3 * 60 * 1000)
|
| | | {
|
| | | //不无视时间,返回本地设备列表
|
| | | var listTemp = this.GetDeviceByGatewayID(HdlGatewayLogic.Current.GetGatewayId(zbGateway));
|
| | | if (deviceComingAction != null)
|
| | | {
|
| | | for (int i = 0; i < listTemp.Count; i++)
|
| | | {
|
| | | try
|
| | | {
|
| | | //回调函数
|
| | | deviceComingAction.Invoke(listTemp[i]);
|
| | | }
|
| | | //Log出力
|
| | | catch (Exception ex) { HdlLogLogic.Current.WriteLog(ex); }
|
| | | }
|
| | | }
|
| | | deviceComingAction = null;
|
| | | return listTemp;
|
| | | statu = 1;
|
| | | return this.GetDeviceByGatewayID(HdlGatewayLogic.Current.GetGatewayId(zbGateway));
|
| | | }
|
| | | }
|
| | | zbGateway.LastDateTime = DateTime.Now;
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uErrorGatewayLostMsg);
|
| | | this.ShowTipMsg(msg);
|
| | | }
|
| | | statu = -1;
|
| | | return null;
|
| | | }
|
| | |
|
| | |
| | | //网关里面有可能会有重复的回路
|
| | | if (listCheck.Contains(mainkeys) == false)
|
| | | {
|
| | | //回调函数
|
| | | deviceComingAction?.Invoke(device);
|
| | | listDevice.Add(device);
|
| | |
|
| | | listCheck.Add(mainkeys);
|
| | |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "回复超时", false);
|
| | | this.ShowTipMsg(msg);
|
| | | }
|
| | | statu = -1;
|
| | | return null;
|
| | | }
|
| | | else
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uNetworkUnStableAndDeviceInfoIsNotFull);
|
| | | this.ShowTipMsg(msg);
|
| | | }
|
| | | statu = 2;
|
| | | }
|
| | | }
|
| | |
|
| | | //回调函数(接收完成) |
| | | deviceComingAction = null; |
| | | |
| | | } |
| | | return listDevice; |
| | | }
|
| | |
|
| | |
| | | this.dicDeviceModelIdEnum["MPT2/R2-ZB.18"] = "202-200";//2按键触摸面板
|
| | | this.dicDeviceModelIdEnum["MPT1/R1-ZB.18"] = "203-200";//12按键触摸面板
|
| | | this.dicDeviceModelIdEnum["MPT4-ZB.18"] = "210-200";//4按键触摸面板(只带电源底座)
|
| | | this.dicDeviceModelIdEnum["MPT4R4L/S-ZB1.8"] = "220-200";//简约4按键面板
|
| | | this.dicDeviceModelIdEnum["MPT3R3L/S-ZB1.8"] = "221-200";//简约3按键面板
|
| | | this.dicDeviceModelIdEnum["MPT2R2L/S-ZB1.8"] = "222-200";//简约2按键面板
|
| | | this.dicDeviceModelIdEnum["MPT4R4L/S-ZB.18"] = "220-200";//简约4按键面板
|
| | | this.dicDeviceModelIdEnum["MPT3R3L/S-ZB.18"] = "221-200";//简约3按键面板
|
| | | this.dicDeviceModelIdEnum["MPT2R2L/S-ZB.18"] = "222-200";//简约2按键面板
|
| | |
|
| | | //=========★★PIR传感器类(1200-1299)★★=========
|
| | | this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200";//pir传感器220
|
| | |
| | | this.dicDeviceModelIdEnum["MBUS/GW-ZB.10"] = "4200-4200";//zigbee转buspro协议转换器
|
| | | this.dicDeviceModelIdEnum["M485/GW-ZB.10"] = "4201-4200";//zigbee转485协议转换器
|
| | |
|
| | |
|
| | |
|
| | | //✩✩✩✩✩需要交换的模块ID✩✩✩✩✩
|
| | | this.dicDeviceModelIdChanged = new Dictionary<string, string>();
|
| | | //=========★★安防类传感器类★★=========
|
| | |
| | | this.dicDeviceModelIdChanged["MULTI-WATE--EA02"] = "MSW01/M-ZB.10";//水浸传感器
|
| | | this.dicDeviceModelIdChanged["MULTI-BURO--EA06"] = "MBU01/M-ZB.10";//紧急按键
|
| | |
|
| | |
|
| | |
|
| | | //✩✩✩✩✩需要共有的图片对象✩✩✩✩✩
|
| | | this.dicPictrueShard = new Dictionary<string, string>();
|
| | | this.dicPictrueShard["ButtonPanel_SimpleFour"] = "ButtonPanel_Four";//简约4按键面板 沿用 4按键的图标
|
| | |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.UnallocatedArea); |
| | | } |
| | | if(string.IsNullOrEmpty(room.FloorId)) |
| | | { |
| | | return room.Name; |
| | | } |
| | | var floorName = Config.Instance.Home.GetFloorNameById(room.FloorId); |
| | | if (floorName == null) |
| | | { |
| | |
| | | } |
| | | Config.Instance.Home.InitFloor(); |
| | | |
| | | RefreshRoomListView(); |
| | | CurrentRoom.RefreshRoomListView(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新房间视图列表 |
| | | /// </summary> |
| | | public static void RefreshRoomListView() |
| | | public void RefreshRoomListView() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | Global.DeleteFilebyHomeId(roomFilePath); |
| | | Lists.Remove(room); |
| | | HdlAutoBackupLogic.DeleteFile(roomFilePath); |
| | | |
| | | CurrentRoom.RefreshRoomListView(); |
| | | |
| | | return true; |
| | | } |
| | | |
| | |
| | | return true;
|
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取房间所在区域 |
| | | /// 楼层,房间名 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetZoneName() |
| | | { |
| | | if (string.IsNullOrEmpty(FloorId)) |
| | | { |
| | | return Name; |
| | | } |
| | | var floorName = Config.Instance.Home.GetFloorNameById(FloorId); |
| | | if (floorName == null) |
| | | { |
| | | return Name; |
| | | } |
| | | return $"{floorName},{Name}"; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// <param name="sceneIconPath">背景图片,不包含住宅路径 如果iconPathType=1或者2 需要拼接住宅 变成 住宅/sceneIconPath</param> |
| | | /// <param name="commons">Commons.</param> |
| | | /// <param name="iconPathType">I场景背景图片来源类型 图片来源 0--本地图库 1--拍照 2--系统图库 默认0</param> |
| | | public async System.Threading.Tasks.Task<int> AddScene(string sceneName, string sceneIconPath, List<ZigBee.Device.Scene.AddSceneMemberData> commons, int iconPathType = 0) |
| | | public async System.Threading.Tasks.Task<int> AddScene(string sceneName, string sceneIconPath, List<ZigBee.Device.Scene.AddSceneMemberData> commons, int iconPathType) |
| | | { |
| | | var scenes = GetSceneUIsByFloorId(FloorId); |
| | | if(scenes!=null && scenes.Count>0) |
| | | { |
| | | if (scenes.Find(s => s.Name == sceneName) != null) |
| | | { |
| | | return -1; |
| | | } |
| | | } |
| | | //var scenes = GetSceneUIsByFloorId(FloorId); |
| | | //if(scenes!=null && scenes.Count>0) |
| | | //{ |
| | | // if (scenes.Find(s => s.Name == sceneName) != null) |
| | | // { |
| | | // return -1; |
| | | // } |
| | | //} |
| | | |
| | | var getSceneIdAllData = await ZigBee.Device.Scene.GetSceneNewIdAsync(sceneName); |
| | | if (getSceneIdAllData == null || getSceneIdAllData.getSceneIdData == null) |
| | |
| | | //加入成功 |
| | | if (result) |
| | | { |
| | | //iconPathType=0 直接传值, iconPathType=1和iconPathType=2需要拼接住宅路径 |
| | | var fullPath = sceneIconPath; |
| | | if (iconPathType == 1 || iconPathType == 2) |
| | | { |
| | | Common.Room.CurrentRoom.MoveBackGroundIamageFileToDirectory(sceneIconPath, $"{Config.Instance.FullPath}/{sceneIconPath}"); |
| | | fullPath = $"{Config.Instance.FullPath}/{sceneIconPath}"; |
| | | } |
| | | var sceneUI = new SceneUI |
| | | { |
| | | Name = sceneName, |
| | | Id = getSceneIdData.NewScenesId, |
| | | IconPath = fullPath, |
| | | IconPath = sceneIconPath, |
| | | IconPathType = iconPathType, |
| | | AddSceneMemberDataList= commons |
| | | }; |
| | | sceneUI.Save(); |
| | | SceneUIList.Add(sceneUI); |
| | | SceneUIFilePathList.Add(sceneUI.FileName); |
| | | sceneUI.Save(); |
| | | Save(); |
| | | HdlAutoBackupLogic.AddOrEditorFile(sceneUI.FileName); |
| | | return 1; |
| | | } |
| | | return 0; |
| | |
| | | /// <summary> |
| | | /// 是否是收藏设备 |
| | | /// </summary> |
| | | /// <param name="room"></param> |
| | | /// <param name="filePath"></param> |
| | | /// <returns></returns> |
| | | public bool IsCollectInRoom(Room room,string filePath) |
| | | public bool IsCollectInRoom(string filePath) |
| | | { |
| | | if(room.IsLove) |
| | | { |
| | | return true; |
| | | } |
| | | if (GetLoveRoom().DeviceUIFilePathList.Find((obj) => obj == filePath) == null) |
| | | { |
| | | return false; |
| | |
| | | /// </summary> |
| | | public uint GXCWaveSeekBarUnSelectedColor = 0xFFEBEBED; |
| | | /// <summary> |
| | | /// GXCWaveSeekBarColor 0xFFFE4F35 |
| | | /// GXCWaveSeekBarColor_Start 0xFFFF6C2C |
| | | /// </summary> |
| | | public uint GXCWaveSeekBarColor = 0xFFFE4F35; |
| | | public uint GXCWaveSeekBarColor_Start = 0xFFFF6C2C; |
| | | /// <summary> |
| | | /// GXCWaveSeekBarColor_End 0xFFFD3040 |
| | | /// </summary> |
| | | public uint GXCWaveSeekBarColor_End = 0xFFFD3040; |
| | | /// <summary> |
| | | /// 0xFFFDB500 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<DeviceUI, Common.Room> action; |
| | | |
| | | /// <summary> |
| | | /// 收藏按钮 |
| | |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZigBee.Device.ZbGateway.StatusList.Remove(this); |
| | | //action(); |
| | | //action = null; |
| | | action(device, room); |
| | | action = null; |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | HomePage.Instance.ScrollEnabled = true; |
| | | if (IsDrawerLockMode) |
| | |
| | | } |
| | | } |
| | | |
| | | var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (de == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName)==false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | }; |
| | | itemView.AddChidren(indoorTemperatureBtn); |
| | | |
| | | mArcScaleSeekBar = new ArcScaleSeekBar |
| | | var mArcScaleSeekBarFL = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(412), |
| | | Width = Application.GetRealWidth(671), |
| | | Height = Application.GetRealHeight(671), |
| | | Width = Application.GetMinRealAverage(671), |
| | | Height = Application.GetMinRealAverage(671), |
| | | Gravity = Gravity.CenterHorizontal |
| | | }; |
| | | itemView.AddChidren(mArcScaleSeekBarFL); |
| | | |
| | | mArcScaleSeekBar = new ArcScaleSeekBar |
| | | { |
| | | Width = Application.GetMinRealAverage(671), |
| | | Height = Application.GetMinRealAverage(671), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | MinValue = ACControlBase.Temperature_Low, |
| | | MaxValue = ACControlBase.Temperature_High, |
| | | Progress = ACControlBase.GetCurrentModeTemperature(ac), |
| | | IsClickable = ACControlBase.IsOpen(ac) |
| | | IsClickable = ACControlBase.IsOpen(ac), |
| | | ProgressBarUnitSring = string.Empty |
| | | }; |
| | | itemView.AddChidren(mArcScaleSeekBar); |
| | | mArcScaleSeekBarFL.AddChidren(mArcScaleSeekBar); |
| | | if(ACControlBase.IsOpen(ac)) |
| | | { |
| | | mArcScaleSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCArcScaleSeekBarStartColor, ZigbeeColor.Current.GXCArcScaleSeekBarEndColor); |
| | |
| | | |
| | | currentModeBtn = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(565), |
| | | Height = Application.GetRealHeight(80), |
| | | Y = Application.GetMinRealAverage(187), |
| | | Height = Application.GetRealHeight(50), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode), |
| | | TextSize=12 |
| | | TextSize = 12 |
| | | }; |
| | | itemView.AddChidren(currentModeBtn); |
| | | mArcScaleSeekBarFL.AddChidren(currentModeBtn); |
| | | |
| | | reduceTemperatureBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(268), |
| | | Y = Application.GetRealHeight(650), |
| | | X = Application.GetMinRealAverage(132), |
| | | Y = Application.GetMinRealAverage(268), |
| | | Width = Application.GetMinRealAverage(80), |
| | | Height = Application.GetMinRealAverage(80), |
| | | UnSelectedImagePath = "AC/Reduce.png" |
| | | }; |
| | | itemView.AddChidren(reduceTemperatureBtn); |
| | | mArcScaleSeekBarFL.AddChidren(reduceTemperatureBtn); |
| | | |
| | | addTemperatureBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(610), |
| | | Y = Application.GetRealHeight(650), |
| | | X = Application.GetMinRealAverage(452), |
| | | Y = Application.GetMinRealAverage(268), |
| | | Width = Application.GetMinRealAverage(80), |
| | | Height = Application.GetMinRealAverage(80), |
| | | UnSelectedImagePath = "AC/Add.png" |
| | | }; |
| | | itemView.AddChidren(addTemperatureBtn); |
| | | mArcScaleSeekBarFL.AddChidren(addTemperatureBtn); |
| | | |
| | | var uintBtn = new Button |
| | | { |
| | | Y = Application.GetMinRealAverage(369), |
| | | Height = Application.GetRealHeight(60), |
| | | Width = Application.GetRealWidth(100), |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text = "℃", |
| | | TextSize = 18 |
| | | }; |
| | | mArcScaleSeekBarFL.AddChidren(uintBtn); |
| | | |
| | | FanSwingModeBtn = new Button() |
| | | { |
| | |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void ShowChangeMode_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | if (HadSupportModel() == false) |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.AC_Model_None)); |
| | | return; |
| | | } |
| | | |
| | | int modeItem_X = 80; |
| | | int modeItem_Height = 150; |
| | | int modeItem_Width = 449; |
| | |
| | | ac.currentSystemMode = (int)acMode; |
| | | mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac); |
| | | ac.SetSystemModeAsync(acMode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 是否配置了模式 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private bool HadSupportModel() |
| | | { |
| | | bool hadMode = false; |
| | | foreach (var m in ac.listSupportMode) |
| | | { |
| | | if (m == 1) |
| | | { |
| | | hadMode = true; |
| | | break; |
| | | } |
| | | } |
| | | return hadMode; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.EditAction = (d,r) => |
| | | detailInfo.EditAction += (curDev, curRoom) => |
| | | { |
| | | Show(device, room); |
| | | Show(curDev, curRoom); |
| | | }; |
| | | } |
| | | |
| | |
| | | }; |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | | if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A开关) |
| | | var lightControl = new Phone.Device.Light.OnOffControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | lightControl.action += (curDev, curRoom) => |
| | | { |
| | | var lightControl = new Phone.Device.Light.OnOffControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | } |
| | | else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | | var lightControl = new Phone.Device.Light.PlugControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | } |
| | | else |
| | | { |
| | | var lightControl = new Phone.Device.Light.LightControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | var lightControl = new Phone.Device.Light.AirSwitchControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | lightControl.action += (curDev, curRoom) => |
| | | { |
| | | |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | |
| | | }; |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | UserView.HomePage.Instance.AddChidren(dimmableLightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //dimmableLightControl.action = RefreshBodyView; |
| | | dimmableLightControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | dimmableLightControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | var deviceRow = new CategoryFunctionRow(0, 35); |
| | | deviceRow.Init(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | //deviceRow.SetOnLineStatu(ac.IsOnline == 1); |
| | | deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); |
| | | deviceRow.IsSelected = ac.currentSystemMode != 1; |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | |
| | | UserView.HomePage.Instance.AddChidren(acControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //rollerShadeControl.action = RefreshBodyView; |
| | | acControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | acControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | |
| | | }; |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | UserView.HomePage.Instance.AddChidren(rollerShadeControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //rollerShadeControl.action = RefreshBodyView; |
| | | rollerShadeControl.Show(deviceUI, Common.Room.CurrentRoom); |
| | | rollerShadeControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) => |
| | |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | ReFreshDeviceActionForWin(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | } |
| | | |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock) |
| | |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | detailInfo.Show(deviceUI, Shared.Common.Room.CurrentRoom); |
| | | detailInfo.EditAction += (curDevice, curRoom) => |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | deviceRow.RemoveFromParent(); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow); |
| | | }; |
| | | }; |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | | } |
| | | } |
| | | |
| | | |
| | | //删除设备 |
| | | EventHandler<MouseEventArgs> delEvent = (delSender, delE) => |
| | |
| | | sameTypeList.Remove(deviceUI); |
| | | if (Common.Room.CurrentRoom.GetLoveRoom().DeviceUIList.Find((obj) => obj.FileName == deviceUI.FileName) != null) |
| | | { |
| | | Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(deviceUI.FileName); |
| | | } |
| | | } |
| | | if (sameTypeList.Count == 0) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ReFreshDeviceAction |
| | | /// </summary> |
| | | /// <param name="curRoom"></param> |
| | | /// <param name="sameTypeList"></param> |
| | | /// <param name="devListScrolView"></param> |
| | | /// <param name="deviceRow"></param> |
| | | private void ReFreshDeviceAction(DeviceUI deviceUI, Common.Room curRoom, List<DeviceUI> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionRow deviceRow) |
| | | { |
| | | if (Common.Room.CurrentRoom.IsLove) |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false) |
| | | { |
| | | devListScrolView.RemoveViewByTag(deviceUI); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | devListScrolView.RemoveViewByTag(deviceUI); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ReFreshDeviceAction |
| | | /// </summary> |
| | | /// <param name="curRoom"></param> |
| | | /// <param name="sameTypeList"></param> |
| | | /// <param name="devListScrolView"></param> |
| | | /// <param name="deviceRow"></param> |
| | | private void ReFreshDeviceActionForWin(DeviceUI deviceUI, Common.Room curRoom, List<DeviceUI> sameTypeList, VerticalScrolViewLayout devListScrolView, CategoryFunctionForWinRow deviceRow) |
| | | { |
| | | if (Common.Room.CurrentRoom.IsLove) |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(deviceUI.FileName) == false) |
| | | { |
| | | devListScrolView.RemoveViewByTag(deviceUI); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.DeleteDevice(deviceUI.FileName); |
| | | devListScrolView.RemoveViewByTag(deviceUI); |
| | | sameTypeList.Remove(deviceUI); |
| | | if (sameTypeList.Count == 0) |
| | | { |
| | | RefreshFunction(Common.Room.CurrentRoom); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | deviceRow.SetDeviceIcon(deviceUI.IconPath, deviceUI.OnlineIconPath); |
| | | deviceRow.SetTitle(deviceUI.CommonDevice.DeviceEpointName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// AddRoomView |
| | | /// </summary> |
| | | private void AddRoomView() |
| | |
| | | }; |
| | | bodyFrameLayout.AddChidren(imgFL); |
| | | |
| | | var backGround1 = new ImageView() |
| | | { |
| | | Y = Application.GetRealHeight(46), |
| | | Width = Application.GetMinRealAverage(916), |
| | | Height = Application.GetMinRealAverage(487), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | ImagePath = "Room/Room_Rectangle.png" |
| | | }; |
| | | imgFL.AddChidren(backGround1); |
| | | |
| | | backGround = new ImageView() |
| | | { |
| | | Width = Application.GetMinRealAverage(930), |
| | | Height = Application.GetMinRealAverage(464), |
| | | Gravity = Gravity.Center, |
| | | Y = Application.GetRealHeight(46), |
| | | Width = Application.GetMinRealAverage(887), |
| | | Height = Application.GetMinRealAverage(444), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Radius = (uint)Application.GetMinRealAverage(CommonFormResouce.BigFormRadius), |
| | | ImagePath = "SceneIcon/3.jpg" |
| | | }; |
| | | imgFL.AddChidren(backGround); |
| | | backGround.SetViewShadow(true); |
| | | |
| | | var infoFL = new FrameLayout |
| | | { |
| | |
| | | //通过相机拍照裁剪 |
| | | CropImage.TakePicture((imagePath) => |
| | | {
|
| | | if (string.IsNullOrEmpty(imagePath)) |
| | | { |
| | | return; |
| | | } |
| | | if (isModify) |
| | | { |
| | | if (IconPathType != 0) |
| | |
| | | //从相册选择图片裁剪 |
| | | CropImage.SelectPicture((imagePath) => |
| | | {
|
| | | if (string.IsNullOrEmpty(imagePath)) |
| | | { |
| | | return; |
| | | } |
| | | if (isModify) |
| | | { |
| | | if (IconPathType != 0) |
| | |
| | | //区域 |
| | | EventHandler<MouseEventArgs> zoneHander = (sender, e) => |
| | | { |
| | | List<string> floorIds = new List<string> { }; |
| | | List<string> floorNames = new List<string> { }; |
| | | List<List<string>> roomNames = new List<List<string>> { }; |
| | | List<List<Common.Room>> rooms = new List<List<Common.Room>> { }; |
| | | List<Common.Room> rs = new List<Common.Room> { }; |
| | | List<string> rNames = new List<string> { }; |
| | | if (Config.Instance.Home.FloorDics.Count > 0) |
| | | var zone = new SelectZone(); |
| | | zone.Init(); |
| | | zone.ZoneAction += (selectRoom) => |
| | | { |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | | { |
| | | if (Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count > 0) |
| | | { |
| | | floorIds.Add(floor.Key); |
| | | floorNames.Add(floor.Value); |
| | | |
| | | roomNames.Add(Common.Room.CurrentRoom.GetRoomNamesByFloorId(floor.Key)); |
| | | rooms.Add(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key)); |
| | | } |
| | | } |
| | | PickerView.ShowSecondary(floorNames, roomNames, (index1, index2) => |
| | | { |
| | | curRoom = rooms[index1][index2]; |
| | | zoneRow.SetTitle($"{Config.Instance.Home.GetFloorNameById(floorIds[index1])} , {rooms[index1][index2].Name}"); |
| | | }, 0, 0, Language.StringByID(R.MyInternationalizationString.BelongZone), |
| | | Language.StringByID(R.MyInternationalizationString.Confrim), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < Common.Room.Lists.Count; i++) |
| | | { |
| | | var r = Common.Room.Lists[i]; |
| | | if (r.IsLove) |
| | | { |
| | | continue; |
| | | } |
| | | rs.Add(r); |
| | | rNames.Add(r.Name); |
| | | } |
| | | PickerView.Show(rNames, (index1) => |
| | | { |
| | | curRoom = rs[index1]; |
| | | zoneRow.SetTitle(rs[index1].Name); |
| | | }, 0, Language.StringByID(R.MyInternationalizationString.BelongZone), |
| | | Language.StringByID(R.MyInternationalizationString.Confrim), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | | curRoom = selectRoom; |
| | | zoneRow.SetTitle(selectRoom.GetZoneName()); |
| | | }; |
| | | }; |
| | | zoneRow.ClickBtn.MouseUpEventHandler += zoneHander; |
| | | |
| | |
| | | if (OldIconPathType != 0) |
| | | { |
| | | Shared.IO.FileUtils.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, OldBackgroundImagePath)); |
| | | HdlAutoBackupLogic.DeleteFile(System.IO.Path.Combine(Config.Instance.FullPath, OldBackgroundImagePath)); |
| | | |
| | | HdlAutoBackupLogic.DeleteFile(OldBackgroundImagePath); |
| | | } |
| | | if (IconPathType == 1 || IconPathType == 2) |
| | | { |
| | | Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes); |
| | | HdlAutoBackupLogic.AddOrEditorFile(System.IO.Path.Combine(Config.Instance.FullPath, fileName)); |
| | | HdlAutoBackupLogic.AddOrEditorFile(fileName); |
| | | modifySceneUI.IconPath = fileName; |
| | | } |
| | | else |
| | |
| | | if (IconPathType == 1 || IconPathType == 2) |
| | | { |
| | | Shared.IO.FileUtils.WriteFileByBytes(System.IO.Path.Combine(Config.Instance.FullPath, fileName), backGround.ImageBytes); |
| | | HdlAutoBackupLogic.AddOrEditorFile(fileName); |
| | | imgPath = fileName; |
| | | } |
| | | else |
| | |
| | | } |
| | | } |
| | | |
| | | var result = await curRoom.AddScene(nameRow.NameText.Text, imgPath, memberDataList); |
| | | var result = await curRoom.AddScene(nameRow.NameText.Text, imgPath, memberDataList, IconPathType); |
| | | if (result == 1) |
| | | { |
| | | AddAction?.Invoke(); |
| | |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | |
| | | open.SeekBar.ProgressChanged += (sender, e) => |
| | | open.SeekBar.OnProgressChangedEvent += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | open.SetProgress(sceneTarget.TaskList[0].Data2); |
| | | open.SetSeekBarProgress(sceneTarget.TaskList[0].Data2); |
| | | } |
| | | } |
| | | |
| | |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | |
| | | open.SeekBar.ProgressChanged += (sender, e) => |
| | | open.SeekBar.OnProgressChangedEvent += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | open.SetProgress(sceneTarget.TaskList[0].Data1); |
| | | open.SetSeekBarProgress(sceneTarget.TaskList[0].Data1); |
| | | } |
| | | } |
| | | |
| | |
| | | deviceListScrolView.AddChidren(deviceTypeRowLayout); |
| | | |
| | | var deviceRow = new FunctionRow(0, 35); |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | | deviceRow.Init(device.IconPath, device.OnlineIconPath, true); |
| | | deviceRow.SetTitle(device.CommonDevice.DeviceEpointName); |
| | | deviceRow.IsSelected = true; |
| | | deviceRow.HideSwitchBtn(false); |
| | | deviceRow.NameBtn.BackgroundColor = ZigbeeColor.Current.GXCRedColor; |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | | |
| | | |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | |
| | | open.SeekBar.ProgressChanged += (sender, e) => |
| | | open.SeekBar.OnProgressChangedEvent += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | open.SetProgress(sceneTarget.TaskList[0].Data2); |
| | | open.SetSeekBarProgress(sceneTarget.TaskList[0].Data2); |
| | | } |
| | | } |
| | | |
| | |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | |
| | | open.SeekBar.ProgressChanged += (sender, e) => |
| | | open.SeekBar.OnProgressChangedEvent += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | open.SetProgress(sceneTarget.TaskList[0].Data1); |
| | | open.SetSeekBarProgress(sceneTarget.TaskList[0].Data1); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | Config.Instance.Home.CurrentFloorId = (sender as CommonForm.LeftIconButtonRow).Tag.ToString(); |
| | | Config.Instance.Home.Save(); |
| | | Common.Room.RefreshRoomListView(); |
| | | Common.Room.CurrentRoom.RefreshRoomListView(); |
| | | } |
| | | RemoveView(); |
| | | FloorAction?.Invoke((sender as CommonForm.LeftIconButtonRow).Tag.ToString()); |
| | |
| | | /// </summary> |
| | | public override void RemoveFromParent() |
| | | { |
| | | EditAction = null; |
| | | base.RemoveFromParent(); |
| | | } |
| | | #endregion |
| | |
| | | |
| | | AddTop(); |
| | | |
| | | AddBodyView(device); |
| | | AddBodyView(device,room); |
| | | |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// AddBodyView |
| | | /// </summary> |
| | | public void AddBodyView(DeviceUI device) |
| | | public void AddBodyView(DeviceUI device, Common.Room room) |
| | | { |
| | | bodyFrameLayout = new FrameLayout() |
| | | { |
| | |
| | | }; |
| | | bodyFrameLayout.AddChidren(infoFL); |
| | | var rectCornerID = HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight; |
| | | infoFL.SetCornerWithSameRadius(Application.GetRealHeight(50), rectCornerID); |
| | | infoFL.SetCornerWithSameRadius(Application.GetRealHeight(58), rectCornerID); |
| | | |
| | | var tipBtn = new Button |
| | | { |
| | |
| | | }; |
| | | infoFL.AddChidren(tipBtn); |
| | | |
| | | var nameRow = new DeviceInfoEditRow(170); |
| | | var infoScrolView = new VerticalScrolViewLayout |
| | | { |
| | | Y = Application.GetRealHeight(170-12), |
| | | Height = Application.GetRealHeight(600), |
| | | ScrollEnabled = false, |
| | | VerticalScrollBarEnabled = false |
| | | }; |
| | | infoFL.AddChidren(infoScrolView); |
| | | |
| | | var nameFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(127 + 12) |
| | | }; |
| | | infoScrolView.AddChidren(nameFL); |
| | | var nameRow = new DeviceInfoEditRow(12); |
| | | nameRow.Init(); |
| | | nameRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionName)} : "); |
| | | nameRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceEpointName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceEpointName); |
| | | infoFL.AddChidren(nameRow); |
| | | nameFL.AddChidren(nameRow); |
| | | |
| | | var zoneRow = new DeviceInfoRow(308); |
| | | |
| | | var zoneFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(127 + 12) |
| | | }; |
| | | if (room != null && room.IsLove == false) |
| | | { |
| | | infoScrolView.AddChidren(zoneFL); |
| | | } |
| | | var zoneRow = new DeviceInfoRow(12); |
| | | zoneRow.Init(); |
| | | zoneRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongZone)} : "); |
| | | zoneRow.SetTitle(roomName); |
| | | infoFL.AddChidren(zoneRow); |
| | | zoneFL.AddChidren(zoneRow); |
| | | |
| | | var modelRow = new DeviceInfoRow(446); |
| | | var modelFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(127 + 12) |
| | | }; |
| | | infoScrolView.AddChidren(modelFL); |
| | | var modelRow = new DeviceInfoRow(12); |
| | | modelRow.Init(); |
| | | modelRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.BelongModel)} : "); |
| | | modelRow.SetTitle(string.IsNullOrEmpty(device.CommonDevice.DeviceName) ? Language.StringByID(R.MyInternationalizationString.UNKnown) : device.CommonDevice.DeviceName); |
| | | modelRow.HideNext(true); |
| | | infoFL.AddChidren(modelRow); |
| | | modelFL.AddChidren(modelRow); |
| | | |
| | | if (device.CommonDevice.Type==ZigBee.Device.DeviceType.OnOffOutput) |
| | | if (device.CommonDevice.Type==DeviceType.OnOffOutput || device.CommonDevice.Type==DeviceType.AirSwitch) |
| | | { |
| | | functionTypeRow = new DeviceInfoRow(585); |
| | | var typeFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(127 + 12) |
| | | }; |
| | | infoScrolView.AddChidren(typeFL); |
| | | functionTypeRow = new DeviceInfoRow(12); |
| | | functionTypeRow.Init(); |
| | | functionTypeRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.FunctionType)} : "); |
| | | //functionTypeRow.SetTitle(device.CommonDevice.DfunctionType); |
| | | infoFL.AddChidren(functionTypeRow); |
| | | typeFL.AddChidren(functionTypeRow); |
| | | var dfunctionType = device.CommonDevice.DfunctionType; |
| | | |
| | | //功能类型的翻译名字 |
| | |
| | | } |
| | | }; |
| | | }; |
| | | |
| | | //sharedRow = new DeviceInfoRow(723); |
| | | //sharedRow.Init(); |
| | | //sharedRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.Share)} : "); |
| | | //sharedRow.SetTitle("2人"); |
| | | //infoFL.AddChidren(sharedRow); |
| | | } |
| | | else |
| | | { |
| | | //sharedRow = new DeviceInfoRow(585); |
| | | //sharedRow.Init(); |
| | | //sharedRow.SetTipTitle($"{Language.StringByID(R.MyInternationalizationString.Share)} : "); |
| | | //sharedRow.SetTitle("2人"); |
| | | //infoFL.AddChidren(sharedRow); |
| | | } |
| | | |
| | | var confirmBtn = new CommonForm.CompleteButton(962, 907, 127); |
| | | confirmBtn.SetTitle(R.MyInternationalizationString.Confrim); |
| | | |
| | | var confirmBtn = new CommonForm.CompleteButton(962, 900, 127); |
| | | confirmBtn.SetTitle(R.MyInternationalizationString.Save); |
| | | infoFL.AddChidren(confirmBtn); |
| | | |
| | | #region event |
| | | EventHandler<MouseEventArgs> selectZoneEvent = (sender, e) => |
| | | { |
| | | List<string> floorIds = new List<string> { }; |
| | | List<string> floorNames = new List<string> { }; |
| | | List<List<string>> roomNames = new List<List<string>> { }; |
| | | List<List<Common.Room>> rooms = new List<List<Common.Room>> { }; |
| | | List<Common.Room> rs = new List<Common.Room> { }; |
| | | List<string> rNames = new List<string> { }; |
| | | if (Config.Instance.Home.FloorDics.Count>0) |
| | | var zone = new SelectZone(); |
| | | zone.Init(); |
| | | zone.ZoneAction += (selectRoom) => |
| | | { |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | | { |
| | | floorIds.Add(floor.Key); |
| | | floorNames.Add(floor.Value); |
| | | if (Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count > 0) |
| | | { |
| | | roomNames.Add(Common.Room.CurrentRoom.GetRoomNamesByFloorId(floor.Key)); |
| | | rooms.Add(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key)); |
| | | } |
| | | } |
| | | PickerView.ShowSecondary(floorNames, roomNames, (index1, index2) => |
| | | { |
| | | curRoom = rooms[index1][index2]; |
| | | zoneRow.SetTitle($"{Config.Instance.Home.GetFloorNameById(floorIds[index1])} , {rooms[index1][index2].Name}"); |
| | | }, 0, 0, Language.StringByID(R.MyInternationalizationString.BelongZone), |
| | | Language.StringByID(R.MyInternationalizationString.Confrim), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | | else |
| | | { |
| | | for(int i=0;i<Common.Room.Lists.Count;i++) |
| | | { |
| | | var r = Common.Room.Lists[i]; |
| | | if (r.IsLove) |
| | | { |
| | | continue; |
| | | } |
| | | rs.Add(r); |
| | | rNames.Add(r.Name); |
| | | } |
| | | PickerView.Show(rNames, (index1) => |
| | | { |
| | | curRoom = rs[index1]; |
| | | zoneRow.SetTitle(rs[index1].Name); |
| | | }, 0,Language.StringByID(R.MyInternationalizationString.BelongZone), |
| | | Language.StringByID(R.MyInternationalizationString.Confrim), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | | curRoom = selectRoom; |
| | | zoneRow.SetTitle(selectRoom.GetZoneName()); |
| | | }; |
| | | }; |
| | | zoneRow.ClickBtn.MouseUpEventHandler += selectZoneEvent; |
| | | |
| | |
| | | CommonPage.Loading.Start(); |
| | | if (device.CommonDevice == null) |
| | | { |
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain); |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); |
| | | return; |
| | | } |
| | | if (device.CommonDevice.Type == ZigBee.Device.DeviceType.OnOffOutput) |
| | | if (device.CommonDevice.Type == DeviceType.OnOffOutput || device.CommonDevice.Type == DeviceType.AirSwitch) |
| | | { |
| | | if (device.IsCustomizeImage == false) |
| | | { |
| | |
| | | NameBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(200), |
| | | Width = Application.GetRealWidth(500), |
| | | Width = Application.GetRealWidth(600), |
| | | Height = Application.GetRealHeight(80), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | SelectedTextColor = ZigbeeColor.Current.GXCTextSelectedColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Tag = Tag, |
| | | TextSize=14 |
| | | TextSize = 14 |
| | | }; |
| | | AddChidren(NameBtn); |
| | | |
| | |
| | | //是否为当前设备 |
| | | if ((temperDevice?.DeviceEpoint != common.DeviceEpoint || temperDevice?.DeviceAddr != common.DeviceAddr) && (humidDevice?.DeviceEpoint != common.DeviceEpoint || humidDevice?.DeviceAddr != common.DeviceAddr) ) |
| | | { |
| | | //return; |
| | | return; |
| | | } |
| | | |
| | | //if (common.Type == DeviceType.TemperatureSensor) |
| | |
| | | var editRoom = new Device.Room.EditRoom(); |
| | | HomePage.Instance.AddChidren(editRoom); |
| | | HomePage.Instance.PageIndex += 1; |
| | | editRoom.temperDevice = this.temperDevice; |
| | | editRoom.humidDevice = this.humidDevice; |
| | | editRoom.Show(room); |
| | | editRoom.action += () => |
| | | { |
| | |
| | | //0 移除失败 |
| | | else if (removeSceneAllData.removeSceneData.Result == 0) |
| | | { |
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.FailedPleaseTryAgain); |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.FailedPleaseTryAgain)); |
| | | return; |
| | | } |
| | | //2 没有该场景 |
| | |
| | | room.RemoveScene(scene); |
| | | //RefreshBodyView(); |
| | | RemoveFromParent(); |
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.TheSceneIsNull); |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.TheSceneIsNull)); |
| | | return; |
| | | } |
| | | }; |
| | |
| | | { |
| | | return; |
| | | } |
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ControlSceneFail); |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.ControlSceneFail)); |
| | | } |
| | | |
| | | scene.RemainTime = scene.SceneDelayTime; |
| | |
| | | { |
| | | return; |
| | | } |
| | | CommonPage.Instance.ShowErrorInfoAlert(R.MyInternationalizationString.ControlSceneFail); |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.ControlSceneFail)); |
| | | } |
| | | |
| | | scene.RemainTime = scene.SceneDelayTime; |
| | |
| | | /// <summary> |
| | | /// SeekBar |
| | | /// </summary> |
| | | public HorizontalSeekBar SeekBar; |
| | | public DiyImageSeekBar SeekBar; |
| | | /// <summary> |
| | | /// SeekBarTitle |
| | | /// </summary> |
| | |
| | | }; |
| | | AddChidren(ClickButton); |
| | | |
| | | SeekBar = new HorizontalSeekBar() |
| | | SeekBar = new DiyImageSeekBar() |
| | | { |
| | | X = Application.GetRealWidth(81), |
| | | Y = Application.GetRealHeight(200), |
| | | Width = Application.GetRealWidth(919), |
| | | Height = Application.GetRealHeight(127), |
| | | BackgroundColor = ZigbeeColor.Current.GXCSeekBarBackground, |
| | | ProgressColor = ZigbeeColor.Current.GXCProgressColor, |
| | | ThumbColor = ZigbeeColor.Current.GXCBackgroundColor, |
| | | Max = MaxLevel, |
| | | Progress = MaxLevel |
| | | ProgressBarColor = ZigbeeColor.Current.GXCProgressColor, |
| | | MaxValue = MaxLevel, |
| | | Progress = MaxLevel, |
| | | IsProgressTextShow = false, |
| | | IsClickable = true, |
| | | ThumbImageHeight=Application.GetMinRealAverage(80), |
| | | SeekBarViewHeight=Application.GetRealHeight(6), |
| | | ThumbImagePath="Item/SeekBarIcon.png" |
| | | }; |
| | | AddChidren(SeekBar); |
| | | |
| | |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text = $"{(int)(SeekBar.Progress * 1.0 / MaxLevel * 100)} %", |
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor, |
| | | TextSize=12 |
| | | TextSize = 12, |
| | | IsBold = true |
| | | }; |
| | | AddChidren(SeekBarTitle); |
| | | |
| | |
| | | SelectBtn.Visible = statu; |
| | | if(statu) |
| | | { |
| | | SetProgress(100); |
| | | SetSeekBarProgress(SeekBar.Progress == 0 ? MaxLevel : SeekBar.Progress); |
| | | } |
| | | else |
| | | { |
| | | SetProgress(0); |
| | | SetSeekBarProgress(0); |
| | | } |
| | | } |
| | | |
| | |
| | | /// SetProgress |
| | | /// </summary> |
| | | /// <param name="progress"></param> |
| | | public void SetProgress(int progress) |
| | | public void SetSeekBarProgress(int progress) |
| | | { |
| | | SeekBar.Progress = progress; |
| | | SetSeekBarTitle(); |
| | |
| | | NameBtn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(173), |
| | | Width = Application.GetRealWidth(500), |
| | | Width = Application.GetRealWidth(600), |
| | | Height = Application.GetRealHeight(80), |
| | | Gravity = Gravity.CenterVertical, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | |
| | | public class SelectZone |
| | | { |
| | | public Action<Common.Room> ZoneAction; |
| | | |
| | | private UIPickerView pickView; |
| | | |
| | | private List<string> floorList = new List<string> { }; |
| | | private List<string> roomList = new List<string> { }; |
| | | private List<string> roomIdList = new List<string> { }; |
| | | /// <summary> |
| | | /// curRoom |
| | | /// </summary> |
| | | private Common.Room curRoom; |
| | | |
| | | public SelectZone() |
| | | { |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 标题 |
| | | /// </summary> |
| | | public string title = Language.StringByID(R.MyInternationalizationString.BelongZone); |
| | | /// <summary> |
| | | /// Init |
| | | /// </summary> |
| | |
| | | { |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | | { |
| | | floorIds.Add(floor.Key); |
| | | floorNames.Add(floor.Value); |
| | | if (Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count > 0) |
| | | { |
| | | floorIds.Add(floor.Key); |
| | | floorNames.Add(floor.Value); |
| | | |
| | | roomNames.Add(Common.Room.CurrentRoom.GetRoomNamesByFloorId(floor.Key)); |
| | | rooms.Add(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key)); |
| | | } |
| | |
| | | { |
| | | curRoom = rooms[index1][index2]; |
| | | ZoneAction?.Invoke(curRoom); |
| | | //RemoveFromParent(); |
| | | }, 0, 0, Language.StringByID(R.MyInternationalizationString.BelongFloor), |
| | | }, 0, 0, title, |
| | | Language.StringByID(R.MyInternationalizationString.Confrim), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | |
| | | { |
| | | curRoom = rs[index1]; |
| | | ZoneAction?.Invoke(curRoom); |
| | | //RemoveFromParent(); |
| | | }, 0, Language.StringByID(R.MyInternationalizationString.AddTo), |
| | | }, 0, title, |
| | | Language.StringByID(R.MyInternationalizationString.Confrim), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel)); |
| | | } |
| | | |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | | { |
| | | floorList.Add(floor.Value); |
| | | } |
| | | foreach (var room in Shared.Common.Room.Lists) |
| | | { |
| | | if(room.IsLove) |
| | | { |
| | | continue; |
| | | } |
| | | roomList.Add(room.Name); |
| | | roomIdList.Add(room.Id); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Close |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="mouseEventArgs"></param> |
| | | private void Close(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | //RemoveFromParent(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Confrim_MouseEvent |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="mouseEventArgs"></param> |
| | | private void Confrim_MouseEvent(object sender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | //ZoneAction?.Invoke(curRoom); |
| | | //RemoveFromParent(); |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<DeviceUI,Common.Room> action; |
| | | |
| | | /// <summary> |
| | | /// 收藏按钮 |
| | |
| | | { |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | ZigBee.Device.ZbGateway.StatusList.Remove(this); |
| | | //action(); |
| | | //action = null; |
| | | action(device,room); |
| | | action = null; |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (IsDrawerLockMode) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (de == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.EditAction = (d,r) => |
| | | detailInfo.EditAction += (curDev,curRoom) => |
| | | { |
| | | Show(device, room); |
| | | Show(curDev, curRoom); |
| | | }; |
| | | } |
| | | |
| | |
| | | namespace Shared.Phone.Device.Light |
| | | { |
| | | /// <summary> |
| | | /// 灯光控制界面 |
| | | /// 开关 |
| | | /// </summary> |
| | | public class AirSwitchControl : FrameLayout, ZigBee.Common.IStatus |
| | | { |
| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<DeviceUI, Common.Room> action; |
| | | |
| | | /// <summary> |
| | | /// The light image. |
| | |
| | | private FrameLayout bodyFrameLayout; |
| | | |
| | | private Button StatuBtn; |
| | | /// <summary> |
| | | /// OnBtn |
| | | /// </summary> |
| | | private Button OnBtn; |
| | | /// <summary> |
| | | /// OffBtn |
| | | /// </summary> |
| | | private Button OffBtn; |
| | | |
| | | /// <summary> |
| | | /// IsDrawerLockMode |
| | | /// </summary> |
| | | public bool IsDrawerLockMode; |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 接口__________________________ |
| | |
| | | { |
| | | if (common.DeviceStatusReport.CluterID == 6) |
| | | { |
| | | var light = deviceUI.CommonDevice as ZigBee.Device.AirSwitch; |
| | | var light = deviceUI.CommonDevice as AirSwitch; |
| | | light.DeviceStatusReport = common.DeviceStatusReport; |
| | | //记录、更新状态 |
| | | if (light.DeviceStatusReport.AttriBute == null || light.DeviceStatusReport.AttriBute.Count == 0) |
| | |
| | | return; |
| | | } |
| | | light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1; |
| | | StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {device.GetDeviceStatu()}"; |
| | | |
| | | if (device.CommonDevice.DfunctionType == DeviceFunctionType.A开关) |
| | | { |
| | | SetONOFFStatu(light.OnOffStatus == 1); |
| | | } |
| | | else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | | deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1; |
| | | } |
| | | else |
| | | { |
| | | deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1; |
| | | } |
| | | |
| | | |
| | | light.LastDateTime = DateTime.Now; |
| | | } |
| | | } |
| | |
| | | } |
| | | else if (typeTag == "OnlineStatusChange") |
| | | { |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | var deviceUI = device; |
| | | //设备为空 |
| | | if (deviceUI.CommonDevice == null) |
| | | { |
| | | return; |
| | | } |
| | | //是否为当前设备 |
| | | if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr) |
| | | { |
| | | return; |
| | | } |
| | | deviceUI.CommonDevice.IsOnline = common.IsOnline; |
| | | //OnBtn.IsSelected = OffBtn.IsSelected= deviceUI.CommonDevice.IsOnline == 1; |
| | | deviceUI.CommonDevice.LastDateTime = DateTime.Now; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | System.Console.WriteLine($"Error:{ex.Message}"); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | //action(); |
| | | //action = null; |
| | | action(device, room); |
| | | action = null; |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (IsDrawerLockMode) |
| | | { |
| | |
| | | AddBodyView(device); |
| | | |
| | | |
| | | var light = dev.CommonDevice as ZigBee.Device.AirSwitch; |
| | | var light = dev.CommonDevice as AirSwitch; |
| | | //补上非远程 |
| | | if (light.Gateway == null) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (de == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | Text = device.CommonDevice.DeviceEpointName, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 15, |
| | | IsBold=true |
| | | IsBold = true |
| | | }; |
| | | itemView.AddChidren(deviceNameBtn); |
| | | |
| | |
| | | TextSize = 10 |
| | | }; |
| | | itemView.AddChidren(StatuBtn); |
| | | |
| | | deviceIMG = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(389), |
| | | Width = Application.GetMinRealAverage(377), |
| | | Height = Application.GetMinRealAverage(435), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Light/DeskLamp.png", |
| | | SelectedImagePath = "Light/DeskLampSelected.png", |
| | | IsSelected = (device.CommonDevice as ZigBee.Device.AirSwitch).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(deviceIMG); |
| | | |
| | | switchBtn = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(996), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Item/Switch.png", |
| | | SelectedImagePath = "Item/SwitchSelected.png", |
| | | IsSelected = (device.CommonDevice as ZigBee.Device.AirSwitch).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(switchBtn); |
| | | |
| | | var roomBG = new Button |
| | | { |
| | |
| | | TextSize = 12 |
| | | }; |
| | | itemView.AddChidren(roomName); |
| | | |
| | | AddByFunctionType(itemView); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// AddByFunctionType |
| | | /// </summary> |
| | | private void AddByFunctionType(FrameLayout itemView) |
| | | { |
| | | if (device.CommonDevice.DfunctionType == DeviceFunctionType.A开关) |
| | | { |
| | | AddOnOff(itemView); |
| | | } |
| | | else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | | AddPlug(itemView); |
| | | } |
| | | else |
| | | { |
| | | AddLight(itemView); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// AddOnOff |
| | | /// </summary> |
| | | private void AddOnOff(FrameLayout itemView) |
| | | { |
| | | deviceIMG = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(340), |
| | | Width = Application.GetMinRealAverage(579), |
| | | Height = Application.GetMinRealAverage(579), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Light/OnOff.png", |
| | | }; |
| | | itemView.AddChidren(deviceIMG); |
| | | |
| | | OffBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(294), |
| | | Y = Application.GetRealHeight(588), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | UnSelectedImagePath = "Light/OFF.png", |
| | | SelectedImagePath = "Light/OFFSelected.png", |
| | | IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 0 |
| | | }; |
| | | itemView.AddChidren(OffBtn); |
| | | |
| | | OnBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(590), |
| | | Y = Application.GetRealHeight(588), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | UnSelectedImagePath = "Light/ON.png", |
| | | SelectedImagePath = "Light/ONSelected.png", |
| | | IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(OnBtn); |
| | | |
| | | OnBtn.MouseUpEventHandler += ON; |
| | | OffBtn.MouseUpEventHandler += OFF; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// light |
| | | /// </summary> |
| | | /// <param name="itemView"></param> |
| | | private void AddLight(FrameLayout itemView) |
| | | { |
| | | deviceIMG = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(389), |
| | | Width = Application.GetMinRealAverage(377), |
| | | Height = Application.GetMinRealAverage(435), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Light/DeskLamp.png", |
| | | SelectedImagePath = "Light/DeskLampSelected.png", |
| | | IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(deviceIMG); |
| | | |
| | | switchBtn = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(996), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Item/Switch.png", |
| | | SelectedImagePath = "Item/SwitchSelected.png", |
| | | IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(switchBtn); |
| | | |
| | | switchBtn.MouseUpEventHandler += Switch; |
| | | deviceIMG.MouseUpEventHandler += Switch; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// plug |
| | | /// </summary> |
| | | /// <param name="itemView"></param> |
| | | private void AddPlug(FrameLayout itemView) |
| | | { |
| | | deviceIMG = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(344), |
| | | Width = Application.GetMinRealAverage(567), |
| | | Height = Application.GetMinRealAverage(567), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Light/Plug.png", |
| | | SelectedImagePath = "Light/PlugSelected.png", |
| | | IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(deviceIMG); |
| | | |
| | | switchBtn = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(996), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Item/Switch.png", |
| | | SelectedImagePath = "Item/SwitchSelected.png", |
| | | IsSelected = (device.CommonDevice as AirSwitch).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(switchBtn); |
| | | |
| | | switchBtn.MouseUpEventHandler += Switch; |
| | | deviceIMG.MouseUpEventHandler += Switch; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// </summary> |
| | | private void BindEvent() |
| | | { |
| | | switchBtn.MouseUpEventHandler += Switch; |
| | | deviceIMG.MouseUpEventHandler += Switch; |
| | | collectionBtn.MouseUpEventHandler += Collection; |
| | | } |
| | | |
| | |
| | | switchBtn.IsSelected = !switchBtn.IsSelected; |
| | | deviceIMG.IsSelected = !deviceIMG.IsSelected; |
| | | StatuBtn.Text = deviceIMG.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Open)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; |
| | | |
| | | if (switchBtn.IsSelected == true) |
| | | { |
| | | (device.CommonDevice as ZigBee.Device.AirSwitch).SwitchControl(1); |
| | | (device.CommonDevice as AirSwitch).SwitchControl(1); |
| | | } |
| | | else |
| | | { |
| | | (device.CommonDevice as ZigBee.Device.AirSwitch).SwitchControl(0); |
| | | (device.CommonDevice as AirSwitch).SwitchControl(0); |
| | | } |
| | | //控制延时回调 |
| | | DeviceUI.SendCommandDelayAction(device.CommonDevice, () => |
| | |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ON |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="eventArgs"></param> |
| | | private void ON(object sender, MouseEventArgs eventArgs) |
| | | { |
| | | SetONOFFStatu(true); |
| | | (device.CommonDevice as AirSwitch).SwitchControl(1); |
| | | //控制延时回调 |
| | | zbGateway.ReportAction += UpdateDeviceControllStatu; |
| | | DeviceUI.SendCommandDelayAction(device.CommonDevice, () => |
| | | { |
| | | if (Parent == null) |
| | | { |
| | | return; |
| | | } |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (sendedControlCommand == false) |
| | | { |
| | | DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | } |
| | | }); |
| | | } |
| | | /// <summary> |
| | | /// OFF |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="eventArgs"></param> |
| | | private void OFF(object sender, MouseEventArgs eventArgs) |
| | | { |
| | | SetONOFFStatu(false); |
| | | (device.CommonDevice as AirSwitch).SwitchControl(0); |
| | | //控制延时回调 |
| | | zbGateway.ReportAction += UpdateDeviceControllStatu; |
| | | DeviceUI.SendCommandDelayAction(device.CommonDevice, () => |
| | | { |
| | | if (Parent == null) |
| | | { |
| | | return; |
| | | } |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (sendedControlCommand == false) |
| | | { |
| | | DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// SetONOFFStatu |
| | | /// </summary> |
| | | /// <param name="statu"></param> |
| | | private void SetONOFFStatu(bool statu) |
| | | { |
| | | if (statu) |
| | | { |
| | | OnBtn.IsSelected = true; |
| | | OffBtn.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | OnBtn.IsSelected = false; |
| | | OffBtn.IsSelected = true; |
| | | } |
| | | StatuBtn.Text = statu ? $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Open)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.EditAction = (d,r) => |
| | | detailInfo.EditAction += (curDev, curRoom) => |
| | | { |
| | | Show(device, room); |
| | | Show(curDev, curRoom); |
| | | }; |
| | | } |
| | | |
| | |
| | | /// <param name="e">E.</param> |
| | | private void Collection(object sender, MouseEventArgs e) |
| | | { |
| | | //collection |
| | | if ((sender as Button).IsSelected) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(device.FileName); |
| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<DeviceUI, Common.Room> action; |
| | | ///// <summary> |
| | | ///// The top view. |
| | | ///// </summary> |
| | |
| | | { |
| | | dimmableLight = deviceUI.CommonDevice as DimmableLight; |
| | | dimmableLight.DeviceStatusReport = common.DeviceStatusReport; |
| | | //记录、更新状态 |
| | | if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | return; |
| | |
| | | if (switchBtn.IsSelected == true) |
| | | { |
| | | levelSeekBar.IsClickable = true; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; |
| | | //levelSeekBar.Progress = 100; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); |
| | | } |
| | | else |
| | | { |
| | | levelSeekBar.IsClickable = false; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; |
| | | //levelSeekBar.Progress = 0; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); |
| | | } |
| | | //change color |
| | | dimmableLight.LastDateTime = DateTime.Now; |
| | | } |
| | | //亮度 |
| | |
| | | dimmableLight.LastDateTime = DateTime.Now; |
| | | levelSeekBar.Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100); |
| | | StatuBtn.Text = switchBtn.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} { device.GetDeviceStatu()}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; |
| | | |
| | | break; |
| | | } |
| | | } |
| | |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | //action(); |
| | | //action = null; |
| | | action(device, room); |
| | | action = null; |
| | | if (IsDrawerLockMode) |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = false; |
| | |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.EditAction = (d,r) => |
| | | detailInfo.EditAction += (curDev, curRoom) => |
| | | { |
| | | Show(device, room); |
| | | Show(curDev, curRoom); |
| | | }; |
| | | } |
| | | |
| | |
| | | WavePadding = Application.GetRealWidth(8), |
| | | MaxValue=100, |
| | | Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100), |
| | | WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor, |
| | | |
| | | CornerRadius= Application.GetRealHeight(58) |
| | | }; |
| | | |
| | |
| | | if (dimmableLight.OnOffStatus == 1) |
| | | { |
| | | levelSeekBar.IsClickable = true; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); |
| | | } |
| | | else |
| | | { |
| | | levelSeekBar.IsClickable = false; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); |
| | | } |
| | | |
| | | levelSeekBar.OnStartTrackingTouchEvent += (sender, e) => |
| | |
| | | { |
| | | ProgressBtn.Visible = false; |
| | | levelSeekBar.IsProgressTextShow = true; |
| | | dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); |
| | | }; |
| | | |
| | | levelSeekBar.OnProgressChangedEvent += (send2, e2) => |
| | |
| | | OnProgressButtonMove(e2); |
| | | |
| | | //判断是否300ms屏蔽 |
| | | if (levelSeekBar.IsProgressChangeDelay()) return; |
| | | |
| | | dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); |
| | | //if (levelSeekBar.IsProgressChangeDelay()) return; |
| | | //dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); |
| | | }; |
| | | |
| | | InitProgressBtn(itemView); |
| | | |
| | | InitProgressBtn(itemView); |
| | | |
| | |
| | | Height = Application.GetMinReal(104), |
| | | UnSelectedImagePath = "Item/ProgressBubbles.png", |
| | | Visible = false, |
| | | Gravity = Gravity.CenterHorizontal |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextSize = 14, |
| | | IsBold = true, |
| | | TextColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | }; |
| | | layout.AddChidren(ProgressBtn); |
| | | } |
| | |
| | | { |
| | | dimmableLight.SwitchControl(1); |
| | | levelSeekBar.IsClickable = true; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); |
| | | } |
| | | else |
| | | { |
| | | dimmableLight.SwitchControl(0); |
| | | levelSeekBar.IsClickable = false; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); |
| | | } |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | private void InitCollection() |
| | | { |
| | | var dev = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (dev == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<DeviceUI, Common.Room> action; |
| | | |
| | | /// <summary> |
| | | /// The light image. |
| | |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | //action(); |
| | | //action = null; |
| | | action(device, room); |
| | | action = null; |
| | | if (IsDrawerLockMode) |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = false; |
| | |
| | | } |
| | | } |
| | | |
| | | var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (de == null) |
| | | if(Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.EditAction = (d,r) => |
| | | detailInfo.EditAction += (curDev, curRoom) => |
| | | { |
| | | Show(device, room); |
| | | Show(curDev, curRoom); |
| | | }; |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<DeviceUI, Common.Room> action; |
| | | |
| | | /// <summary> |
| | | /// The light image. |
| | |
| | | return; |
| | | } |
| | | light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | SetONOFFStatu(light.OnOffStatus == 1); |
| | | StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {device.GetDeviceStatu()}"; |
| | | |
| | | if (device.CommonDevice.DfunctionType == DeviceFunctionType.A开关) |
| | | { |
| | | SetONOFFStatu(light.OnOffStatus == 1); |
| | | } |
| | | else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | | deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1; |
| | | } |
| | | else |
| | | { |
| | | deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1; |
| | | } |
| | | |
| | | |
| | | light.LastDateTime = DateTime.Now; |
| | | } |
| | | } |
| | |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | //action(); |
| | | //action = null; |
| | | action(device, room); |
| | | action = null; |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (IsDrawerLockMode) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (de == null) |
| | | if(Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | }; |
| | | itemView.AddChidren(StatuBtn); |
| | | |
| | | deviceIMG = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(340), |
| | | Width = Application.GetMinRealAverage(579), |
| | | Height = Application.GetMinRealAverage(579), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Light/OnOff.png", |
| | | }; |
| | | itemView.AddChidren(deviceIMG); |
| | | |
| | | OffBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(294), |
| | | Y = Application.GetRealHeight(588), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | UnSelectedImagePath = "Light/OFF.png", |
| | | SelectedImagePath = "Light/OFFSelected.png", |
| | | IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 0 |
| | | }; |
| | | itemView.AddChidren(OffBtn); |
| | | |
| | | OnBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(590), |
| | | Y = Application.GetRealHeight(588), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | UnSelectedImagePath = "Light/ON.png", |
| | | SelectedImagePath = "Light/ONSelected.png", |
| | | IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(OnBtn); |
| | | |
| | | var roomBG = new Button |
| | | { |
| | | Y = Application.GetRealHeight(1178 - 50), |
| | |
| | | TextSize = 12 |
| | | }; |
| | | itemView.AddChidren(roomName); |
| | | |
| | | AddByFunctionType(itemView); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// AddByFunctionType |
| | | /// </summary> |
| | | private void AddByFunctionType(FrameLayout itemView) |
| | | { |
| | | if(device.CommonDevice.DfunctionType == DeviceFunctionType.A开关) |
| | | { |
| | | AddOnOff(itemView); |
| | | } |
| | | else if(device.CommonDevice.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | | AddPlug(itemView); |
| | | } |
| | | else |
| | | { |
| | | AddLight(itemView); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// AddOnOff |
| | | /// </summary> |
| | | private void AddOnOff(FrameLayout itemView) |
| | | { |
| | | deviceIMG = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(340), |
| | | Width = Application.GetMinRealAverage(579), |
| | | Height = Application.GetMinRealAverage(579), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Light/OnOff.png", |
| | | }; |
| | | itemView.AddChidren(deviceIMG); |
| | | |
| | | OffBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(294), |
| | | Y = Application.GetRealHeight(588), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | UnSelectedImagePath = "Light/OFF.png", |
| | | SelectedImagePath = "Light/OFFSelected.png", |
| | | IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 0 |
| | | }; |
| | | itemView.AddChidren(OffBtn); |
| | | |
| | | OnBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(590), |
| | | Y = Application.GetRealHeight(588), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | UnSelectedImagePath = "Light/ON.png", |
| | | SelectedImagePath = "Light/ONSelected.png", |
| | | IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(OnBtn); |
| | | |
| | | OnBtn.MouseUpEventHandler += ON; |
| | | OffBtn.MouseUpEventHandler += OFF; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// light |
| | | /// </summary> |
| | | /// <param name="itemView"></param> |
| | | private void AddLight(FrameLayout itemView) |
| | | { |
| | | deviceIMG = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(389), |
| | | Width = Application.GetMinRealAverage(377), |
| | | Height = Application.GetMinRealAverage(435), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Light/DeskLamp.png", |
| | | SelectedImagePath = "Light/DeskLampSelected.png", |
| | | IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(deviceIMG); |
| | | |
| | | switchBtn = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(996), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Item/Switch.png", |
| | | SelectedImagePath = "Item/SwitchSelected.png", |
| | | IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(switchBtn); |
| | | |
| | | switchBtn.MouseUpEventHandler += Switch; |
| | | deviceIMG.MouseUpEventHandler += Switch; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// plug |
| | | /// </summary> |
| | | /// <param name="itemView"></param> |
| | | private void AddPlug(FrameLayout itemView) |
| | | { |
| | | deviceIMG = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(344), |
| | | Width = Application.GetMinRealAverage(567), |
| | | Height = Application.GetMinRealAverage(567), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Light/Plug.png", |
| | | SelectedImagePath = "Light/PlugSelected.png", |
| | | IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(deviceIMG); |
| | | |
| | | switchBtn = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(996), |
| | | Width = Application.GetMinRealAverage(81), |
| | | Height = Application.GetMinRealAverage(81), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Item/Switch.png", |
| | | SelectedImagePath = "Item/SwitchSelected.png", |
| | | IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(switchBtn); |
| | | |
| | | switchBtn.MouseUpEventHandler += Switch; |
| | | deviceIMG.MouseUpEventHandler += Switch; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// </summary> |
| | | private void BindEvent() |
| | | { |
| | | OnBtn.MouseUpEventHandler += ON; |
| | | OffBtn.MouseUpEventHandler += OFF; |
| | | collectionBtn.MouseUpEventHandler += Collection; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="sender">Sender.</param> |
| | | /// <param name="eventArgs">Event arguments.</param> |
| | | //private void Switch(object sender, MouseEventArgs eventArgs) |
| | | //{ |
| | | // sendedControlCommand = false; |
| | | // zbGateway.ReportAction += UpdateDeviceControllStatu; |
| | | // switchBtn.IsSelected = !switchBtn.IsSelected; |
| | | // deviceIMG.IsSelected = !deviceIMG.IsSelected; |
| | | // StatuBtn.Text = CommonFormResouce.GetSwitchStatu(deviceIMG.IsSelected); |
| | | // if (switchBtn.IsSelected == true) |
| | | // { |
| | | // (device.CommonDevice as ToggleLight).SwitchControl(1); |
| | | // } |
| | | // else |
| | | // { |
| | | // (device.CommonDevice as ToggleLight).SwitchControl(0); |
| | | // } |
| | | // //控制延时回调 |
| | | // DeviceUI.SendCommandDelayAction(device.CommonDevice, () => |
| | | // { |
| | | // if (Parent == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // RemoveUpdateControlDeviceStatuAction(); |
| | | // if (sendedControlCommand == false) |
| | | // { |
| | | // DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | // } |
| | | // }); |
| | | //} |
| | | private void Switch(object sender, MouseEventArgs eventArgs) |
| | | { |
| | | sendedControlCommand = false; |
| | | zbGateway.ReportAction += UpdateDeviceControllStatu; |
| | | switchBtn.IsSelected = !switchBtn.IsSelected; |
| | | deviceIMG.IsSelected = !deviceIMG.IsSelected; |
| | | StatuBtn.Text = deviceIMG.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Open)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; |
| | | |
| | | if (switchBtn.IsSelected == true) |
| | | { |
| | | (device.CommonDevice as ToggleLight).SwitchControl(1); |
| | | } |
| | | else |
| | | { |
| | | (device.CommonDevice as ToggleLight).SwitchControl(0); |
| | | } |
| | | //控制延时回调 |
| | | DeviceUI.SendCommandDelayAction(device.CommonDevice, () => |
| | | { |
| | | if (Parent == null) |
| | | { |
| | | return; |
| | | } |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (sendedControlCommand == false) |
| | | { |
| | | DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ON |
| | |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.EditAction = (d,r) => |
| | | detailInfo.EditAction += (curDev, curRoom) => |
| | | { |
| | | Show(device, room); |
| | | Show(curDev, curRoom); |
| | | }; |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<DeviceUI, Common.Room> action; |
| | | |
| | | /// <summary> |
| | | /// The light image. |
| | |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | //action(); |
| | | //action = null; |
| | | action(device, room); |
| | | action = null; |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (IsDrawerLockMode) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (de == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.EditAction = (d,r) => |
| | | detailInfo.EditAction += (curDev, curRoom) => |
| | | { |
| | | Show(device, room); |
| | | Show(curDev, curRoom); |
| | | }; |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | public int OldIconPathType; |
| | | |
| | | CommonDevice temperDevice; |
| | | public CommonDevice temperDevice; |
| | | |
| | | CommonDevice humidDevice; |
| | | public CommonDevice humidDevice; |
| | | |
| | | DeviceInfoRow temperatureRow; |
| | | |
| | |
| | | //是否为当前设备 |
| | | if ((temperDevice?.DeviceEpoint != common.DeviceEpoint || temperDevice?.DeviceAddr != common.DeviceAddr) && (humidDevice?.DeviceEpoint != common.DeviceEpoint || humidDevice?.DeviceAddr != common.DeviceAddr)) |
| | | { |
| | | //return; |
| | | return; |
| | | } |
| | | |
| | | //if (common.Type == DeviceType.TemperatureSensor) |
| | |
| | | }; |
| | | bodyFrameLayout.AddChidren(backGround1); |
| | | |
| | | |
| | | backGround = new ImageView() |
| | | { |
| | | Y = Application.GetRealHeight(60), |
| | |
| | | return; |
| | | } |
| | | room.TemperatrueDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}"; |
| | | temperDevice=Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice); |
| | | temperatureRow.SetTitle(R.MyInternationalizationString.Getting); |
| | | //发送获取温度的命令 |
| | | ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(selectTemp); |
| | |
| | | { |
| | | temperatureRow.SetTitle(room.Temperatrue == 0 ? "--℃" : $"{room.Temperatrue}℃"); |
| | | //发送获取温度的命令 |
| | | var dev = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(dev); |
| | | temperDevice = Common.LocalDevice.Current.GetDevice(room.TemperatrueDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendTemperatureStatuComand(temperDevice); |
| | | } |
| | | else |
| | | { |
| | |
| | | return; |
| | | } |
| | | room.HumidityDevice = $"{selectTemp.DeviceAddr}{selectTemp.DeviceEpoint}"; |
| | | humidDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice); |
| | | humidityRow.SetTitle(R.MyInternationalizationString.Getting); |
| | | |
| | | //发送获取湿度的命令 |
| | |
| | | { |
| | | humidityRow.SetTitle(room.Humidity == 0 ? "--%" : $"{room.Humidity}%"); |
| | | //发送获取湿度的命令 |
| | | var dev = Common.LocalDevice.Current.GetDevice(room.HumidityDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendHumidityStatuComand(dev); |
| | | humidDevice = Common.LocalDevice.Current.GetDevice(room.HumidityDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendHumidityStatuComand(humidDevice); |
| | | } |
| | | else |
| | | { |
| | |
| | | if (Config.Instance.Home.FloorDics.Count == 0 || room.IsLove) |
| | | { |
| | | temperatureRow.Y = Application.GetRealHeight(308); |
| | | humidityRow.Y= Application.GetRealHeight(446); |
| | | humidityRow.Y = Application.GetRealHeight(446); |
| | | } |
| | | |
| | | var confirm = new Device.CommonForm.CompleteButton(1700, 900, 127); |
| | |
| | | //通过相机拍照裁剪 |
| | | CropImage.TakePicture((imagePath) => |
| | | {
|
| | | if (string.IsNullOrEmpty(imagePath) == true)
|
| | | if (string.IsNullOrEmpty(imagePath))
|
| | | {
|
| | | return;
|
| | | } |
| | |
| | | //从相册选择图片裁剪 |
| | | CropImage.SelectPicture((imagePath) => |
| | | { |
| | | if (string.IsNullOrEmpty(imagePath) == true)
|
| | | if (string.IsNullOrEmpty(imagePath))
|
| | | {
|
| | | return;
|
| | | } |
| | |
| | | /// </summary> |
| | | public void Show() |
| | | { |
| | | RemoveAll(); |
| | | InitData(); |
| | | AddTop(); |
| | | AddBodyView(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | add.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var selectZone = new SelectZone(); |
| | | //AddChidren(selectZone); |
| | | selectZone.title = Language.StringByID(R.MyInternationalizationString.AddTo); |
| | | selectZone.Init(); |
| | | selectZone.ZoneAction = (r) => |
| | | selectZone.ZoneAction += (r) => |
| | | { |
| | | foreach (var d in selectedList) |
| | | { |
| | |
| | | add.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var selectZone = new SelectZone(); |
| | | //CommonPage.Instance.AddChidren(selectZone); |
| | | selectZone.title = Language.StringByID(R.MyInternationalizationString.AddTo); |
| | | selectZone.Init(); |
| | | selectZone.ZoneAction = (r) => |
| | | selectZone.ZoneAction += (r) => |
| | | { |
| | | foreach (var s in selectedList) |
| | | { |
| | |
| | | /// <summary>
|
| | | /// 简约面板震动功能
|
| | | /// </summary>
|
| | | A简约面板震动功能 = 12
|
| | | A简约面板震动功能 = 12,
|
| | | /// <summary>
|
| | | /// 空调摆风功能
|
| | | /// </summary>
|
| | | A空调摆风功能 = 13,
|
| | | }
|
| | | }
|
old mode 100644
new mode 100755
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | string strMsg = reportInfo.AlarmMsg;
|
| | | if (reportInfo.DemolishmenMsg != null)
|
| | | {
|
| | | //被拆报警
|
| | | strMsg = reportInfo.DemolishmenMsg;
|
| | | }
|
| | | else if (reportInfo.BatteryMsg != null)
|
| | | {
|
| | | //电池报警
|
| | | strMsg = reportInfo.BatteryMsg;
|
| | | }
|
| | | if (strMsg == null || strMsg == string.Empty)
|
| | | {
|
| | | //不是在册的报警消息
|
| | | return;
|
| | | }
|
| | |
|
| | | //在线状态的控件隐藏
|
| | | btnOnline.Visible = false;
|
| | |
|
| | |
| | | btnMsg.Y = Application.GetRealHeight(141);
|
| | | this.AddChidren(btnMsg);
|
| | | }
|
| | | if (reportInfo.DemolishmenMsg != null)
|
| | | {
|
| | | btnMsg.Text = reportInfo.DemolishmenMsg;
|
| | | }
|
| | | else if (reportInfo.BatteryMsg != null)
|
| | | {
|
| | | btnMsg.Text = reportInfo.BatteryMsg;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnMsg.Text = reportInfo.AlarmMsg;
|
| | | }
|
| | | btnMsg.Text = strMsg;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | {
|
| | | if (dataInfo.PageData[i].IsReading == false)
|
| | | {
|
| | | if (dataInfo.PageData[i].Topic == "/DoorLock/DoorLockOperatingEventNotificationCommand")
|
| | | {
|
| | | //暂时不处理这个主题
|
| | | continue;
|
| | | }
|
| | | ControlCommonResourse.HadNewMessage = true;
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | |
| | | public ScenePictrueControl()
|
| | | {
|
| | | this.UseClickStatu = false;
|
| | | this.Height = Application.GetRealHeight(470);
|
| | | this.Height = Application.GetRealHeight(420);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | var btnPic = new ImageView();
|
| | | btnPic.X = Application.GetRealWidth(179);
|
| | | btnPic.Width = Application.GetRealWidth(844);
|
| | | btnPic.Height = Application.GetRealHeight(420);
|
| | | btnPic.Height = Application.GetRealHeight(397);
|
| | | if (sceneUI.IconPathType == 0)
|
| | | {
|
| | | btnPic.ImagePath = sceneUI.IconPath;
|
| | |
| | | this.zbGateway.ReportAction += receiveAction;
|
| | |
|
| | | //读取空调模块版本
|
| | | var result = await deviceAc.ReadACFirewareVersionAsync();
|
| | | var result = await HdlDeviceAirConditionerLogic.Current.ReadACFirewareVersionAsync(deviceAc);
|
| | | if (result == null || result.readACFirewareVersionResponData == null || result.readACFirewareVersionResponData.Status != 0)
|
| | | {
|
| | | //获取空调模块版本失败
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | //发送升级通知
|
| | | var result2 = await deviceAc.UpggradeACNotificationAsync(result.readACFirewareVersionResponData.FirewareVersion, this.deviceFirmwareByte.Length);
|
| | | var result2 = await HdlDeviceAirConditionerLogic.Current.UpggradeACNotificationAsync(deviceAc, result.readACFirewareVersionResponData.FirewareVersion, this.deviceFirmwareByte.Length);
|
| | | if (result2.responseData == null)
|
| | | {
|
| | | //发送升级命令失败
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | else if (result2.responseData.status == 1)
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | else if (result2.responseData.status != 0)
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | await System.Threading.Tasks.Task.Delay(1000);
|
| | |
| | | /// <summary>
|
| | | /// 执行设备升级操作
|
| | | /// </summary>
|
| | | private async void DoSetUpdateDevice(string i_offset,int i_dataLength)
|
| | | private async void DoSetUpdateDevice(string i_offset, int i_dataLength)
|
| | | {
|
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateReady;
|
| | | //设备正在升级…
|
| | |
| | | this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | | //发送失败给设备
|
| | | deviceAc.SendFinishAsync(1);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
|
| | | return;
|
| | | }
|
| | | await System.Threading.Tasks.Task.Delay(50);
|
| | |
| | | }
|
| | | }
|
| | | //发送透传数据
|
| | | var sendData = new AC.SendUpgradeData() { dataLength = i_dataLength, offset = i_offset };
|
| | | var sendData = new HdlDeviceAirConditionerLogic.SendUpgradeData() { dataLength = i_dataLength, offset = i_offset };
|
| | | sendData.databytes = listData.ToArray();
|
| | | deviceAc.UpgradeAsync(sendData);
|
| | | HdlDeviceAirConditionerLogic.Current.UpgradeAsync(deviceAc, sendData);
|
| | | }
|
| | | this.zbGateway.ReportAction -= receiveAction;
|
| | |
|
| | |
| | | this.UpdateStatuChangedEvent?.Invoke(0, Language.StringByID(R.MyInternationalizationString.uSendingFinishUpdateComand));
|
| | |
|
| | | //发送成功命令给设备
|
| | | deviceAc.SendFinishAsync(0);
|
| | | HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 0);
|
| | |
|
| | | //等个两秒钟吧
|
| | | await System.Threading.Tasks.Task.Delay(2000);
|
| | |
| | | using System;
|
| | | using Newtonsoft.Json.Linq;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using System.Threading.Tasks;
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 设置启用空调的摆风功能_____________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置启用空调的摆风功能
|
| | | /// </summary>
|
| | | /// <param name="device">空调对象</param>
|
| | | /// <param name="data">从二进制转换的十进制值</param>
|
| | | /// <returns></returns>
|
| | | public async Task<bool> SetUseAcSwingFunctionStatu(AC device, int data)
|
| | | {
|
| | | var result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(device, 514, 4097, 25, data.ToString());
|
| | | //检测网关返回的共通错误状态码
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|
| | | {
|
| | | this.ShowTipMsg(error);
|
| | | return false;
|
| | | }
|
| | | if (result == null || result.setWritableValueResponData == null)
|
| | | {
|
| | | //设置空调摆风失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetAirConditionerSwingFunctionFail);
|
| | | //拼接上【网关回复超时】的Msg
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
|
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | | if (result.setWritableValueResponData.Status != 0)
|
| | | {
|
| | | //设置空调摆风失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetAirConditionerSwingFunctionFail);
|
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A空调摆风功能, data);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | |
|
| | | #region ■ 升级空调第三方模块的接口___________
|
| | |
|
| | | #region 读取IRACC模块固件版本(APP -> Zigbee MCU)
|
| | | ///<summary >
|
| | | ///读取IRACC模块固件版本
|
| | | /// </summary>
|
| | | public async System.Threading.Tasks.Task<ReadACFirewareVersionResponAllData> ReadACFirewareVersionAsync(CommonDevice device)
|
| | | {
|
| | | ReadACFirewareVersionResponAllData result = null;
|
| | | var Gateway = device.Gateway;
|
| | | if (Gateway == null)
|
| | | {
|
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "当前没有网关" };
|
| | | return result;
|
| | | }
|
| | | return await System.Threading.Tasks.Task.Run(async () =>
|
| | | {
|
| | | Action<string, string> action = (topic, message) =>
|
| | | {
|
| | | var gatewayID = topic.Split('/')[0];
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
|
| | |
|
| | | if (topic == gatewayID + "/" + "ZbDataPassthrough")
|
| | | {
|
| | | var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
|
| | | gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString());
|
| | |
|
| | | if (gatewayTemp.clientDataPassthroughResponseData == null)
|
| | | {
|
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "网关返回的数据为空" };
|
| | | }
|
| | | else
|
| | | {
|
| | | if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
|
| | | {
|
| | | var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
|
| | | var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
|
| | | if (command == "0259")
|
| | | {
|
| | | var tempD = new ReadACFirewareVersionResponData();
|
| | | tempD.Status = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16);
|
| | | if (data.Length == 82)
|
| | | {
|
| | | var firewareString = data.Substring(12);
|
| | | var aa = firewareString.Length;
|
| | | firewareVersion = firewareString;
|
| | | var bytes = new byte[firewareString.Length / 2];
|
| | | for (int i = 0; i < bytes.Length; i++)
|
| | | {
|
| | | bytes[i] = Convert.ToByte(firewareString.Substring(i * 2, 2), 16);
|
| | | }
|
| | |
|
| | | var firewareVersionTemp = System.Text.Encoding.ASCII.GetString(bytes);
|
| | | tempD.FirewareVersion = firewareVersionTemp.Replace('\0', ' ').Trim();
|
| | | }
|
| | | result = new ReadACFirewareVersionResponAllData { readACFirewareVersionResponData = tempD };
|
| | | System.Console.WriteLine($"UI收到通知后的主题_command:0258_{topic}");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | };
|
| | |
|
| | | Gateway.Actions += action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString());
|
| | |
|
| | | try
|
| | | {
|
| | | var passData = ReadACFirewareVersionData("01");
|
| | | var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | | var data = new JObject { { "PassData", passData } };
|
| | | jObject.Add("Data", data);
|
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
|
| | | }
|
| | | catch { }
|
| | |
|
| | | var dateTime = DateTime.Now;
|
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < 3000)
|
| | | {
|
| | | await System.Threading.Tasks.Task.Delay(10);
|
| | | if (result != null)
|
| | | {
|
| | | break;
|
| | | }
|
| | | }
|
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > 3000)
|
| | | {
|
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = " 回复超时,请重新操作" };
|
| | | }
|
| | | Gateway.Actions -= action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString());
|
| | |
|
| | | return result;
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 读取IRACC模块固件版本
|
| | | /// </summary>
|
| | | string ReadACFirewareVersionData(string reserve)
|
| | | {
|
| | | string data = "";
|
| | | string dataLength = "05";
|
| | | string dataComand1 = "58";
|
| | | string dataComand2 = "02";
|
| | | string dataSerialNum = "01";
|
| | | string addDataLength = "01";
|
| | | string reserveData = reserve;
|
| | |
|
| | | try
|
| | | {
|
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
|
| | | reserveData;
|
| | | }
|
| | | catch { };
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// IRACC模块固件版本,网关反馈信息
|
| | | /// </summary>
|
| | | public ReadACFirewareVersionResponAllData readACFirewareVersionResponAllData;
|
| | | /// <summary>
|
| | | /// IRACC模块固件版本,网关反馈信息
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class ReadACFirewareVersionResponAllData
|
| | | {
|
| | | /// <summary>
|
| | | /// 错误信息
|
| | | /// </summary>
|
| | | public string errorMessageBase;
|
| | | /// <summary>
|
| | | /// 网关信息错误反馈
|
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
| | | /// </summary>
|
| | | public CommonDevice.ErrorResponData errorResponData;
|
| | | /// <summary>
|
| | | /// IRACC模块固件版本信息
|
| | | /// </summary>
|
| | | public ReadACFirewareVersionResponData readACFirewareVersionResponData;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// IRACC模块固件版本的数据
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class ReadACFirewareVersionResponData
|
| | | {
|
| | | /// <summary>
|
| | | /// 状态
|
| | | ///<para>0--成功</para>
|
| | | ///<para>1--失败</para>
|
| | | ///<para>ff--无效</para>
|
| | | /// </summary>
|
| | | public int Status;
|
| | | /// <summary>
|
| | | /// 固件版本
|
| | | /// </summary>
|
| | | public string FirewareVersion;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 升级IRACC模块通知(APP -> Zigbee MCU)
|
| | | ///<summary >
|
| | | ///升级IRACC模块通知
|
| | | /// <para>firewareVer:固件版本</para>
|
| | | /// <para>firewareSize:固件大小</para>
|
| | | /// </summary>
|
| | | public async System.Threading.Tasks.Task<ResponseAllData> UpggradeACNotificationAsync(CommonDevice device, string firewareVer, long firewareSize)
|
| | | {
|
| | | ResponseAllData result = null;
|
| | | var Gateway = device.Gateway;
|
| | | if (Gateway == null)
|
| | | {
|
| | | result = new ResponseAllData { errorMessageBase = "当前没有网关" };
|
| | | return result;
|
| | | }
|
| | | return await System.Threading.Tasks.Task.Run(async () =>
|
| | | {
|
| | | Action<string, string> action = (topic, message) =>
|
| | | {
|
| | | var gatewayID = topic.Split('/')[0];
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
|
| | |
|
| | | if (topic == gatewayID + "/" + "ZbDataPassthrough")
|
| | | {
|
| | | var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
|
| | | gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString());
|
| | |
|
| | | if (gatewayTemp.clientDataPassthroughResponseData == null)
|
| | | {
|
| | | result = new ResponseAllData { errorMessageBase = "网关返回的数据为空" };
|
| | | }
|
| | | else
|
| | | {
|
| | | if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
|
| | | {
|
| | | var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
|
| | | var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
|
| | | if (command == "025b")
|
| | | {
|
| | | var tempD = new ResponseData();
|
| | | if (data.Length == 12)
|
| | | {
|
| | | tempD.status = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16);
|
| | | }
|
| | | result = new ResponseAllData { responseData = tempD };
|
| | | System.Console.WriteLine($"UI收到通知后的主题_{ topic}");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | };
|
| | |
|
| | | Gateway.Actions += action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString());
|
| | |
|
| | | try
|
| | | {
|
| | | var passData = UpggradeACNotificationData(firewareVer, firewareSize);
|
| | | var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | | var data = new JObject { { "PassData", passData } };
|
| | | jObject.Add("Data", data);
|
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
|
| | | }
|
| | | catch { }
|
| | |
|
| | | var dateTime = DateTime.Now;
|
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < 3000)
|
| | | {
|
| | | await System.Threading.Tasks.Task.Delay(10);
|
| | | if (result != null)
|
| | | {
|
| | | break;
|
| | | }
|
| | | }
|
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > 3000)
|
| | | {
|
| | | result = new ResponseAllData { errorMessageBase = " 回复超时,请重新操作" };
|
| | | }
|
| | | Gateway.Actions -= action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString());
|
| | |
|
| | | return result;
|
| | | });
|
| | | }
|
| | |
|
| | | private string firewareVersion = string.Empty;
|
| | | /// <summary>
|
| | | /// 升级IRACC模块通知返回
|
| | | /// </summary>
|
| | | string UpggradeACNotificationData(string firewareVer, long firewareSize)
|
| | | {
|
| | | string data = "";
|
| | | string dataLength = "2C";
|
| | | string dataComand1 = "5A";
|
| | | string dataComand2 = "02";
|
| | | string dataSerialNum = "01";
|
| | | string addDataLength = "28";
|
| | | string deviceUpgradeMethod = "01";
|
| | | string firewareVersionData = "";
|
| | | string firewareSizeData = "";
|
| | |
|
| | | try
|
| | | {
|
| | | //固件版本
|
| | | var firewareVerBytes = System.Text.Encoding.ASCII.GetBytes(firewareVer);
|
| | | for (int i = 0; i < firewareVerBytes.Length; i++)
|
| | | {
|
| | | var fw = Convert.ToString(firewareVerBytes[i], 16);
|
| | | if (fw.Length == 1)
|
| | | {
|
| | | fw = "0" + fw;
|
| | | }
|
| | | firewareVersionData += fw;
|
| | | }
|
| | |
|
| | | var aa = firewareVersionData.Length;
|
| | | firewareVersionData = firewareVersionData.PadRight(70, '0');
|
| | |
|
| | | //固件尺寸
|
| | | var tempFwSize = Convert.ToString(firewareSize, 16);
|
| | | tempFwSize = tempFwSize.PadLeft(8, '0');
|
| | | for (int i = 6; i >= 0; i = i - 2)
|
| | | {
|
| | | firewareSizeData += tempFwSize.Substring(i, 2);
|
| | | }
|
| | |
|
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
|
| | | deviceUpgradeMethod + firewareVersionData + firewareSizeData;
|
| | |
|
| | | }
|
| | | catch { };
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | ///升级IRACC模块通知回复
|
| | | /// </summary>
|
| | | public ResponseAllData keyColorDataResponseAllData;
|
| | | [System.Serializable]
|
| | | public class ResponseAllData
|
| | | {
|
| | | /// <summary>
|
| | | /// 错误信息
|
| | | /// </summary>
|
| | | public string errorMessageBase;
|
| | | /// <summary>
|
| | | /// 网关信息错误反馈
|
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
| | | /// </summary>
|
| | | public CommonDevice.ErrorResponData errorResponData;
|
| | | /// <summary>
|
| | | /// 升级IRACC模块通知信息
|
| | | /// </summary>
|
| | | public ResponseData responseData;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 升级IRACC模块通知回复(Zigbee MCU -> APP)
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class ResponseData
|
| | | {
|
| | | /// <summary>
|
| | | /// 状态值
|
| | | /// <para>0--版本号不一致(可以升级</para>
|
| | | /// <para>1--版本号一致(不用升级</para>
|
| | | /// <para>2--预留(暂时不用到</para>
|
| | | /// <para>ff--无效(暂时不用到)</para>
|
| | | /// </summary>
|
| | | public int status = -1;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 设备请求APP获取升级数据 (Zigbee MCU -> APP,主动上报)
|
| | | /// <summary>
|
| | | ///设备请求APP获取升级数据(Zigbee MCU -> APP,主动上报)
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class DeviceRequestUpgradeResponseData
|
| | | {
|
| | | /// <summary>
|
| | | /// 数据偏移量,每个分包偏移量+(1-43)
|
| | | /// </summary>
|
| | | public string offset = string.Empty;
|
| | | /// <summary>
|
| | | /// 数据长度len
|
| | | /// </summary>
|
| | | public int dataLength = -1;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 发升级数据到设备(APP -> Zigbee MCU)
|
| | | ///<summary >
|
| | | ///读取IRACC模块固件版本
|
| | | /// <para>reserve:0-ff</para>
|
| | | /// </summary>
|
| | | public async void UpgradeAsync(CommonDevice device, SendUpgradeData upgradeData)
|
| | | {
|
| | | var Gateway = device.Gateway;
|
| | | if (Gateway == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | Action<string, string> action = (topic, message) => { };
|
| | | Gateway.Actions += action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString());
|
| | |
|
| | | try
|
| | | {
|
| | | string passData = "";
|
| | | if (upgradeData != null)
|
| | | {
|
| | | passData = SendUpgrade(upgradeData);
|
| | | }
|
| | |
|
| | | var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | | var data = new JObject { { "PassData", passData } };
|
| | | jObject.Add("Data", data);
|
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
|
| | | }
|
| | | catch { }
|
| | |
|
| | | Gateway.Actions -= action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString());
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 发升级数据到设备
|
| | | /// </summary>
|
| | | string SendUpgrade(SendUpgradeData upgradeData)
|
| | | {
|
| | | string data = "";
|
| | | string dataLength = "";
|
| | | string dataComand1 = "5D";
|
| | | string dataComand2 = "02";
|
| | | string dataSerialNum = "01";
|
| | | string addDataLength = "";
|
| | |
|
| | | string status = "";
|
| | | string offset = "";
|
| | | string upgradeDataLength = "";
|
| | | string dataString = "";
|
| | |
|
| | | try
|
| | | {
|
| | | var len = 4 + 1 + 4 + 1 + upgradeData.dataLength;
|
| | | dataLength = Convert.ToString(len, 16);
|
| | | if (dataLength.Length == 1)
|
| | | {
|
| | | dataLength = "0" + dataLength;
|
| | | }
|
| | |
|
| | | addDataLength = Convert.ToString(6 + upgradeData.dataLength, 16);
|
| | | if (addDataLength.Length == 1)
|
| | | {
|
| | | addDataLength = "0" + addDataLength;
|
| | | }
|
| | |
|
| | | if (upgradeData.status == 0)
|
| | | {
|
| | | status = "00";
|
| | | }
|
| | | else if (upgradeData.status == 1)
|
| | | {
|
| | | status = "01";
|
| | | }
|
| | | else
|
| | | {
|
| | | status = "ff";
|
| | | }
|
| | |
|
| | |
|
| | | offset = upgradeData.offset;
|
| | |
|
| | | var dl = Convert.ToString(upgradeData.dataLength, 16);
|
| | | if (dl.Length == 1)
|
| | | {
|
| | | upgradeDataLength = "0" + dl;
|
| | | }
|
| | | else
|
| | | {
|
| | | upgradeDataLength = dl;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < upgradeData.databytes.Length; i++)
|
| | | {
|
| | | var dataB = Convert.ToString(upgradeData.databytes[i], 16);
|
| | | if (dataB.Length == 1)
|
| | | {
|
| | | dataB = "0" + dataB;
|
| | | }
|
| | | dataString += dataB;
|
| | | }
|
| | |
|
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
|
| | | status + offset + upgradeDataLength + dataString;
|
| | | }
|
| | | catch { };
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 发送升级数据到设备(APP -> Zigbee MCU)
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class SendUpgradeData
|
| | | {
|
| | | /// <summary>
|
| | | /// 0--成功
|
| | | ///<para>1--失败</para>
|
| | | ///<para>ff--无效</para>
|
| | | /// </summary>
|
| | | public int status = 0;
|
| | | /// <summary>
|
| | | /// 数据偏移量,每个分包偏移量+(1-43)
|
| | | /// </summary>
|
| | | public string offset;
|
| | | /// <summary>
|
| | | /// 数据长度len
|
| | | /// </summary>
|
| | | public int dataLength = -1;
|
| | |
|
| | | /// <summary>
|
| | | /// 分包数据
|
| | | /// </summary>
|
| | | public byte[] databytes;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 分包结束(Zigbee MCU -> APP,主动上报)
|
| | | /// <summary>
|
| | | /// 设备请求APP获取分包结束命令(Zigbee MCU -> APP)
|
| | | /// </summary>
|
| | | [System.Serializable]
|
| | | public class DeviceRequestFinishResponseData
|
| | | {
|
| | | /// <summary>
|
| | | /// 0-ff
|
| | | /// </summary>
|
| | | public int reserve = -1;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 分包结束(APP -> Zigbee MCU)
|
| | | ///<summary >
|
| | | ///读取IRACC模块固件版本
|
| | | /// <para>status:0--成功;1--失败;ff--无效 .</para>
|
| | | /// </summary>
|
| | | public async void SendFinishAsync(CommonDevice device, int status)
|
| | | {
|
| | | var Gateway = device.Gateway;
|
| | | if (Gateway == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | Action<string, string> action = (topic, message) => { };
|
| | | Gateway.Actions += action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString());
|
| | |
|
| | | try
|
| | | {
|
| | | var passData = SendFinishDataString(status);
|
| | | var jObject = new JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
|
| | | var data = new JObject { { "PassData", passData } };
|
| | | jObject.Add("Data", data);
|
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString());
|
| | | }
|
| | | catch { }
|
| | |
|
| | | Gateway.Actions -= action;
|
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString());
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 发升级数据到设备
|
| | | /// </summary>
|
| | | string SendFinishDataString(int status)
|
| | | {
|
| | | string data = "";
|
| | | string dataLength = "05";
|
| | | string dataComand1 = "5F";
|
| | | string dataComand2 = "02";
|
| | | string dataSerialNum = "01";
|
| | | string addDataLength = "01";
|
| | | string statusString = "";
|
| | | try
|
| | | {
|
| | | if (status == 0)
|
| | | {
|
| | | statusString = "00";
|
| | | }
|
| | | else if (status == 1)
|
| | | {
|
| | | statusString = "01";
|
| | | }
|
| | | else
|
| | | {
|
| | | statusString = "ff";
|
| | | }
|
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength +
|
| | | statusString;
|
| | | }
|
| | | catch { };
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 分包结束返回(APP -> Zigbee MCU
|
| | | /// </summary>
|
| | | //[System.Serializable]
|
| | | public class SendFinishData
|
| | | {
|
| | | /// <summary>
|
| | | /// 状态:成功/失败
|
| | | ///<para>0--成功<<para>
|
| | | ///<para>1--失败<<para>
|
| | | ///<para>ff--无效<<para>
|
| | | /// </summary>
|
| | | public int status = -1;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
| | | /// </summary>
|
| | | /// <param name="rollershade">窗帘对象</param>
|
| | | /// <param name="limiType">确认及覆盖上限位还是下限位</param>
|
| | | /// <param name="upLimit">上限位的值,百分比(备份用)</param>
|
| | | /// <param name="downLimit">下限位的值,百分比(备份用)</param>
|
| | | /// <param name="upLimit">上限位的值(长度值,不是百分比)</param>
|
| | | /// <param name="downLimit">下限位的值(长度值,不是百分比)</param>
|
| | | /// <returns></returns>
|
| | | public async Task<bool> CommitCurtainLimitPoint(Rollershade rollershade, Rollershade.CurtainPrivateInstalledLimi limiType, int upLimit, int downLimit)
|
| | | {
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (upLimit < 0) { upLimit = 0; }
|
| | | if (downLimit < 0) { downLimit = 100; }
|
| | |
|
| | | //这个是开合帘 "2,0x00ff,0x00ff"格式
|
| | | string convertData = "\"2,0x" + Convert.ToString(upLimit, 16).PadLeft(4, '0');
|
| | | convertData += ",0x" + Convert.ToString(downLimit, 16).PadLeft(4, '0') + "\"";
|
| | | //这个是开合帘 "2,0x00ff,0x00ff"格式 合限位在前,开限位在后
|
| | | string convertData = "\"2,0x" + Convert.ToString(downLimit, 16).PadLeft(4, '0');
|
| | | convertData += ",0x" + Convert.ToString(upLimit, 16).PadLeft(4, '0') + "\"";
|
| | | //然后将它们转为ASK码数值,然后再转为16进制
|
| | | //总计长度为17(这里是16进制)
|
| | | string sendData = "11";
|
| | |
| | | {
|
| | | //先移除
|
| | | this.RemoveDeviceHardInfoThread(device);
|
| | |
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | this.hsGetHardInfoDevice.Add(mainkeys);
|
| | |
|
| | | if (HdlGatewayReceiveLogic.Current.IsEsixt("DeviceGetFixedAttribute") == false)
|
| | | {
|
| | | //添加事件
|
| | |
| | | //不需要发送
|
| | | return;
|
| | | }
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | this.hsGetHardInfoDevice.Add(mainkeys);
|
| | | //发送
|
| | | var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
|
| | | jObject.Add("Data", data);
|
| | |
| | | /// 重新绑定网关(1:正常 -1:异常 0:当前的网关绑定在了当前账号下的不同住宅里面) |
| | | /// </summary> |
| | | /// <param name="zbGateway">网关</param> |
| | | /// <param name="btnMsg">消息控件</param> |
| | | public async Task<int> ReBindNewGateway(ZbGateway zbGateway, NormalViewControl btnMsg = null) |
| | | {
|
| | | if (zbGateway == null)
|
| | |
| | | }
|
| | |
|
| | | //获取全部设备
|
| | | bool result = LocalDevice.Current.SetDeviceToMemmoryByGateway(realWay);
|
| | | int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(realWay);
|
| | | //关闭进度条
|
| | | ProgressBar.Close();
|
| | | if (result == false)
|
| | | if (result == -1)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 时间转换___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 将utc时间类型的字符串,转换为本地时间
|
| | | /// </summary>
|
| | | /// <param name="timeText"></param>
|
| | | /// <returns></returns>
|
| | | public static DateTime ConvertUtcTimeToLocalTime(string timeText)
|
| | | {
|
| | | var utcTime = Convert.ToDateTime(timeText);
|
| | | return TimeZoneInfo.ConvertTimeFromUtc(utcTime, TimeZoneInfo.Local);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 文件保存和读取_____________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | rowInfo.btnIcon = btnIcon;
|
| | |
|
| | | //设备名称
|
| | | var btnDeviceName = new NormalViewControl(400, 60, true);
|
| | | var btnDeviceName = new NormalViewControl(700, 60, true);
|
| | | btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
|
| | | btnDeviceName.X = Application.GetRealWidth(193);
|
| | | btnDeviceName.Y = Application.GetRealHeight(45);
|
| | |
| | | /// 当前选择的网关
|
| | | /// </summary>
|
| | | private AC deviceAc = null;
|
| | | /// <summary>
|
| | | /// 摆风模式(用二进制来玩自定义模式 0:不使用 1:使用)
|
| | | /// </summary>
|
| | | private int swingMode = 0;
|
| | | /// <summary>
|
| | | /// 固定预留的数据
|
| | | /// </summary>
|
| | | private string fixValue = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | //初始化右上角菜单
|
| | | this.InitTopRightMenu();
|
| | |
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //开启进度条
|
| | | this.ShowProgressBar();
|
| | | //读取空调摆风模式
|
| | | var result = this.ReadAirConditionerSwingModeSupport();
|
| | | if (result == false)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar(ShowReLoadMode.YES);
|
| | | return;
|
| | | }
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame();
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | form.AddForm(deviceAc);
|
| | | };
|
| | |
|
| | | //摆风
|
| | | var rowSwing = new FrameRowControl(listview.rowSpace / 2);
|
| | | rowSwing.UseClickStatu = false;
|
| | | listview.AddChidren(rowSwing);
|
| | | rowSwing.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uAirConditionerSwing), 400);
|
| | | rowSwing.AddBottomLine();
|
| | | var btnSwingSwitch = rowSwing.AddMostRightSwitchIcon();
|
| | | if (this.swingMode == 1)
|
| | | {
|
| | | btnSwingSwitch.IsSelected = true;
|
| | | }
|
| | | btnSwingSwitch.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //不能再点击
|
| | | btnSwingSwitch.CanClick = false;
|
| | | string statu = btnSwingSwitch.IsSelected == true ? "1" : "0";
|
| | | //将二进制转换为十进制
|
| | | int sendData = Convert.ToInt32(this.fixValue + statu, 2);
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | var result = await HdlDeviceAirConditionerLogic.Current.SetUseAcSwingFunctionStatu(deviceAc, sendData);
|
| | | if (result == true)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | btnSwingSwitch.IsSelected = !btnSwingSwitch.IsSelected;
|
| | | this.swingMode = this.swingMode == 1 ? 0 : 1;
|
| | |
|
| | | deviceAc.UseSwingFunction = btnSwingSwitch.IsSelected;
|
| | | deviceAc.ReSave();
|
| | | });
|
| | | }
|
| | | //能够继续点击
|
| | | btnSwingSwitch.CanClick = true;
|
| | | });
|
| | | };
|
| | |
|
| | | //初始化桌布完成
|
| | | tableContr.FinishInitControl(bodyFrameLayout, this.listview);
|
| | | tableContr = null;
|
| | |
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 读取空调摆风模式___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 读取空调摆风模式
|
| | | /// </summary>
|
| | | private bool ReadAirConditionerSwingModeSupport()
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(deviceAc);
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("ReadAirConditionerModeSupport", ReceiveComandDiv.A设备属性上报, (report) =>
|
| | | {
|
| | | string checkKeys = Common.LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | if (checkKeys != mainkeys || report.DeviceStatusReport.CluterID != 514)
|
| | | {
|
| | | return;
|
| | | }
|
| | | for (int i = 0; i < report.DeviceStatusReport.AttriBute.Count; i++)
|
| | | {
|
| | | var data = report.DeviceStatusReport.AttriBute[i];
|
| | | if (data.AttributeId == 4097)
|
| | | {
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("ReadAirConditionerModeSupport");
|
| | | //转换为二进制
|
| | | var value = Convert.ToString(data.AttriButeData, 2).PadLeft(16, '0');
|
| | | //这个设置是放在后面的
|
| | | this.fixValue = value.Substring(0, value.Length - 15);
|
| | | this.swingMode = Convert.ToInt32(value.Substring(this.fixValue.Length));
|
| | | }
|
| | | }
|
| | | });
|
| | | //获取是否启用空调摆风模式的状态(打开 或者 关闭)
|
| | | deviceAc.ReadUseSwingFunctionStatu();
|
| | |
|
| | | int timeOut = 0;
|
| | | while (this.fixValue == null && timeOut <= 30)
|
| | | {
|
| | | System.Threading.Thread.Sleep(100);
|
| | | timeOut++;
|
| | | }
|
| | | if (this.fixValue == null)
|
| | | {
|
| | | //获取空调摆风状态失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetAirConditionerSwingFunctionFail);
|
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "回复超时");
|
| | | this.ShowMassage(ShowMsgType.Tip, msg);
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | |
| | | |
| | | var btnBindName = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(500 - 120), |
| | | Width = Application.GetRealWidth(790), |
| | | X = devicePic.Right + Application.GetRealWidth(20), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.TextBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | |
| | | btnBindName.MouseUpEventHandler += hander; |
| | | btnChoose.MouseUpEventHandler += hander; |
| | | |
| | | if (device.CommonDevice?.DeviceEpointName == "") |
| | | if (string.IsNullOrEmpty(device.CommonDevice?.DeviceEpointName)) |
| | | { |
| | | btnBindName.Text = device.CommonDevice?.DeviceAddr + "_" + device.CommonDevice?.DeviceEpoint; |
| | | } |
| | |
| | | Text = Language.StringByID(R.MyInternationalizationString.FirstFloor), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextSize = 14, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | }; |
| | | btnAddFrameLayout.AddChidren(btnFloorText); |
| | |
| | | TextID = R.MyInternationalizationString.Save, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | TextSize = 16, |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnFinifh); |
| | |
| | | |
| | | var btnBindName = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(500 - 120), |
| | | Width = Application.GetRealWidth(790), |
| | | X = devicePic.Right + Application.GetRealWidth(20), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.TextBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize =15, |
| | | TextSize = 15, |
| | | }; |
| | | rowLayout.AddChidren(btnBindName); |
| | | |
| | |
| | | { |
| | | currentClusterID = 258; |
| | | } |
| | | currentKey.ReSave(); |
| | | |
| | | //读取按键当前绑定目标 |
| | | GetDeviceBindResponseAllData getBindList = null; |
| | | if (IsRead) |
| | |
| | | currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddCurtain); |
| | | } |
| | | } |
| | | currentKey.ReSave(); |
| | | } |
| | | #endregion |
| | | Application.RunOnMainThread(() => |
| | |
| | | |
| | | var btnAddFrameLayout = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(913), |
| | | X = Application.GetRealWidth(888), |
| | | Width = Application.GetRealWidth(192), |
| | | }; |
| | | this.titleFrameLayout.AddChidren(btnAddFrameLayout); |
| | | |
| | | var btnBindAdd = new Button |
| | | { |
| | | X = Application.GetRealWidth(62), |
| | | Height = Application.GetRealHeight(72), |
| | | Width = Application.GetRealWidth(72), |
| | | UnSelectedImagePath = "BindPic/BindAdd.png", |
| | |
| | | devicePic.Width = Application.GetRealWidth(110); |
| | | devicePic.Text = ""; |
| | | } |
| | | if (tempDev.DeviceEpointName == "") |
| | | if (string.IsNullOrEmpty(tempDev.DeviceEpointName)) |
| | | { |
| | | btnBindNameText = tempDev.DeviceEpoint + Language.StringByID(R.MyInternationalizationString.uDeviceCircuit); |
| | | } |
| | |
| | | modeRowLayout.BackgroundColor = ZigbeeColor.Current.XMWhite; |
| | | midVerticalRefreshLayout.AddChidrenRow(modeRowLayout); |
| | | modeRowLayout.frameTable.UseClickStatu = false; |
| | | modeRowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.keyMode), 500); |
| | | modeRowLayout.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.keyMode), 400); |
| | | var btnKeyModeTipText = ""; |
| | | #region 当前模式文本显示 |
| | | switch (currentKey.panelMode) |
| | |
| | | break; |
| | | } |
| | | #endregion |
| | | modeRowLayout.frameTable.AddMostRightView(btnKeyModeTipText, 500); |
| | | modeRowLayout.frameTable.AddMostRightView(btnKeyModeTipText, 800); |
| | | modeRowLayout.frameTable.AddBottomLine(); |
| | | var btnDel = modeRowLayout.AddDeleteControl(); |
| | | //一键清除按键事件 |
| | |
| | | //Log出力
|
| | | string msg = "当前激活的界面[" + UserCenterResourse.NowActionFormID + "]";
|
| | | HdlLogLogic.Current.WriteLog(ex, msg);
|
| | | //出现未知错误
|
| | | this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
|
| | | //电机数据异常,请重置电机
|
| | | this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uCurtainDataIsErrorPleaseResetCurtain));
|
| | | try
|
| | | {
|
| | | this.listView.RemoveAll();
|
| | |
| | | btnProgress1.Text = progressValue + "%";
|
| | | frameBack.AddChidren(btnProgress1);
|
| | | //进度条
|
| | | this.openSeekBar = new SeekBarControl(965);
|
| | | this.openSeekBar = new SeekBarControl(965);
|
| | | openSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
|
| | | openSeekBar.ProgressBarColor = 0xff288bfd;
|
| | | openSeekBar.Progress = progressValue;
|
| | |
| | | }
|
| | | oldProValue = nowValue;
|
| | | checking = true;
|
| | | if (curtainData.DeleteOpenLimit == true)
|
| | | {
|
| | | //重置开限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.UpLimit);
|
| | | if (result == false)
|
| | | {
|
| | | checking = false;
|
| | | continue;
|
| | | }
|
| | | curtainData.DeleteOpenLimit = false;
|
| | | }
|
| | |
|
| | | //将窗帘调整到指定百分比
|
| | | this.sendDiv = 1;
|
| | | curtainDevice.WcdGoToTiltValue(nowValue);
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainOpenLimitMsg);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
|
| | | {
|
| | | decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength;
|
| | | decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength;
|
| | | if (openValue < 0) { openValue = 0; }
|
| | | if (closeValue < 0) { closeValue = curtainData.CurtainLength; }
|
| | | //执行确认及覆盖上限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.UpLimit,
|
| | | curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
|
| | | (int)openValue, (int)closeValue);
|
| | | if (result == true)
|
| | | {
|
| | | curtainData.DeleteOpenLimit = true;
|
| | | this.receiveOpenlimit = false;
|
| | | }
|
| | | });
|
| | |
| | | btnProgress1.Text = progressValue + "%";
|
| | | frameBack.AddChidren(btnProgress1);
|
| | | //进度条
|
| | | this.closeSeekBar = new SeekBarControl(965);
|
| | | this.closeSeekBar = new SeekBarControl(965);
|
| | | closeSeekBar.Y = btnProgressView.Bottom + Application.GetRealHeight(46);
|
| | | closeSeekBar.ProgressBarColor = 0xff288bfd;
|
| | | closeSeekBar.Progress = progressValue;
|
| | |
| | | frameBack.AddChidren(btnPlus);
|
| | | btnPlus.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (closeSeekBar.Progress >=100)
|
| | | if (closeSeekBar.Progress >= 100)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | }
|
| | | checking = true;
|
| | | oldProValue = nowValue;
|
| | | if (curtainData.DeleteCloseLimit == true)
|
| | | {
|
| | | //重置合限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.DeleteCurtainLimitPoint(curtainDevice, Rollershade.LimiType.DownLimit);
|
| | | if (result == false)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | curtainData.DeleteCloseLimit = false;
|
| | | }
|
| | |
|
| | | //将窗帘调整到指定百分比
|
| | | this.sendDiv = 2;
|
| | | curtainDevice.WcdGoToTiltValue(nowValue);
|
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uCommitCurtainCloseLimitMsg);
|
| | | this.ShowMassage(ShowMsgType.Confirm, msg, async () =>
|
| | | {
|
| | | //执行确认及覆盖合限位点
|
| | | decimal openValue = ((decimal)curtainData.OpenLimitPersent / 100) * curtainData.CurtainLength;
|
| | | decimal closeValue = ((decimal)curtainData.CloseLimitPersent / 100) * curtainData.CurtainLength;
|
| | | if (openValue < 0) { openValue = 0; }
|
| | | if (closeValue < 0) { closeValue = curtainData.CurtainLength; }
|
| | | //执行确认及覆盖上限位点
|
| | | var result = await HdlDeviceCurtainLogic.Current.CommitCurtainLimitPoint(curtainDevice, Rollershade.CurtainPrivateInstalledLimi.DownLimit,
|
| | | curtainData.OpenLimitPersent, curtainData.CloseLimitPersent);
|
| | | (int)openValue, (int)closeValue);
|
| | |
|
| | | if (result == true)
|
| | | {
|
| | | curtainData.DeleteCloseLimit = true;
|
| | | this.receiveCloseLimit = false;
|
| | | }
|
| | | });
|
| | |
| | | //方向备份
|
| | | await HdlDeviceCurtainLogic.Current.BackupCurtainDirection(curtainDevice, curtainData.Direction);
|
| | | //限位备份
|
| | | int uplimit= (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | int uplimit = (int)(curtainData.OpenLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | int downlimit = (int)(curtainData.CloseLimitValue / (curtainData.CurtainLength * 1.0) * 100);
|
| | | await HdlDeviceCurtainLogic.Current.BackupCurtainLimitPoint(curtainDevice, uplimit, downlimit);
|
| | | });
|
| | |
| | | /// false:电机方向正向;true:电机方向反向
|
| | | /// </summary>
|
| | | public bool Direction = false;
|
| | | /// <summary>
|
| | | /// 是否重置开限位点
|
| | | /// </summary>
|
| | | public bool DeleteOpenLimit = true;
|
| | | /// <summary>
|
| | | /// 是否重置合限位点
|
| | | /// </summary>
|
| | | public bool DeleteCloseLimit = true;
|
| | | /// <summary>
|
| | | /// 开限位的值
|
| | | /// </summary>
|
| | |
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame(); |
| | | |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(i_deviceMac); |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(i_deviceMac);
|
| | | |
| | | var listView = new VerticalListControl(12); |
| | | listView.BackgroundColor = UserCenterColor.Current.White; |
| | |
| | | frame.AddChidren(listView);
|
| | | listView.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | //下拉刷新
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //获取全部设备
|
| | | bool result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //隐藏下拉刷新特效
|
| | | listView.EndHeaderRefreshing();
|
| | | if (result == true)
|
| | | {
|
| | | //重新刷新界面
|
| | | this.InitMiddleFrame(false);
|
| | | }
|
| | | });
|
| | | //下拉刷新
|
| | | this.ListViewBeginHeaderRefreshing();
|
| | | });
|
| | | };
|
| | | }
|
| | |
| | | //根据MAC合并设备列表
|
| | | this.MargeAllDeviceByMac(listDevice);
|
| | |
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | var listOta = new List<OTADevice>();
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 下拉刷新___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 滑动控件下拉刷新
|
| | | /// </summary>
|
| | | private async void ListViewBeginHeaderRefreshing()
|
| | | {
|
| | | //如果是在线的
|
| | | if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(GatewayResourse.NowSelectGateway) == true)
|
| | | {
|
| | | //检测广播到的这个网关是否拥有住宅ID
|
| | | ZbGateway realWay = null;
|
| | | if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, GatewayResourse.NowSelectGateway) == true)
|
| | | {
|
| | | //重新设置住宅ID(这个应该是不经过APP,直接把网关恢复了出厂设置)
|
| | | if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true)
|
| | | {
|
| | | //显示进度条
|
| | | ProgressBar.Show();
|
| | | int result2 = await HdlGatewayLogic.Current.ReBindNewGateway(realWay);
|
| | | //关闭进度条
|
| | | ProgressBar.Close();
|
| | | if (result2 == -1)
|
| | | {
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //获取全部设备
|
| | | int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(GatewayResourse.NowSelectGateway);
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //隐藏下拉刷新特效
|
| | | listView.EndHeaderRefreshing();
|
| | | if (result != -1)
|
| | | {
|
| | | //重新刷新界面
|
| | | this.InitMiddleFrame(false);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 网关在线检测_______________________
|
| | |
|
| | | /// <summary>
|
| | |
| | | {
|
| | | //这里主要只是获取在线状态
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(gwId);
|
| | | var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatu, ShowErrorMode.NO);
|
| | | int statu = 0;
|
| | | var list = LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatu(list[i]);
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //读取空调模块版本
|
| | | var result = await ((AC)listNewDevice[0]).ReadACFirewareVersionAsync();
|
| | | var result = await HdlDeviceAirConditionerLogic.Current.ReadACFirewareVersionAsync(listNewDevice[0]);
|
| | | if (result == null || result.readACFirewareVersionResponData == null || result.readACFirewareVersionResponData.Status != 0)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | |
| | | /// </summary>
|
| | | private bool isDeviceThreadStart = false;
|
| | | /// <summary>
|
| | | /// 等待设备的回馈的超时时间(单位:秒)
|
| | | /// 等待设备的回馈的超时时间(单位:百毫秒)
|
| | | /// </summary>
|
| | | private int waitDeviceTimeOut = 3;
|
| | | private int waitDeviceTimeOut = 20;
|
| | | /// <summary>
|
| | | /// 主题超时的线程是否开启
|
| | | /// </summary>
|
| | |
| | | }
|
| | |
|
| | | //刷新超时时间
|
| | | this.waitDeviceTimeOut = 3;
|
| | | this.waitDeviceTimeOut = 20;
|
| | |
|
| | | //获取设备的固定属性
|
| | | HdlDeviceFixedAttributeLogic.Current.SetAllFixedAttributeToDevice(device);
|
| | |
| | | while (this.waitDeviceTimeOut >= 0)
|
| | | {
|
| | | //等待下一个回路
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | System.Threading.Thread.Sleep(100);
|
| | | this.waitDeviceTimeOut--;
|
| | | }
|
| | | //停止接收
|
| | | this.realGateway.GwResDataAction -= this.AdjustGatewayResultData;
|
| | | System.Threading.Thread.Sleep(500);
|
| | | System.Threading.Thread.Sleep(200);
|
| | |
|
| | | //目前就弄一个
|
| | | Application.RunOnMainThread(() =>
|
| | |
| | | { |
| | | foreach (var curDoorLockUser in getDoorLockInfoAllList) |
| | | { |
| | | if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "") |
| | | if (string.IsNullOrEmpty(curDoorLockUser.DoorLockLocalUserId)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | foreach (var curDoorLockUser in getDoorLockInfoList.PageData) |
| | | { |
| | | if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "") |
| | | if (string.IsNullOrEmpty(curDoorLockUser.DoorLockLocalUserId)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | foreach (var curDoorLockUser in getDoorLockInfoAllList) |
| | | { |
| | | if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "") |
| | | if (string.IsNullOrEmpty(curDoorLockUser.DoorLockLocalUserId)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | //获取云端存储的门锁成员信息 |
| | | foreach (var curDoorLockUser in getDoorLockInfoList.PageData) |
| | | { |
| | | if (curDoorLockUser.CloudAccountId == "" || curDoorLockUser.CloudAccountId != subAccountDistributedMark) |
| | | if (string.IsNullOrEmpty(curDoorLockUser.CloudAccountId) || curDoorLockUser.CloudAccountId != subAccountDistributedMark) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | var curDoorLockUser = doorLock.localDoorLockAccountList[curUserId]; |
| | | |
| | | if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | |
| | | public FrameLayout bottomRadiusFrameLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(906), |
| | | Height = Application.GetRealHeight(806), |
| | | Y = Application.GetRealHeight(930), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | TextSize = 14, |
| | | }; |
| | | |
| | | public Button line = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(138), |
| | | Height = 1, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | |
| | | this.bottomRadiusFrameLayout.AddChidren(btnCancel); |
| | | this.bottomRadiusFrameLayout.AddChidren(btnBottomTitle); |
| | | this.bottomRadiusFrameLayout.AddChidren(btnFinish); |
| | | this.bottomRadiusFrameLayout.AddChidren(line); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | alert.ConfirmClickEvent += () => |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | }; |
| | | form.AddForm(); |
| | | }; |
| | | } |
| | | doorLock.ReSave(); |
| | | } |
| | |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="btnDoorLockPic">门锁图片开/关显示</param> |
| | | public void RemoteUnlockRequest(ZigBee.Device.DoorLock doorLock, Action action, Button progressButton = null, Button btnDoorLockPic = null, Button btnStatus = null, Button btnDoorLockTitle = null) |
| | | { |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | string msgRemoteUnlockRequest = Language.StringByID(R.MyInternationalizationString.BindRemoteUnlockDoorlock); |
| | | var alertRemoteUnlockRequest = new Shared.Phone.UserCenter.ShowMsgControl(ShowMsgType.Confirm, msgRemoteUnlockRequest, Language.StringByID(R.MyInternationalizationString.GoSetting)); |
| | |
| | | { |
| | | var form = new UserCenter.UserMain.SecondAuthenticationForm(); |
| | | form.AddForm(); |
| | | }; |
| | | }; |
| | | return; |
| | | } |
| | | |
| | |
| | | }); |
| | | }; |
| | | HdlCheckLogic.Current.CheckSecondarySecurity(action); |
| | | }; |
| | | }; |
| | | } |
| | | // 获取到到名称更改回调通知 |
| | | public Action<string> devicNameSecAction; |
| | |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextSize = 20, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | this.midFrameLayout.AddChidren(btnPicTip); |
| | | |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | Radius = (uint)Application.GetRealHeight(127 / 2), |
| | | TextSize = 16, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | bottomFrameLayout.AddChidren(completeBtn); |
| | | |
| | |
| | | btnPasswordRemark.Text = Language.StringByID(R.MyInternationalizationString.ProximityRemark); |
| | | btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.ProximityCard) + "-" + doorLock.doorLockProgrammingEventNotificationCommand.UserID; |
| | | } |
| | | if (curAccountObj.UserName != "" && curAccountObj.UserName != null) |
| | | |
| | | if (!string.IsNullOrEmpty(curAccountObj.UserName)) |
| | | { |
| | | btnMatchPersonContent.Text = curAccountObj.UserName; |
| | | } |
| | |
| | | addLockInfo.OpenLockMode = doorLock.doorLockProgrammingEventNotificationCommand.ProgramEventSoure; |
| | | addLockInfo.DoorLockLocalUserId = doorLock.doorLockProgrammingEventNotificationCommand.UserID.ToString(); |
| | | addLockInfo.EntryTime = System.DateTime.Now; |
| | | if (btnPasswordRemarkContent.Text != "") |
| | | if (!string.IsNullOrEmpty(btnPasswordRemarkContent.Text)) |
| | | { |
| | | addLockInfo.UserIdRemarks = btnPasswordRemarkContent.Text; |
| | | } |
| | |
| | | Height = Application.GetRealHeight(1319), |
| | | Y = Application.GetRealHeight(418), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | }; |
| | | this.midFrameLayout.AddChidren(bottomFrameLayout); |
| | | bottomFrameLayout.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | |
| | | |
| | | var informationEdit = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | |
| | | btnNext.SelectedImagePath = "DoorLock/SwitchOn.png"; |
| | | btnLine.Visible = true; |
| | | btnLine.Y = Application.GetRealHeight(853); |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | btnNext.IsSelected = false; |
| | | } |
| | |
| | | btnNext.IsSelected = !btnNext.IsSelected; |
| | | if (btnNext.IsSelected) |
| | | { |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | RemotePasswordDialog(doorLock, btnNext); |
| | | } |
| | |
| | | btnNext.IsSelected = !btnNext.IsSelected; |
| | | if (btnNext.IsSelected) |
| | | { |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | RemotePasswordDialog(doorLock, btnNext); |
| | | } |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 16, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | this.midFrameLayout.AddChidren(btnFinifh); |
| | | btnFinifh.MouseUpEventHandler += (sender, e) => |
| | |
| | | |
| | | public void BottomFrameLayout() |
| | | { |
| | | #region UI |
| | | //var bottomFrameLayout = new FrameLayout() |
| | | //{ |
| | | // Height = Application.GetRealHeight(100), |
| | | // Y = Application.GetRealHeight(418), |
| | | // Radius = 17, |
| | | // BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | //}; |
| | | //this.midFrameLayout.AddChidren(bottomFrameLayout); |
| | | |
| | | //var bottomFrameLayout1 = new FrameLayout() |
| | | //{ |
| | | // Height = Application.GetRealHeight(1319 - 50), |
| | | // Y = Application.GetRealHeight(418 + 48), |
| | | // BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | //}; |
| | | //this.midFrameLayout.AddChidren(bottomFrameLayout1); |
| | | |
| | | #region UI |
| | | var bottomFrameLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(1319), |
| | |
| | | btnNext.SelectedImagePath = "DoorLock/SwitchOn.png"; |
| | | btnLine.Visible = true; |
| | | btnLine.Y = Application.GetRealHeight(714); |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | btnNext.IsSelected = false; |
| | | } |
| | |
| | | btnNext.IsSelected = !btnNext.IsSelected; |
| | | if (btnNext.IsSelected) |
| | | { |
| | | if (doorLock.RemoteUnlockPassword == "") |
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword)) |
| | | { |
| | | RemotePasswordDialog(doorLock, btnNext); |
| | | } |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 16, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | this.midFrameLayout.AddChidren(btnFinifh); |
| | | btnFinifh.MouseUpEventHandler += (sender, e) => |
| | |
| | | unLockMethod.Show(); |
| | | } |
| | | else if (currentIndex == 1) |
| | | { |
| | | { |
| | | if (!btnRight.IsSelected) |
| | | { |
| | | FreezeUser(true); |
| | | FreezeUser(true); |
| | | } |
| | | else |
| | | { |
| | | FreezeUser(false); |
| | | FreezeUser(false); |
| | | } |
| | | } |
| | | else if (currentIndex == 2) |
| | | { |
| | | { |
| | | if (!btnRight.IsSelected) |
| | | { |
| | | HasRemoteUnlockAccessMethod(true); |
| | | HasRemoteUnlockAccessMethod(true); |
| | | } |
| | | else |
| | | { |
| | | HasRemoteUnlockAccessMethod(false); |
| | | HasRemoteUnlockAccessMethod(false); |
| | | } |
| | | } |
| | | }; |
| | |
| | | foreach (var curDoorLockUser in curAccountDoorLockUserList)
|
| | | {
|
| | | // 账户中没有门锁用户
|
| | | if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "")
|
| | | { |
| | | if (string.IsNullOrEmpty(curDoorLockUser.DoorLockLocalUserId))
|
| | | {
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | }
|
| | | //冻结/解冻用户
|
| | | int count1 = tempGroupId.Count; |
| | | if (tempGroupId.Count==1) |
| | | if (tempGroupId.Count == 1) |
| | | { |
| | | foreach (var a in tempGroupId) |
| | | { |
| | | if(a.Count ==0) |
| | | if (a.Count == 0) |
| | | { |
| | | count1 = 0; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | int count2 = 0; |
| | | |
| | |
| | | else if (resultData.defaultControlResponseData.status == 33) |
| | | { |
| | | count2++; |
| | | } |
| | | System.Threading.Thread.Sleep(1000); |
| | | } |
| | | System.Threading.Thread.Sleep(1000); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | tempCount++; |
| | | } |
| | | |
| | | |
| | | // 批量冻结门锁中的账户后,准备冻结云端账户 |
| | | if (count2 == count1) |
| | | { |
| | |
| | | });
|
| | | }
|
| | | });
|
| | | }; |
| | | }; |
| | | } |
| | | |
| | | //是否给子账户拥有远程开锁的条件 |
| | |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | #region ◆ 接口实现__________________________ |
| | |
| | | var mUIPickerView = new UIPickerView() |
| | | { |
| | | X = Application.GetRealWidth(0), |
| | | Height = Application.GetRealHeight(440), |
| | | }; |
| | | this.bottomRadiusFrameLayout.AddChidren(mUIPickerView); |
| | | |
| | |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentDate; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(110); |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | var mList3 = new List<string>(); |
| | |
| | | int year = dtNow.Year + 1; |
| | | int days = DateTime.DaysInMonth(dtNow.Year, dtNow.Month); |
| | | |
| | | for (int y = dtNow.Year - 10; y < dtNow.Year + 1; y++) |
| | | for (int y = dtNow.Year - 9; y < dtNow.Year + 1; y++) |
| | | { |
| | | mList1.Add(y.ToString()); |
| | | } |
| | | for (int m = 1; m < 13; m++) |
| | | { |
| | | if(Language .CurrentLanguage == "Chinese") |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList2.Add(m.ToString()+"月"); |
| | | mList2.Add(m.ToString() + "月"); |
| | | } |
| | | else |
| | | { |
| | | mList2.Add(m.ToString()); |
| | | } |
| | | } |
| | | } |
| | | for (int d = 1; d < days + 1; d++) |
| | | { |
| | |
| | | else |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(dtNow.Year, dtNow.Month - 1, dtNow.Day - 1); |
| | | mUIPickerView.setCurrentItems(9, dtNow.Month - 1, dtNow.Day - 1); |
| | | curYear = dtNow.Year; |
| | | curMonth = dtNow.Month; |
| | | curDay = dtNow.Day; |
| | |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(curYear, curMonth - 1, curDay - 1); |
| | | mUIPickerView.setCurrentItems(9, curMonth - 1, curDay - 1); |
| | | } |
| | | } |
| | | }; |
| | |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentTime; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(95); |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | for (int h = 0; h < 24; h++) |
| | |
| | | textDisplayDateFrameLayout.MouseDownEventHandler += hander; |
| | | btnNextFrameLayout.MouseDownEventHandler += hander; |
| | | btnNext.MouseDownEventHandler += hander; |
| | | if (curIndex == 0) |
| | | { |
| | | textDisplayDate.MouseDownEventHandler += hander; |
| | | } |
| | | else |
| | | { |
| | | textDisplayTime.MouseDownEventHandler += hander; |
| | | } |
| | | } |
| | | |
| | | btnCancel.MouseUpEventHandler += (sender1, e1) => |
| | |
| | | }; |
| | | midTopFrameLayout.AddChidren(btnNext); |
| | | |
| | | btnNext.MouseUpEventHandler += (sender, e) => |
| | | EventHandler<MouseEventArgs> handerSideLip = (sender, e) => |
| | | { |
| | | SideslipFramelayout(); |
| | | }; |
| | | btnNext.MouseUpEventHandler += handerSideLip; |
| | | btnAllMethod.MouseUpEventHandler += handerSideLip; |
| | | var btnLine = new Button |
| | | { |
| | | Y = midTopFrameLayout.Bottom, |
| | |
| | | { |
| | | var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; |
| | | |
| | | if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | #region UI |
| | | |
| | | #region UI |
| | | var rowFrameLayout = new RowLayoutControl(bodyView.rowSpace / 2); |
| | | rowFrameLayout.BackgroundColor = ZigbeeColor.Current.XMWhite; |
| | | bodyView.AddChidren(rowFrameLayout); |
| | |
| | | btnicon.UnSelectedImagePath = "DoorLock/DoorLockUserPic.png"; |
| | | //上面门锁用户名称一行 |
| | | var memberText = ""; |
| | | if (curAccountObj.UserName == "" || curAccountObj.UserName == null) |
| | | if (string.IsNullOrEmpty(curAccountObj.UserName)) |
| | | { |
| | | memberText = curAccountObj.Account; |
| | | } |
| | |
| | | switch (curDoorLockUser.UnlockType) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | if (doorLock.currentUserDisplayMethod == "" && i == 0) |
| | | if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0) |
| | | { |
| | | btnAllMethod.IsSelected = true; |
| | | btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextSize = 12, |
| | | IsBold =true, |
| | | IsBold = true, |
| | | }; |
| | | midTopFrameLayout.AddChidren(btnAllMethod); |
| | | // 类型区分 |
| | |
| | | SelectedImagePath = "DoorLock/UnLockSideslipIcon.png", |
| | | }; |
| | | midTopFrameLayout.AddChidren(btnNext); |
| | | btnNext.MouseUpEventHandler += (sender, e) => |
| | | EventHandler<MouseEventArgs> handerSideLip = (sender, e) => |
| | | { |
| | | SideslipFramelayout(); |
| | | }; |
| | | |
| | | btnNext.MouseUpEventHandler += handerSideLip; |
| | | btnAllMethod.MouseUpEventHandler += handerSideLip; |
| | | var btnLine = new Button |
| | | { |
| | | Y = midTopFrameLayout.Bottom, |
| | |
| | | foreach (var curUserId in doorLock.localDoorLockUserList.Keys) |
| | | { |
| | | var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; |
| | | if (curDoorLockUser.ConnectedAccount != "") |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | Gravity = Gravity.CenterVertical, |
| | | TextSize =15, |
| | | TextSize = 15, |
| | | }; |
| | | rowFrameLayout.AddChidren(btnText); |
| | | |
| | |
| | | switch (curDoorLockUser.UnlockType) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnText.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnText.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | btnText.Text = curDoorLockUser.UserName; |
| | | } |
| | |
| | | { |
| | | Height = Application.GetRealHeight(100), |
| | | Y = Application.GetRealHeight(1253), |
| | | Radius =(uint) Application.GetRealHeight(100/2), |
| | | Radius = (uint)Application.GetRealHeight(100 / 2), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | flMain.AddChidren(bottomFrameLayout); |
| | |
| | | var bottomFrameLayout1 = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(668 - 60), |
| | | Y = Application.GetRealHeight(1253+58), |
| | | Y = Application.GetRealHeight(1253 + 58), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | flMain.AddChidren(bottomFrameLayout1); |
| | |
| | | btnLine.Visible = false; |
| | | } |
| | | |
| | | if (currentAccount.UserName != "" && currentAccount.UserName != null) |
| | | if (!string.IsNullOrEmpty(currentAccount.UserName)) |
| | | { |
| | | btnUserName.Text = currentAccount.UserName; |
| | | } |
| | |
| | | switch (curDoorLockUser.UnlockType) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | addLockInfo.UserIdRemarks = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | addLockInfo.UserIdRemarks = curDoorLockUser.UserName; |
| | | } |
| | |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) |
| | | { |
| | | addLockInfo.UserIdRemarks = curDoorLockUser.UserName; |
| | | } |
| | |
| | | break; |
| | | } |
| | | |
| | | if (doorLock.currentUserDisplayMethod == "" && i == 0) |
| | | if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0) |
| | | { |
| | | btnAllMethod.IsSelected = true; |
| | | btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | |
| | | }
|
| | | //这里主要只是获取在线状态
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(listGwId[i]);
|
| | | var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, (device) =>
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | listCheck.Add(mainkeys);
|
| | | int statu = 0;
|
| | | var list = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | for (int j = 0; j < list.Count; j++)
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(list[i]);
|
| | | if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | listCheck.Add(mainkeys);
|
| | |
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null && localDevice.IsOnline != device.IsOnline)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | localDevice.IsOnline = device.IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | | if (device.IsOnline == 1)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | dicData[mainkeys].OnlineCount += 1;
|
| | | dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count;
|
| | | });
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null && localDevice.IsOnline != list[i].IsOnline)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | localDevice.IsOnline = list[i].IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | | if (list[i].IsOnline == 1)
|
| | | {
|
| | | dicData[mainkeys].OnlineCount += 1;
|
| | | dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count;
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | {
|
| | | //移除楼层
|
| | | Common.Config.Instance.Home.FloorDics.Remove(keys);
|
| | | if (Common.Config.Instance.Home.CurrentFloorId == keys)
|
| | | {
|
| | | //如果删除的是当前楼层的话
|
| | | Common.Config.Instance.Home.CurrentFloorId = string.Empty;
|
| | | foreach (string floorId in Common.Config.Instance.Home.FloorDics.Keys)
|
| | | {
|
| | | //把第一个楼层ID给它
|
| | | Common.Config.Instance.Home.CurrentFloorId = floorId;
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | if (Common.Room.CurrentRoom == null)
|
| | | {
|
| | | Common.Room.CurrentRoom = Common.Room.Lists[0];
|
| | |
| | | //界面关闭
|
| | | return;
|
| | | }
|
| | | Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatuPush, ShowErrorMode.NO);
|
| | | int statu = 0;
|
| | | var list = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | {
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | //设置设备在线状态
|
| | | this.ReceiveDeviceStatuPush(list[i]);
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
old mode 100644
new mode 100755
| | |
| | | //数据异常
|
| | | return;
|
| | | }
|
| | | if (this.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //清空
|
| | | listView.RemoveAll();
|
| | | }); |
| | | if (dicData.Count == 0) |
| | | { |
| | | //关闭进度条 |
| | | this.CloseProgressBar(); |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //关闭刷新特效 |
| | | listView.EndHeaderRefreshing(); |
| | | listView.frameTable.Height = listView.Height; |
| | | }); |
| | | return; |
| | | });
|
| | | if (dicData.Count == 0)
|
| | | {
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //关闭刷新特效
|
| | | listView.EndHeaderRefreshing();
|
| | | listView.frameTable.Height = listView.Height;
|
| | | });
|
| | | return;
|
| | | }
|
| | | //初始化中部控件
|
| | | this.InitMiddleFrame(dicData);
|
| | |
| | | var btnTime = rowControl.frameTable.AddMostRightView("", 200, 50);
|
| | | btnTime.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnTime.Y = btnMsg.Bottom + Application.GetRealHeight(12);
|
| | | btnTime.Text = Convert.ToDateTime(recordInfo.CreatedOnUtc).ToString("HH:mm");
|
| | | var convertTime = UserCenterLogic.ConvertUtcTimeToLocalTime(recordInfo.CreatedOnUtc);
|
| | | btnTime.Text = convertTime.ToString("HH:mm");
|
| | | rowControl.frameTable.AddChidren(btnTime, ChidrenBindMode.BindEventOnly);
|
| | | //底线
|
| | | if (addLine == true)
|
| | | {
|
| | | rowControl.frameTable.AddBottomLine();
|
| | | rowControl.frameTable.AddBottomLine(); |
| | | }
|
| | | //已读
|
| | | if (recordInfo.IsReading == true)
|
| | |
| | | using System; |
| | | using Shared.Common; |
| | | using Shared.Phone.Device.CommonForm; |
| | | using Shared.Phone.UserCenter; |
| | | |
| | | namespace Shared.Phone.UserView |
| | |
| | | } |
| | | atHome.ButtonClickEvent += (sender, e) => |
| | | { |
| | | if(sender.IsSelected) |
| | | dialog.Close(); |
| | | if (sender.IsSelected) |
| | | { |
| | | dialog.Close(); |
| | | return; |
| | | } |
| | | CommonPage.Loading.Start(); |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | dialog.Close(); |
| | | if(result == GarrisonMode.AtHome) |
| | | { |
| | | |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonSuccess)); |
| | | } |
| | | else |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail)); |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | withdrawGarriso.ButtonClickEvent += (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | if (sender.IsSelected) |
| | | { |
| | | dialog.Close(); |
| | | return; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | CommonPage.Loading.Start(); |
| | | new System.Threading.Thread(async () => |
| | | { |
| | | var result = HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); |
| | | var result = await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | dialog.Close(); |
| | | CommonPage.Loading.Hide(); |
| | | if (result == 1) |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess)); |
| | | } |
| | | else |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail)); |
| | | } |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | } |
| | | atHome.ButtonClickEvent += (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | if (sender.IsSelected) |
| | | { |
| | | dialog.Close(); |
| | | return; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | CommonPage.Loading.Start(); |
| | | new System.Threading.Thread(async () => |
| | | { |
| | | var result = HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome); |
| | | var result =await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | dialog.Close(); |
| | | CommonPage.Loading.Hide(); |
| | | if (result == GarrisonMode.AtHome) |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetAtHomeGarrisonSuccess)); |
| | | } |
| | | else |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail)); |
| | | } |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | } |
| | | removeHome.ButtonClickEvent += (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | if (sender.IsSelected) |
| | | { |
| | | dialog.Close(); |
| | | return; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | CommonPage.Loading.Start(); |
| | | new System.Threading.Thread(async () => |
| | | { |
| | | var result = HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.RemoveHome); |
| | | var result =await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.RemoveHome); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | dialog.Close(); |
| | | CommonPage.Loading.Hide(); |
| | | if (result == GarrisonMode.RemoveHome) |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetRemoveHomeGarrisonSuccess)); |
| | | } |
| | | else |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail)); |
| | | } |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | } |
| | | withdrawGarriso.ButtonClickEvent += (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | if (sender.IsSelected) |
| | | { |
| | | dialog.Close(); |
| | | return; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | CommonPage.Loading.Start(); |
| | | new System.Threading.Thread(async () => |
| | | { |
| | | var result = HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); |
| | | var result =await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, true); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | dialog.Close(); |
| | | CommonPage.Loading.Hide(); |
| | | if (result == 1) |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess)); |
| | | } |
| | | else |
| | | { |
| | | CommonFormResouce.ShowTip(Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail)); |
| | | } |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Timers; |
| | | using Shared.Common; |
| | | using Shared.Phone.Device.AC; |
| | | using ZigBee.Device; |
| | | using Shared.Phone.Device.CommonForm; |
| | | using Shared.Phone.UserCenter.DoorLock; |
| | | using System.Timers; |
| | | using Shared.Phone.Device.DeviceLogic; |
| | | using Shared.Phone.UserCenter; |
| | | using Shared.Phone.UserCenter.DoorLock; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.UserView |
| | | { |
| | |
| | | /// </summary> |
| | | private void ShowFunction() |
| | | { |
| | | functionSceneBodyView.RemoveAll(); |
| | | //选择功能--直接从房间的devicelist中获取 |
| | | var deviceList = Room.CurrentRoom.DeviceUIList; |
| | | if (deviceList == null) |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var lightView = new FunctionMainView(xx, yy); |
| | | lightView.Tag = device; |
| | | itemView.AddChidren(lightView); |
| | | lightView.Init(); |
| | | lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | lightView.SetStatuText(device.GetDeviceStatu()); |
| | | lightView.SetDeviceName(rollerShade.DeviceEpointName); |
| | | //lightView.SetStatu(true); |
| | | lightView.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100; |
| | | lightView.SetCollect(true); |
| | | var functionView = new FunctionMainView(xx, yy); |
| | | functionView.Tag = device; |
| | | itemView.AddChidren(functionView); |
| | | functionView.Init(); |
| | | functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | functionView.SetStatuText(device.GetDeviceStatu()); |
| | | functionView.SetDeviceName(rollerShade.DeviceEpointName); |
| | | functionView.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100; |
| | | functionView.SetCollect(true); |
| | | |
| | | lightView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | functionView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | (sender as Button).IsSelected = !(sender as Button).IsSelected; |
| | | if ((sender as Button).IsSelected) |
| | |
| | | } |
| | | }; |
| | | |
| | | lightView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | functionView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = true; |
| | | var rollerShadeControl = new Phone.Device.Curtain.RollerShadeControl(); |
| | | UserView.HomePage.Instance.AddChidren(rollerShadeControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //rollerShadeControl.action = RefreshBodyView; |
| | | rollerShadeControl.Show(device, Room.CurrentRoom); |
| | | rollerShadeControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshEditDeviceAction(device, curRoom, functionView); |
| | | }; |
| | | }; |
| | | |
| | | lightView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | functionView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | } |
| | | } |
| | | else if (device.CommonDevice.Type == DeviceType.OnOffOutput) |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var lightView = new FunctionMainView(xx, yy); |
| | | itemView.AddChidren(lightView); |
| | | lightView.Init(); |
| | | lightView.Tag = device; |
| | | lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | lightView.SetStatuText(device.GetDeviceStatu()); |
| | | lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | lightView.IsSelected = light.OnOffStatus == 1; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); |
| | | var functionView = new FunctionMainView(xx, yy); |
| | | itemView.AddChidren(functionView); |
| | | functionView.Init(); |
| | | functionView.Tag = device; |
| | | functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | functionView.SetStatuText(device.GetDeviceStatu()); |
| | | functionView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | functionView.IsSelected = light.OnOffStatus == 1; |
| | | functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName)); |
| | | |
| | | var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (dev == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | lightView.CollectButton.IsSelected = false; |
| | | functionView.CollectButton.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | lightView.CollectButton.IsSelected = true; |
| | | functionView.CollectButton.IsSelected = true; |
| | | } |
| | | |
| | | lightView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | functionView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | (sender as Button).IsSelected = !(sender as Button).IsSelected; |
| | | if ((sender as Button).IsSelected) |
| | |
| | | } |
| | | }; |
| | | |
| | | lightView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | functionView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = true; |
| | | if (device.CommonDevice.DfunctionType == DeviceFunctionType.A开关) |
| | | |
| | | var lightControl = new Phone.Device.Light.OnOffControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | lightControl.Show(device, Room.CurrentRoom); |
| | | lightControl.action += (curDev, curRoom) => |
| | | { |
| | | var lightControl = new Phone.Device.Light.OnOffControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(device, Room.CurrentRoom); |
| | | } |
| | | else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | | var lightControl = new Phone.Device.Light.PlugControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(device, Room.CurrentRoom); |
| | | } |
| | | else |
| | | { |
| | | var lightControl = new Phone.Device.Light.LightControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(device, Room.CurrentRoom); |
| | | } |
| | | ReFreshEditDeviceAction(device, curRoom, functionView); |
| | | }; |
| | | }; |
| | | |
| | | lightView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | functionView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | } |
| | | } |
| | | else if (device.CommonDevice.Type == DeviceType.AirSwitch) |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var lightView = new FunctionMainView(xx, yy); |
| | | itemView.AddChidren(lightView); |
| | | lightView.Init(); |
| | | lightView.Tag = device; |
| | | lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | lightView.SetStatuText(device.GetDeviceStatu()); |
| | | lightView.SetDeviceName(airSwitch.DeviceEpointName); |
| | | //lightView.SetStatu(true); |
| | | lightView.IsSelected = airSwitch.OnOffStatus == 1; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); |
| | | var functionView = new FunctionMainView(xx, yy); |
| | | itemView.AddChidren(functionView); |
| | | functionView.Init(); |
| | | functionView.Tag = device; |
| | | functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | functionView.SetStatuText(device.GetDeviceStatu()); |
| | | functionView.SetDeviceName(airSwitch.DeviceEpointName); |
| | | functionView.IsSelected = airSwitch.OnOffStatus == 1; |
| | | functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom( device.FileName)); |
| | | |
| | | lightView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | functionView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | (sender as Button).IsSelected = !(sender as Button).IsSelected; |
| | | if ((sender as Button).IsSelected) |
| | |
| | | } |
| | | }; |
| | | |
| | | lightView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | functionView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = true; |
| | | var lightControl = new Phone.Device.Light.AirSwitchControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(device, Room.CurrentRoom); |
| | | lightControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshEditDeviceAction(device, curRoom, functionView); |
| | | }; |
| | | |
| | | }; |
| | | |
| | | lightView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | functionView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | } |
| | | } |
| | | else if (device.CommonDevice.Type == DeviceType.Thermostat) |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var lightView = new FunctionMainView(xx, yy); |
| | | itemView.AddChidren(lightView); |
| | | lightView.Init(); |
| | | lightView.Tag = device; |
| | | lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | lightView.SetStatuText(device.GetDeviceStatu()); |
| | | lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | lightView.IsSelected = ac.currentSystemMode != 0; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); |
| | | var functionView = new FunctionMainView(xx, yy); |
| | | itemView.AddChidren(functionView); |
| | | functionView.Init(); |
| | | functionView.Tag = device; |
| | | functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | functionView.SetStatuText(device.GetDeviceStatu()); |
| | | functionView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | functionView.IsSelected = ac.currentSystemMode != 0; |
| | | functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName)); |
| | | |
| | | lightView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | functionView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | (sender as Button).IsSelected = !(sender as Button).IsSelected; |
| | | if ((sender as Button).IsSelected) |
| | |
| | | } |
| | | }; |
| | | |
| | | lightView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | functionView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = true; |
| | | var lightControl = new Phone.Device.AC.ACControl(); |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(device, Room.CurrentRoom); |
| | | lightControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshEditDeviceAction(device, curRoom, functionView); |
| | | }; |
| | | }; |
| | | |
| | | lightView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | functionView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | } |
| | | } |
| | | else if (device.CommonDevice.Type == DeviceType.DimmableLight) |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var lightView = new FunctionMainView(xx, yy); |
| | | itemView.AddChidren(lightView); |
| | | lightView.Init(); |
| | | lightView.Tag = device; |
| | | lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | lightView.SetStatuText(device.GetDeviceStatu()); |
| | | lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | lightView.IsSelected = dimmableLight.OnOffStatus == 1; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); |
| | | var functionView = new FunctionMainView(xx, yy); |
| | | itemView.AddChidren(functionView); |
| | | functionView.Init(); |
| | | functionView.Tag = device; |
| | | functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | functionView.SetStatuText(device.GetDeviceStatu()); |
| | | functionView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | functionView.IsSelected = dimmableLight.OnOffStatus == 1; |
| | | functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName)); |
| | | |
| | | var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (dev == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | lightView.CollectButton.IsSelected = false; |
| | | functionView.CollectButton.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | lightView.CollectButton.IsSelected = true; |
| | | functionView.CollectButton.IsSelected = true; |
| | | } |
| | | |
| | | lightView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | functionView.SwitchButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | (sender as Button).IsSelected = !(sender as Button).IsSelected; |
| | | if ((sender as Button).IsSelected) |
| | |
| | | } |
| | | }; |
| | | |
| | | lightView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | functionView.CardBG.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = true; |
| | | var dimmableLightControl = new Phone.Device.Light.DimmableLightControl(); |
| | | UserView.HomePage.Instance.AddChidren(dimmableLightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //dimmableLightControl.action = RefreshBodyView; |
| | | dimmableLightControl.Show(device, Room.CurrentRoom); |
| | | dimmableLightControl.action += (curDev, curRoom) => |
| | | { |
| | | ReFreshEditDeviceAction(device, curRoom, functionView); |
| | | }; |
| | | }; |
| | | lightView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | functionView.CollectButton.MouseUpEventHandler += collectionEvent; |
| | | } |
| | | } |
| | | else if (device.CommonDevice.Type == DeviceType.IASZone) |
| | |
| | | lightView.SetStatuText(device.GetDeviceStatu()); |
| | | lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | lightView.IsSelected = ias.iASInfo?.Alarm1 == 1; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName)); |
| | | lightView.CanControl(false); |
| | | var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (dev == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | lightView.CollectButton.IsSelected = false; |
| | | } |
| | |
| | | lightView.SetStatuText(device.GetDeviceStatu()); |
| | | lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | lightView.IsSelected = false; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName)); |
| | | lightView.CanControl(false); |
| | | var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (dev == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | lightView.CollectButton.IsSelected = false; |
| | | } |
| | |
| | | lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | lightView.SetStatuText(device.GetDeviceStatu()); |
| | | lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | lightView.IsSelected = dimmableLight.IsOnline == 1; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); |
| | | lightView.IsSelected = false; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName)); |
| | | lightView.CanControl(false); |
| | | var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (dev == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | lightView.CollectButton.IsSelected = false; |
| | | } |
| | |
| | | lightView.SetStatuText(device.GetDeviceStatu()); |
| | | lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | lightView.CanControl(false); |
| | | lightView.IsSelected = device.CommonDevice.IsOnline == 1; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); |
| | | //lightView.IsSelected = device.CommonDevice.IsOnline == 1; |
| | | lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName)); |
| | | |
| | | var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (dev == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | lightView.CollectButton.IsSelected = false; |
| | | } |
| | |
| | | }); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ReFreshEditDeviceAction |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <param name="curRoom"></param> |
| | | /// <param name="functionView"></param> |
| | | private void ReFreshEditDeviceAction(DeviceUI device, Common.Room curRoom, FunctionMainView functionView) |
| | | { |
| | | if (Common.Room.CurrentRoom.IsLove) |
| | | { |
| | | functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | functionView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | if (Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | ShowFunction(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curRoom.Id != Common.Room.CurrentRoom.Id) |
| | | { |
| | | |
| | | Common.Room.CurrentRoom.DeleteDevice(device.FileName); |
| | | ShowFunction(); |
| | | } |
| | | else |
| | | { |
| | | functionView.SetDeviceImage(device.IconPath, device.OnlineIconPath); |
| | | functionView.SetDeviceName(device.CommonDevice.DeviceEpointName); |
| | | functionView.SetCollect(Room.CurrentRoom.IsCollectInRoom(device.FileName)); |
| | | } |
| | | } |
| | | } |
| | |
| | | Height = Application.GetRealHeight(200), |
| | | Text = Language.StringByID(R.MyInternationalizationString.NoScene_Tip).Replace("{\\r\\n}", "\r\n"), |
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextAlignment=TextAlignment.Center, |
| | | IsMoreLines = true |
| | | }; |
| | | functionSceneBodyView.AddChidren(noScenceTip); |
| | |
| | | /// </summary> |
| | | private void ShowScene() |
| | | { |
| | | functionSceneBodyView.RemoveAll(); |
| | | //选择场景 |
| | | var sceneList = Room.CurrentRoom.SceneUIList; |
| | | if (sceneList == null) |
| | |
| | | /// </summary> |
| | | public List<FanMode> fanModes = new List<FanMode> { }; |
| | | /// <summary>
|
| | | /// <para>自定义空调支持的模式(默认全关)</para>
|
| | | /// <para>自定义空调支持的模式(默认全开)</para>
|
| | | /// <para>数组索引 -> 0:制冷 1:制热 2:送风 3:除湿 4:自动</para>
|
| | | /// <para>值 -> 1:代表使用 0:代表不使用</para>
|
| | | /// </summary> |
| | | public int[] listSupportMode = new int[5] { 0, 0, 0, 0, 0 }; |
| | | public int[] listSupportMode = new int[5] { 1, 1, 1, 1, 1 }; |
| | | /// <summary>
|
| | | /// 是否启用摆风功能 false:不使用摆风功能 true:使用摆风功能
|
| | | /// </summary> |
| | | public bool UseSwingFunction = true; |
| | | |
| | | /// <summary> |
| | | /// 过滤网清洗状态 |
| | |
| | | public void ReadCleanStatu() |
| | | { |
| | | ReadAttri(Device.Cluster_ID.Thermostat, AttriButeId.CleanStatu); |
| | | }
|
| | |
|
| | | /// <summary> |
| | | /// 获取是否启用空调摆风模式的状态(打开 或者 关闭) |
| | | /// </summary> |
| | | public void ReadUseSwingFunctionStatu() |
| | | { |
| | | ReadAttri(Device.Cluster_ID.FanControl, AttriButeId.UseAcSwingFunctionStatu); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | {
|
| | | return await SetSystemModeAsync(acMode);
|
| | | } |
| | | |
| | | #region 升级空调第三方模块的接口 |
| | | |
| | | #region 读取IRACC模块固件版本(APP -> Zigbee MCU) |
| | | ///<summary > |
| | | ///读取IRACC模块固件版本 |
| | | /// <para>reserve:0-ff</para> |
| | | /// </summary> |
| | | public async System.Threading.Tasks.Task<ReadACFirewareVersionResponAllData> ReadACFirewareVersionAsync(string reserve = "01") |
| | | { |
| | | ReadACFirewareVersionResponAllData result = null; |
| | | if (Gateway == null) |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "当前没有网关" }; |
| | | return result; |
| | | } |
| | | return await System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Action<string, string> action = (topic, message) => |
| | | { |
| | | var gatewayID = topic.Split('/')[0]; |
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | if (topic == gatewayID + "/" + "Error_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID }; |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | if (temp == null) |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "网关错误回复,且数据是空" }; |
| | | } |
| | | |
| | | else |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; |
| | | } |
| | | } |
| | | if (topic == gatewayID + "/" + "ZbDataPassthrough") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; |
| | | gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString()); |
| | | |
| | | if (gatewayTemp.clientDataPassthroughResponseData == null) |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = "网关返回的数据为空" }; |
| | | } |
| | | else |
| | | { |
| | | if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null) |
| | | { |
| | | var data = gatewayTemp.clientDataPassthroughResponseData.PassData; |
| | | var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString(); |
| | | if (command == "0259") |
| | | { |
| | | var tempD = new ReadACFirewareVersionResponData(); |
| | | tempD.Status = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16); |
| | | if (data.Length == 82) |
| | | { |
| | | var firewareString = data.Substring(12); |
| | | var aa = firewareString.Length; |
| | | firewareVersion = firewareString; |
| | | var bytes = new byte[firewareString.Length / 2]; |
| | | for (int i = 0; i < bytes.Length; i++) |
| | | { |
| | | bytes[i] = Convert.ToByte(firewareString.Substring(i * 2, 2), 16); |
| | | } |
| | | |
| | | var firewareVersionTemp = System.Text.Encoding.ASCII.GetString(bytes); |
| | | tempD.FirewareVersion = firewareVersionTemp.Replace('\0', ' ').Trim(); |
| | | } |
| | | result = new ReadACFirewareVersionResponAllData { readACFirewareVersionResponData = tempD }; |
| | | System.Console.WriteLine($"UI收到通知后的主题_command:0258_{topic}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | Gateway.Actions += action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString()); |
| | | |
| | | try |
| | | { |
| | | var passData = ReadACFirewareVersionData(reserve); |
| | | var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; |
| | | var data = new JObject { { "PassData", passData } }; |
| | | jObject.Add("Data", data); |
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString()); |
| | | } |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | | await System.Threading.Tasks.Task.Delay(10); |
| | | if (result != null) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | result = new ReadACFirewareVersionResponAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | | Gateway.Actions -= action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString()); |
| | | |
| | | return result; |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取IRACC模块固件版本 |
| | | /// </summary> |
| | | string ReadACFirewareVersionData(string reserve) |
| | | { |
| | | string data = ""; |
| | | string dataLength = "05"; |
| | | string dataComand1 = "58"; |
| | | string dataComand2 = "02"; |
| | | string dataSerialNum = "01"; |
| | | string addDataLength = "01"; |
| | | string reserveData = reserve; |
| | | |
| | | try |
| | | { |
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + |
| | | reserveData; |
| | | } |
| | | catch { }; |
| | | |
| | | return data; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// IRACC模块固件版本,网关反馈信息 |
| | | /// </summary> |
| | | public ReadACFirewareVersionResponAllData readACFirewareVersionResponAllData; |
| | | /// <summary> |
| | | /// IRACC模块固件版本,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ReadACFirewareVersionResponAllData |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// IRACC模块固件版本信息 |
| | | /// </summary> |
| | | public ReadACFirewareVersionResponData readACFirewareVersionResponData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// IRACC模块固件版本的数据 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ReadACFirewareVersionResponData |
| | | { |
| | | /// <summary> |
| | | /// 状态 |
| | | ///<para>0--成功</para> |
| | | ///<para>1--失败</para> |
| | | ///<para>ff--无效</para> |
| | | /// </summary> |
| | | public int Status; |
| | | /// <summary> |
| | | /// 固件版本 |
| | | /// </summary> |
| | | public string FirewareVersion; |
| | | } |
| | | #endregion |
| | | |
| | | #region 升级IRACC模块通知(APP -> Zigbee MCU) |
| | | ///<summary > |
| | | ///升级IRACC模块通知 |
| | | /// <para>firewareVer:固件版本</para> |
| | | /// <para>firewareSize:固件大小</para> |
| | | /// </summary> |
| | | public async System.Threading.Tasks.Task<ResponseAllData> UpggradeACNotificationAsync(string firewareVer, long firewareSize) |
| | | { |
| | | ResponseAllData result = null; |
| | | if (Gateway == null) |
| | | { |
| | | result = new ResponseAllData { errorMessageBase = "当前没有网关" }; |
| | | return result; |
| | | } |
| | | return await System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Action<string, string> action = (topic, message) => |
| | | { |
| | | var gatewayID = topic.Split('/')[0]; |
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | if (topic == gatewayID + "/" + "Error_Respon") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = Gateway.getGatewayBaseInfo.gwID }; |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | if (temp == null) |
| | | { |
| | | result = new ResponseAllData { errorMessageBase = "网关错误回复,且数据是空" }; |
| | | } |
| | | |
| | | else |
| | | { |
| | | result = new ResponseAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; |
| | | } |
| | | } |
| | | if (topic == gatewayID + "/" + "ZbDataPassthrough") |
| | | { |
| | | var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; |
| | | gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<ClientDataPassthroughResponseData>(jobject["Data"].ToString()); |
| | | |
| | | if (gatewayTemp.clientDataPassthroughResponseData == null) |
| | | { |
| | | result = new ResponseAllData { errorMessageBase = "网关返回的数据为空" }; |
| | | } |
| | | else |
| | | { |
| | | if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null) |
| | | { |
| | | var data = gatewayTemp.clientDataPassthroughResponseData.PassData; |
| | | var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString(); |
| | | if (command == "025b") |
| | | { |
| | | var tempD = new ResponseData(); |
| | | if (data.Length == 12) |
| | | { |
| | | tempD.status = Convert.ToInt32(data[10].ToString() + data[11].ToString(), 16); |
| | | } |
| | | result = new ResponseAllData { responseData = tempD }; |
| | | System.Console.WriteLine($"UI收到通知后的主题_{ topic}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | Gateway.Actions += action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString()); |
| | | |
| | | try |
| | | { |
| | | var passData = UpggradeACNotificationData(firewareVer, firewareSize); |
| | | var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; |
| | | var data = new JObject { { "PassData", passData } }; |
| | | jObject.Add("Data", data); |
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString()); |
| | | } |
| | | catch { } |
| | | |
| | | var dateTime = DateTime.Now; |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) |
| | | { |
| | | await System.Threading.Tasks.Task.Delay(10); |
| | | if (result != null) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | { |
| | | result = new ResponseAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | | Gateway.Actions -= action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString()); |
| | | |
| | | return result; |
| | | }); |
| | | } |
| | | |
| | | private string firewareVersion = string.Empty; |
| | | /// <summary> |
| | | /// 升级IRACC模块通知返回 |
| | | /// </summary> |
| | | string UpggradeACNotificationData(string firewareVer, long firewareSize) |
| | | { |
| | | string data = ""; |
| | | string dataLength = "2C"; |
| | | string dataComand1 = "5A"; |
| | | string dataComand2 = "02"; |
| | | string dataSerialNum = "01"; |
| | | string addDataLength = "28"; |
| | | string deviceUpgradeMethod = "01"; |
| | | string firewareVersionData = ""; |
| | | string firewareSizeData = ""; |
| | | |
| | | try |
| | | { |
| | | //固件版本 |
| | | var firewareVerBytes = System.Text.Encoding.ASCII.GetBytes(firewareVer); |
| | | for (int i = 0; i < firewareVerBytes.Length; i++) |
| | | { |
| | | var fw = Convert.ToString(firewareVerBytes[i], 16); |
| | | if (fw.Length == 1) |
| | | { |
| | | fw = "0" + fw; |
| | | } |
| | | firewareVersionData += fw; |
| | | } |
| | | |
| | | var aa = firewareVersionData.Length; |
| | | firewareVersionData = firewareVersionData.PadRight(70, '0'); |
| | | |
| | | //固件尺寸 |
| | | var tempFwSize = Convert.ToString(firewareSize, 16); |
| | | tempFwSize = tempFwSize.PadLeft(8, '0'); |
| | | for (int i = 6; i >= 0; i = i - 2) |
| | | { |
| | | firewareSizeData += tempFwSize.Substring(i, 2); |
| | | } |
| | | |
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + |
| | | deviceUpgradeMethod + firewareVersionData + firewareSizeData; |
| | | |
| | | } |
| | | catch { }; |
| | | |
| | | return data; |
| | | } |
| | | |
| | | /// <summary> |
| | | ///升级IRACC模块通知回复 |
| | | /// </summary> |
| | | public ResponseAllData keyColorDataResponseAllData; |
| | | [System.Serializable] |
| | | public class ResponseAllData |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 升级IRACC模块通知信息 |
| | | /// </summary> |
| | | public ResponseData responseData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 升级IRACC模块通知回复(Zigbee MCU -> APP) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ResponseData |
| | | { |
| | | /// <summary> |
| | | /// 状态值 |
| | | /// <para>0--版本号不一致(可以升级</para> |
| | | /// <para>1--版本号一致(不用升级</para> |
| | | /// <para>2--预留(暂时不用到</para> |
| | | /// <para>ff--无效(暂时不用到)</para> |
| | | /// </summary> |
| | | public int status = -1; |
| | | } |
| | | #endregion |
| | | |
| | | #region 设备请求APP获取升级数据 (Zigbee MCU -> APP,主动上报) |
| | | /// <summary> |
| | | ///设备请求APP获取升级数据(Zigbee MCU -> APP,主动上报) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class DeviceRequestUpgradeResponseData |
| | | { |
| | | /// <summary> |
| | | /// 数据偏移量,每个分包偏移量+(1-43) |
| | | /// </summary> |
| | | public string offset = string.Empty; |
| | | /// <summary> |
| | | /// 数据长度len |
| | | /// </summary> |
| | | public int dataLength = -1; |
| | | } |
| | | #endregion |
| | | |
| | | #region 发升级数据到设备(APP -> Zigbee MCU) |
| | | ///<summary > |
| | | ///读取IRACC模块固件版本 |
| | | /// <para>reserve:0-ff</para> |
| | | /// </summary> |
| | | public async void UpgradeAsync(SendUpgradeData upgradeData) |
| | | { |
| | | if (Gateway == null) |
| | | { |
| | | return; |
| | | } |
| | | Action<string, string> action = (topic, message) => { }; |
| | | Gateway.Actions += action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString()); |
| | | |
| | | try |
| | | { |
| | | string passData = ""; |
| | | if (upgradeData != null) |
| | | { |
| | | passData = SendUpgrade(upgradeData); |
| | | } |
| | | |
| | | var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; |
| | | var data = new JObject { { "PassData", passData } }; |
| | | jObject.Add("Data", data); |
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString()); |
| | | } |
| | | catch { } |
| | | |
| | | Gateway.Actions -= action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString()); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发升级数据到设备 |
| | | /// </summary> |
| | | string SendUpgrade(SendUpgradeData upgradeData) |
| | | { |
| | | string data = ""; |
| | | string dataLength = ""; |
| | | string dataComand1 = "5D"; |
| | | string dataComand2 = "02"; |
| | | string dataSerialNum = "01"; |
| | | string addDataLength = ""; |
| | | |
| | | string status = ""; |
| | | string offset = ""; |
| | | string upgradeDataLength = ""; |
| | | string dataString = ""; |
| | | |
| | | try |
| | | { |
| | | var len = 4 + 1 + 4 + 1 + upgradeData.dataLength; |
| | | dataLength = Convert.ToString(len, 16); |
| | | if (dataLength.Length == 1) |
| | | { |
| | | dataLength = "0" + dataLength; |
| | | } |
| | | |
| | | addDataLength = Convert.ToString(6 + upgradeData.dataLength, 16); |
| | | if (addDataLength.Length == 1) |
| | | { |
| | | addDataLength = "0" + addDataLength; |
| | | } |
| | | |
| | | if (upgradeData.status == 0) |
| | | { |
| | | status = "00"; |
| | | } |
| | | else if (upgradeData.status == 1) |
| | | { |
| | | status = "01"; |
| | | } |
| | | else |
| | | { |
| | | status = "ff"; |
| | | } |
| | | |
| | | |
| | | offset = upgradeData.offset; |
| | | |
| | | var dl = Convert.ToString(upgradeData.dataLength, 16); |
| | | if (dl.Length == 1) |
| | | { |
| | | upgradeDataLength = "0" + dl; |
| | | } |
| | | else |
| | | { |
| | | upgradeDataLength = dl; |
| | | } |
| | | |
| | | for (int i = 0; i < upgradeData.databytes.Length; i++) |
| | | { |
| | | var dataB = Convert.ToString(upgradeData.databytes[i], 16);
if (dataB.Length == 1)
{
dataB = "0" + dataB;
}
dataString += dataB; |
| | | } |
| | | |
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + |
| | | status + offset + upgradeDataLength + dataString; |
| | | } |
| | | catch { }; |
| | | |
| | | return data; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送升级数据到设备(APP -> Zigbee MCU) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class SendUpgradeData |
| | | { |
| | | /// <summary> |
| | | /// 0--成功 |
| | | ///<para>1--失败</para> |
| | | ///<para>ff--无效</para> |
| | | /// </summary> |
| | | public int status = 0; |
| | | /// <summary> |
| | | /// 数据偏移量,每个分包偏移量+(1-43) |
| | | /// </summary> |
| | | public string offset; |
| | | /// <summary> |
| | | /// 数据长度len |
| | | /// </summary> |
| | | public int dataLength = -1; |
| | | |
| | | /// <summary> |
| | | /// 分包数据 |
| | | /// </summary> |
| | | public byte[] databytes; |
| | | } |
| | | #endregion |
| | | |
| | | #region 分包结束(Zigbee MCU -> APP,主动上报) |
| | | /// <summary> |
| | | /// 设备请求APP获取分包结束命令(Zigbee MCU -> APP) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class DeviceRequestFinishResponseData |
| | | { |
| | | /// <summary> |
| | | /// 0-ff |
| | | /// </summary> |
| | | public int reserve = -1; |
| | | } |
| | | #endregion |
| | | |
| | | #region 分包结束(APP -> Zigbee MCU) |
| | | ///<summary > |
| | | ///读取IRACC模块固件版本 |
| | | /// <para>status:0--成功;1--失败;ff--无效 .</para> |
| | | /// </summary> |
| | | public async void SendFinishAsync(int status) |
| | | { |
| | | if (Gateway == null) |
| | | { |
| | | return; |
| | | } |
| | | Action<string, string> action = (topic, message) => { }; |
| | | Gateway.Actions += action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 启动" + System.DateTime.Now.ToString()); |
| | | |
| | | try |
| | | { |
| | | var passData = SendFinishDataString(status); |
| | | var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; |
| | | var data = new JObject { { "PassData", passData } }; |
| | | jObject.Add("Data", data); |
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString()); |
| | | } |
| | | catch { } |
| | | |
| | | Gateway.Actions -= action; |
| | | System.Console.WriteLine("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString()); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发升级数据到设备 |
| | | /// </summary> |
| | | string SendFinishDataString(int status) |
| | | { |
| | | string data = ""; |
| | | string dataLength = "05"; |
| | | string dataComand1 = "5F"; |
| | | string dataComand2 = "02"; |
| | | string dataSerialNum = "01"; |
| | | string addDataLength = "01"; |
| | | string statusString = ""; |
| | | try |
| | | { |
| | | if (status == 0) |
| | | { |
| | | statusString = "00"; |
| | | } |
| | | else if (status == 1) |
| | | { |
| | | statusString = "01"; |
| | | } |
| | | else |
| | | { |
| | | statusString = "ff"; |
| | | } |
| | | data = dataLength + dataComand1 + dataComand2 + dataSerialNum + addDataLength + |
| | | statusString; |
| | | } |
| | | catch { }; |
| | | |
| | | return data; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分包结束返回(APP -> Zigbee MCU |
| | | /// </summary> |
| | | //[System.Serializable] |
| | | public class SendFinishData |
| | | { |
| | | /// <summary> |
| | | /// 状态:成功/失败 |
| | | ///<para>0--成功<<para> |
| | | ///<para>1--失败<<para> |
| | | ///<para>ff--无效<<para> |
| | | /// </summary> |
| | | public int status = -1; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// 过虑网清洗标志:42 |
| | | /// </summary> |
| | | CleanStatu = 4097, |
| | | CleanStatu = 4097,
|
| | | /// <summary> |
| | | /// 启用空调摆风模式的状态(打开 或者 关闭) |
| | | /// </summary> |
| | | UseAcSwingFunctionStatu = 4097, |
| | | |
| | | #endregion |
| | | |
| | |
| | | /// 编辑 |
| | | /// </summary> |
| | | public const int Edit = 11011; |
| | | /// <summary> |
| | | /// 设置功能 |
| | | /// </summary> |
| | | public const int FunctionSetting = 11012; |
| | | /// <summary> |
| | | /// 功能设置 |
| | | /// </summary> |
| | | public const int FunctionSetting = 11012; |
| | | /// <summary> |
| | | /// 信息编辑 |
| | | /// </summary> |
| | |
| | | /// 添加延时 |
| | | /// </summary> |
| | | public const int AddDelayTime = 11036; |
| | | /// <summary> |
| | | /// 空调模式为空,请先配置 |
| | | /// </summary> |
| | | public const int AC_Model_None = 11037; |
| | | |
| | | |
| | | #region 设备类型 |
| | | /// <summary> |
| | |
| | | /// 办公室
|
| | | /// </summary>
|
| | | public const int uWorkRoom = 16060;
|
| | | /// <summary>
|
| | | /// 电机数据异常,请重置电机
|
| | | /// </summary>
|
| | | public const int uCurtainDataIsErrorPleaseResetCurtain = 16061;
|
| | | /// <summary>
|
| | | /// 获取空调摆风状态失败
|
| | | /// </summary>
|
| | | public const int uGetAirConditionerSwingFunctionFail = 16062;
|
| | | /// <summary>
|
| | | /// 设置空调摆风失败
|
| | | /// </summary>
|
| | | public const int uSetAirConditionerSwingFunctionFail = 16063;
|
| | |
|
| | |
|
| | | //★★★★下面这些是接口的返回信息翻译,从18000开始★★★★
|
| | |
| | | <Import_RootNamespace>Shared</Import_RootNamespace>
|
| | | </PropertyGroup>
|
| | | <ItemGroup>
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\ComparerDeviceUI.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\Device.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\House.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)Common\Logic.cs" />
|