From 94e4e5b9fd3da964c44b7b14227d6fe2bbb426d7 Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期四, 02 四月 2020 13:56:39 +0800 Subject: [PATCH] 2020-04-02-2 --- ZigbeeApp/Shared/Common/House.cs | 83 +++++++++++++++++++++++++---------------- 1 files changed, 51 insertions(+), 32 deletions(-) diff --git a/ZigbeeApp/Shared/Common/House.cs b/ZigbeeApp/Shared/Common/House.cs index a76d259..0f8ae04 100755 --- a/ZigbeeApp/Shared/Common/House.cs +++ b/ZigbeeApp/Shared/Common/House.cs @@ -46,12 +46,20 @@ /// <summary> /// 浠呭瓙璐﹀彿鐧婚檰鐨勬椂鍊欎娇鐢�,褰撱�怚sOthreShare銆戜负"true"锛屽苟涓斻�怉ccountType銆戜负"1"鏃讹紝璇ヨ处鍙锋嫢鏈夌鐞嗗憳鏉冮檺 /// </summary> - public int AccountType; + public int AccountType; + /// <summary> + /// 缁忓害 + /// </summary> + public double Longitude = 0; + /// <summary> + /// 绾害 + /// </summary> + public double Latitude = 0; /// <summary> - /// 鎴块棿璺緞鍒楄〃 + /// 鎴块棿鍒楄〃(鎴块棿鐨処D) /// </summary> - public List<string> RoomFilePathList = new List<string> { }; + public List<string> ListRooms = new List<string>(); /// <summary> /// 妤煎眰瀛楀吀 @@ -60,9 +68,9 @@ /// </summary> public Dictionary<string,string> FloorDics = new Dictionary<string,string> { }; /// <summary> - /// 褰撳墠妤煎眰 + /// 褰撳墠妤煎眰Id /// </summary> - public string CurrentFloorId; + public string CurrentFloorId = string.Empty; /// <summary> /// 鍏ㄥ眬鍦烘櫙璺緞鍒楄〃---澶囩敤 @@ -227,8 +235,6 @@ /// </summary> public static async System.Threading.Tasks.Task<List<string>> GetHomeLists() { - //娓呯┖褰撳墠浣忓畢鍒楄〃 - Config.Instance.HomeFilePathList.Clear(); var pageSetting = new SendDataToServer.ResidenceListPageSettingObj() { PageSize = CommonPage.PageSize @@ -258,7 +264,7 @@ if (responseDataObj.TotalCount == 0) { //褰撲綇瀹呬负绌烘椂鍏堟彁绀虹敤鎴锋柊寤轰綇瀹� - var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.CurrentlyTheUserIshHouseIsEmptyPleaseBuildANewHouseFirst), Language.StringByID(R.MyInternationalizationString.Close), Language.StringByID(R.MyInternationalizationString.OK)); + var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.CurrentlyTheUserIshHouseIsEmptyPleaseBuildANewHouseFirst), Language.StringByID(R.MyInternationalizationString.Close), Language.StringByID(R.MyInternationalizationString.Confrim)); alert.Show(); alert.ResultEventHandler += (sender, e) => { @@ -270,6 +276,8 @@ } else { + //娓呯┖褰撳墠浣忓畢鍒楄〃 + Config.Instance.HomeFilePathList.Clear(); if (Config.Instance.HomeId == string.Empty && responseDataObj.PageData.Count > 0) { //璧嬩竴涓垵濮嬪�� @@ -287,7 +295,9 @@ Name = residence.Name, IsOthreShare = residence.IsOthreShare, AccountType = residence.AccountType, - MainUserDistributedMark = residence.MainUserDistributedMark + MainUserDistributedMark = residence.MainUserDistributedMark, + Longitude = residence.Longitude, + Latitude = residence.Latitude }; } else @@ -296,10 +306,12 @@ house.Name = residence.Name; house.IsOthreShare = residence.IsOthreShare; house.AccountType = residence.AccountType; - house.MainUserDistributedMark = residence.MainUserDistributedMark; + house.MainUserDistributedMark = residence.MainUserDistributedMark; + house.Longitude = residence.Longitude; + house.Latitude = residence.Latitude; } Global.CreateHomeDirectory(residence.Id); - house.Save(); + house.Save(false); } //鍖归厤褰撳墠浣忓畢 if (Config.Instance.HomeFilePathList.Find((obj) => obj == $"House_{Config.Instance.HomeId}.json") == null) @@ -307,11 +319,6 @@ Config.Instance.HomeId = GetHouseIdByFilePath(Config.Instance.HomeFilePathList[0]); } Config.Instance.Save(); - //妫�娴嬩綇瀹呭璞� - if (Config.Instance.Home.Id == string.Empty) - { - Config.Instance.Home = House.GetHouseByHouseId(Config.Instance.HomeId); - } } } } @@ -437,6 +444,22 @@ return null; } + /// <summary> + /// 璁剧疆褰撳墠妤煎眰鐨処D + /// </summary> + public void SetCurrentFloorId() + { + if (Config.Instance.Home.FloorDics.Count > 0 && string.IsNullOrEmpty(CurrentFloorId)) + { + foreach (var floor in Config.Instance.Home.FloorDics) + { + CurrentFloorId = floor.Key; + Save(false); + return; + } + } + } + #endregion #region 鈼� 鎴块棿____________________________ @@ -444,19 +467,17 @@ #region 鈼� 娣诲姞鎴块棿璺緞_________________________ /// <summary> - /// 娣诲姞銆愭埧闂磋矾寰勩�戝埌鎴块棿璺緞鍒楄〃 + /// 娣诲姞鎴块棿ID /// </summary> /// <returns><c>true</c>, if room list file path was added, <c>false</c> otherwise.</returns> /// <param name="roomFilePath">Room file path.</param> - public bool AddRoomListFilePath(string roomFilePath) + public void AddRoomId(string roomId) { - if (RoomFilePathList.Contains(roomFilePath)) - { - return false; + if (ListRooms.Contains(roomId) == false) + { + ListRooms.Add(roomId); + this.Save(); } - RoomFilePathList.Add(roomFilePath); - Save(); - return true; } #endregion @@ -464,19 +485,17 @@ #region 鈼� 鍒犻櫎鎴块棿璺緞_________________________ /// <summary> - /// 绉婚櫎鎴块棿璺緞 + /// 绉婚櫎鎴块棿Id /// </summary> /// <returns><c>true</c>, if room list file path was added, <c>false</c> otherwise.</returns> /// <param name="roomFilePath">Room file path.</param> - public bool RemoveRoomListFilePath(string roomFilePath) + public void RemoveRoomId(string roomId) { - if (!RoomFilePathList.Contains(roomFilePath)) - { - return false; + if (ListRooms.Contains(roomId)==true) + { + ListRooms.Remove(roomId); + Save(); } - RoomFilePathList.Remove(roomFilePath); - Save(); - return true; } #endregion -- Gitblit v1.8.0