New file |
| | |
| | | using Shared.Phone.UserCenter; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using ZigBee.Device; |
| | | using System.Linq; |
| | | |
| | | namespace Shared.Common |
| | | { |
| | | /// <summary> |
| | | /// 房间对象 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class Room |
| | | {
|
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 是否是喜爱房间 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public bool IsLove |
| | | { |
| | | get |
| | | { |
| | | return Id == "Favorite"; |
| | | } |
| | | }
|
| | | /// <summary>
|
| | | /// 房间文件
|
| | | /// </summary>
|
| | | [Newtonsoft.Json.JsonIgnore]
|
| | | public string FileName
|
| | | {
|
| | | get
|
| | | {
|
| | | return $"Room_{Id}.json";
|
| | | }
|
| | | } |
| | | |
| | | /// <summary> |
| | | /// 房间id--使用guid |
| | | /// </summary> |
| | | public string Id = Guid.NewGuid().ToString(); |
| | | /// <summary> |
| | | /// 房间名 |
| | | /// </summary> |
| | | public string Name = string.Empty; |
| | | /// <summary> |
| | | /// 房间背景图 |
| | | /// </summary> |
| | | public string BackgroundImage = string.Empty; |
| | | /// <summary> |
| | | /// 图片来源 0--本地图库 1--拍照 2--系统图库 |
| | | /// </summary> |
| | | public int BackgroundImageType = 0; |
| | | /// <summary>
|
| | | /// 温度传感器(设备主键)
|
| | | /// </summary> |
| | | public string TemperatrueDevice = string.Empty; |
| | | /// <summary>
|
| | | /// 湿度传感器(设备主键)
|
| | | /// </summary> |
| | | public string HumidityDevice = string.Empty;
|
| | | /// <summary> |
| | | /// 是否是分享过来的房间 |
| | | /// 注:分享过来的房间不能删除,不能编辑该房间,不能对设备(功能)、场景进行增删改 |
| | | /// </summary> |
| | | public bool IsSharedRoom = false;
|
| | | /// <summary> |
| | | /// 楼层Id |
| | | /// </summary> |
| | | public string FloorId = string.Empty;
|
| | |
|
| | | /// <summary> |
| | | /// 房间里所有的设备列表(设备的主键:mac地址_端口) |
| | | /// </summary> |
| | | public List<string> ListDevice = new List<string>(); |
| | | /// <summary> |
| | | ///场景列表(场景的ID) |
| | | /// </summary> |
| | | public List<int> ListSceneId = new List<int>();
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 保存_______________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 保存
|
| | | /// </summary>
|
| | | /// <param name="autoBackup">是否自动备份,默认true</param>
|
| | | public void Save(bool autoBackup = true)
|
| | | {
|
| | | //保存房间信息
|
| | | Global.WriteFileByBytesByHomeId(FileName, Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)));
|
| | | if (autoBackup == true)
|
| | | {
|
| | | HdlAutoBackupLogic.AddOrEditorFile(FileName);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion |
| | | } |
| | | } |