| | |
| | | } |
| | | 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; |