From f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 30 十二月 2019 13:32:33 +0800
Subject: [PATCH] 2019-12-30-1

---
 ZigbeeApp/Shared/Common/House.cs |   40 +++++++++++++++++++++++++++++++---------
 1 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/House.cs b/ZigbeeApp/Shared/Common/House.cs
index a76d259..204d2a4 100755
--- a/ZigbeeApp/Shared/Common/House.cs
+++ b/ZigbeeApp/Shared/Common/House.cs
@@ -46,7 +46,15 @@
         /// <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>
         /// 鎴块棿璺緞鍒楄〃
@@ -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);
-                        }
                     }
                 }
             }
@@ -436,6 +443,21 @@
             }
             return null;
         }
+        /// <summary>
+        /// InitFloor
+        /// </summary>
+        public  void InitFloor()
+        {
+            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
 

--
Gitblit v1.8.0