From dee21bf452a8979d0515d13e534fbb69ed9715dd Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 01 九月 2020 15:33:13 +0800
Subject: [PATCH] 上传一个版本
---
ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs | 443 +++++++++++++++++++++++++++++++++----------------------
1 files changed, 266 insertions(+), 177 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
index 93cc3e8..76cb9dc 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceManagementForm.cs
@@ -14,19 +14,15 @@
/// <summary>
/// 妗屽竷鎺т欢
/// </summary>
- private FrameLayout frameTable = null;
+ private NormalFrameLayout frameTable = null;
/// <summary>
- /// 鍒楄〃鎺т欢
+ /// 鍒楄〃鎺т欢(鐧借壊鑳屾櫙)
/// </summary>
- private VerticalListControl listView = null;
+ private FrameListControl listView = null;
/// <summary>
- /// 妤煎眰椤哄簭
+ /// 鏁翠釜鐣岄潰鐨勪笂涓嬫粦鍔ㄦ帶浠�
/// </summary>
- private List<string> listFloorSort = new List<string>();
- /// <summary>
- /// 鎴块棿椤哄簭
- /// </summary>
- private List<string> listRoomSort = new List<string>();
+ private VerticalFrameControl listBackContr = null;
/// <summary>
/// 褰撳墠APP鐨勪綇瀹呮ā寮� 0:杩樻病鏈夎缃湁妯″紡 1:妤煎眰妯″紡 2:娌℃湁妤煎眰妯″紡
/// </summary>
@@ -48,8 +44,12 @@
//涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟
if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
{
- //鍒濆鍖栧彸涓婅鑿滃崟
- this.InitTopRightMenu();
+ //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈�
+ if (Common.Config.Instance.Home.IsShowTemplate == false)
+ {
+ //鍒濆鍖栧彸涓婅鑿滃崟
+ this.InitTopRightMenu();
+ }
}
//鍒濆鍖栦腑閮ㄤ俊鎭�
this.InitMiddleFrame(i_CanDeleteResidence);
@@ -64,10 +64,16 @@
//娓呯┖bodyFrame
this.ClearBodyFrame();
+ //鏁翠釜鐣岄潰鐨勪笂涓嬫粦鍔ㄦ帶浠�
+ this.listBackContr = new VerticalFrameControl();
+ listBackContr.Height = bodyFrameLayout.Height;
+ bodyFrameLayout.AddChidren(listBackContr);
+
+ //浣忓畢琛�
var rowHome = new RowLayoutControl();
rowHome.Height = Application.GetRealHeight(173);
rowHome.BackgroundColor = UserCenterColor.Current.White;
- bodyFrameLayout.AddChidren(rowHome);
+ listBackContr.frameTable.AddChidren(rowHome);
rowHome.frameTable.UseClickStatu = false;
var btnAdreeIcon = rowHome.frameTable.AddLeftIcon(81);
@@ -77,13 +83,13 @@
var btnHomeName = rowHome.frameTable.AddLeftCaption(Common.Config.Instance.Home.Name, 700, 60);
btnHomeName.TextSize = 15;
btnHomeName.Y = Application.GetRealHeight(35);
- rowHome.frameTable.AddChidren(btnHomeName, ChidrenBindMode.BindEventOnly);
+ rowHome.frameTable.AddChidren(btnHomeName, ChidrenBindMode.BindEvent);
//褰撳墠浣忓畢
var btnNowView = rowHome.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uNowResidence), 700, 49);
btnNowView.TextSize = 12;
btnNowView.Y = Application.GetRealHeight(95);
btnNowView.TextColor = UserCenterColor.Current.TextGrayColor1;
- rowHome.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEventOnly);
+ rowHome.frameTable.AddChidren(btnNowView, ChidrenBindMode.BindEvent);
//涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟
if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
{
@@ -92,30 +98,27 @@
}
//缁忕含搴�
var btnLocation = rowHome.frameTable.AddMostRightView(string.Empty, 500);
- btnLocation.Text = this.GetLatitudeAndLongitudeText(Common.Config.Instance.Home.Longitude, Common.Config.Instance.Home.Latitude);
+ btnLocation.IsMoreLines = true;
+ btnLocation.TextSize = 10;
+ btnLocation.Text = Common.Config.Instance.Home.ResidenceAddressName;
//涓讳汉鎴栬�呯鐞嗗憳鎵嶄細鍑虹幇杩欎釜鑿滃崟
if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
{
rowHome.frameTable.UseClickStatu = true;
+ //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈�
+ if (Common.Config.Instance.Home.IsShowTemplate == true)
+ {
+ rowHome.frameTable.CanClick = false;
+ }
rowHome.frameTable.ButtonClickEvent += (sender, e) =>
{
- //榛樿鍊� 23.134421,113.267189
- double latitude = Common.Config.Instance.Home.Latitude;
- double longitude = Common.Config.Instance.Home.Longitude;
- //鍦板浘
- GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
- {
- HdlThreadLogic.Current.RunThread(() =>
- {
- //淇濆瓨浣忓畢鍦板潃
- this.SaveResidenceAdrress(btnLocation, mLatitude, mLongitude);
- });
- }, Language.StringByID(R.MyInternationalizationString.uSelectAdrress), true, latitude, longitude, 100);
+ //妫�娴嬫潈闄�,鐒跺悗鏄剧ず鍦板浘
+ this.CheckAuthorityAndShowMap(btnLocation);
};
}
- if (i_CanDeleteResidence == true)
+ if (i_CanDeleteResidence == true && Common.Config.Instance.Home.IsShowTemplate == false)
{
//鍒犻櫎
var btnDelete = new NormalViewControl(Application.GetRealWidth(184), rowHome.Height, false);
@@ -139,10 +142,10 @@
};
}
//鍒濆鍖栨甯�
- this.frameTable = new FrameLayout();
+ this.frameTable = new NormalFrameLayout();
frameTable.Y = rowHome.Bottom + Application.GetRealHeight(23);
- frameTable.Height = bodyFrameLayout.Height - rowHome.Bottom - Application.GetRealHeight(23);
- bodyFrameLayout.AddChidren(frameTable);
+ frameTable.Height = listBackContr.frameTable.Height - rowHome.Bottom - Application.GetRealHeight(23);
+ listBackContr.frameTable.AddChidren(frameTable);
//鏍规嵁鎸囧畾妯″紡,鍒濆鍖栨甯冩帶浠�
this.InitFrameTableByMode();
@@ -194,7 +197,7 @@
frame.AddRowMenu(Language.StringByID(R.MyInternationalizationString.uCreatFloor), "Item/CreatFloor.png", "Item/CreatFloorSelected.png", () =>
{
//鍒涘缓妤煎眰
- this.CreatOrEditorFloor(null, string.Empty, string.Empty);
+ this.CreatOrEditorFloor(null, null, string.Empty, string.Empty);
});
//鍒涘缓鎴块棿
frame.AddRowMenu(Language.StringByID(R.MyInternationalizationString.uCreatRoom), "Item/RoomIcon.png", "Item/RoomIconSelected.png", () =>
@@ -212,7 +215,7 @@
else if (AppResidenceMode == 1)
{
//鍒涘缓妤煎眰
- this.CreatOrEditorFloor(null, string.Empty, string.Empty);
+ this.CreatOrEditorFloor(null, null, string.Empty, string.Empty);
}
//鏃犳ゼ灞傛ā寮�
else if (AppResidenceMode == 2)
@@ -241,7 +244,7 @@
frameFloor.UseClickStatu = false;
frameFloor.Height = Application.GetRealHeight(115);
frameFloor.BackgroundColor = UserCenterColor.Current.White;
- frameTable.AddChidren(frameFloor);
+ this.frameTable.AddChidren(frameFloor);
//妤煎眰
var btnFloor = frameFloor.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFloor), 200, 60);
@@ -250,11 +253,11 @@
btnFloor.TextSize = 15;
frameFloor.AddChidren(btnFloor, ChidrenBindMode.NotBind);
- listView = new VerticalListControl(29);
+ listView = new FrameListControl(29);
listView.BackgroundColor = UserCenterColor.Current.White;
listView.Y = frameFloor.Bottom;
listView.Height = frameTable.Height - frameFloor.Bottom;
- frameTable.AddChidren(listView);
+ this.frameTable.AddChidren(listView);
//鍒濆鍖栨ゼ灞傝
this.InitFloorRow();
@@ -267,26 +270,20 @@
{
//鑾峰彇妤煎眰
var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
- this.listFloorSort.Clear();
- foreach (string keys in dicFloor.Keys)
- {
- listFloorSort.Add(keys);
- }
-
- if (Common.Config.Instance.Home.FloorDics.Count == 0)
+ if (dicFloor.Count == 0)
{
return;
}
HdlThreadLogic.Current.RunMainInThread(() =>
{
- int count = listFloorSort.Count - 1;
- for (int i = 0; i < listFloorSort.Count; i++)
+ int count = dicFloor.Count;
+ foreach (var keys in dicFloor.Keys)
{
- string keys = listFloorSort[i];
- this.AddFloorRow(keys, dicFloor[keys], i != count);
+ count--;
+ this.AddFloorRow(keys, dicFloor[keys], count != 0);
}
//璋冩暣鎺т欢楂樺害
- listView.AdjustRealHeight(Application.GetRealHeight(23));
+ this.AdjustContrlTableHeight();
});
}
@@ -303,6 +300,7 @@
private void AddFloorRow(string keys, string floorName, bool addLine)
{
var frameRow = new RowLayoutControl(listView.rowSpace / 2);
+ frameRow.MainKeys = keys;
this.listView.AddChidren(frameRow);
//鍥炬爣
var btnIcon = frameRow.frameTable.AddLeftIcon(81);
@@ -324,18 +322,18 @@
if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
{
+ //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈�
+ if (Common.Config.Instance.Home.IsShowTemplate == true)
+ {
+ return;
+ }
//鏇存敼
- var btnChanged = new NormalViewControl(Application.GetRealWidth(184), frameRow.Height, false);
- btnChanged.BackgroundColor = 0xff4a4a4a;
- btnChanged.TextSize = 12;
- btnChanged.TextColor = UserCenterColor.Current.White;
- btnChanged.TextAlignment = TextAlignment.Center;
+ var btnChanged = frameRow.AddEditorControl();
btnChanged.TextID = R.MyInternationalizationString.uChanged1;
- frameRow.AddRightView(btnChanged);
btnChanged.ButtonClickEvent += (sender, e) =>
{
//鍒涘缓鎴栬�呯紪杈戞ゼ灞�
- this.CreatOrEditorFloor(btnFloor, keys, floorName);
+ this.CreatOrEditorFloor(frameRow, btnFloor, keys, floorName);
};
//鍒犻櫎
@@ -355,14 +353,16 @@
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)
+ var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+ foreach (var floorId in dicFloor.Keys)
{
- //鎶婄涓�涓ゼ灞侷D缁欏畠
+ //鎶婄涓�涓ゼ灞傝祴鍊肩粰褰撳墠妤煎眰
Common.Config.Instance.Home.CurrentFloorId = floorId;
break;
}
+ //鍒犻櫎褰撳墠妤煎眰鐨勮瘽,闇�瑕佸幓鍒锋柊涓婚〉宸﹁竟鐨勬埧闂村垪琛�
+ HdlRoomLogic.Current.RefreshRoomListView();
}
var listDeleteId = new List<string>();
var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
@@ -373,20 +373,12 @@
listDeleteId.Add(listAllRoom[i].Id);
}
}
- //濡傛灉褰撳墠閫夋嫨鐨勬埧闂存槸鍒犻櫎瀵硅薄鐨勮瘽
- if (HdlRoomLogic.Current.CurrentRoom.FloorId == keys)
- {
- HdlRoomLogic.Current.CurrentRoom = HdlRoomLogic.Current.GetLoveRoom();
- }
//鍒犻櫎鎴块棿
foreach (string roomId in listDeleteId)
{
HdlRoomLogic.Current.RemoveRoom(roomId);
}
Common.Config.Instance.Home.Save();
- //淇濆瓨椤哄簭
- listFloorSort.Remove(keys);
- HdlRoomLogic.Current.SaveFloorSort(listFloorSort);
if (Common.Config.Instance.Home.FloorDics.Count == 0)
{
@@ -395,9 +387,27 @@
}
else
{
+ bool canMove = false;
+ for (int i = 0; i < listView.ChildrenCount; i++)
+ {
+ var myRow = listView.GetChildren(i) as RowLayoutControl;
+ if (myRow != null && myRow.MainKeys == keys)
+ {
+ canMove = true;
+ continue;
+ }
+ if (canMove == true)
+ {
+ //瀹冧箣鍚庣殑琛岋紝鍏ㄩ儴寰�涓婄Щ
+ myRow.Y -= frameRow.Height;
+ }
+ }
frameRow.RemoveFromParent();
- listView.AdjustRealHeight(Application.GetRealHeight(23));
+ //璋冩暣妗屽竷楂樺害
+ this.AdjustContrlTableHeight();
}
+ //鍒犻櫎妤煎眰鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
+ UserView.UserPage.Instance.RefreshAllForm = true;
});
};
}
@@ -409,7 +419,7 @@
/// <param name="btnFloor"></param>
/// <param name="keys"></param>
/// <param name="floorName"></param>
- private void CreatOrEditorFloor(NormalViewControl btnFloor, string keys, string floorName)
+ private void CreatOrEditorFloor(RowLayoutControl frameRow, NormalViewControl btnFloor, string keys, string floorName)
{
//鐢熸垚涓�涓脊绐楃敾闈�
var dialogForm = new DialogInputControl();
@@ -434,6 +444,9 @@
//鎸変笅纭鎸夐挳
dialogForm.ComfirmClickEvent += ((textValue) =>
{
+ //杩樺師宸﹀彸鑿滃崟
+ frameRow?.HideMenu();
+
if (this.CheckFloorName(keys, textValue) == false)
{
//妤煎眰鍚嶇О妫�娴�
@@ -448,8 +461,15 @@
{
keys = Guid.NewGuid().ToString();
}
+ bool hadFloor = Common.Config.Instance.Home.CurrentFloorId != string.Empty;
Common.Config.Instance.Home.FloorDics[keys] = textValue;
Common.Config.Instance.Home.Save();
+ if (hadFloor == false)
+ {
+ //鍒涘缓绗竴涓柊鐨勬ゼ灞傜殑璇�,闇�瑕佸幓鍒锋柊涓婚〉宸﹁竟鐨勬埧闂村垪琛�
+ HdlRoomLogic.Current.RefreshRoomListView();
+ }
+
if (btnFloor != null)
{
btnFloor.Text = textValue;
@@ -459,6 +479,8 @@
//鏍规嵁鎸囧畾妯″紡,鍒濆鍖栨甯冩帶浠�
this.InitFrameTableByMode();
}
+ //鍒涘缓鎴栬�呬慨鏀规ゼ灞傜殑璇�,涓婚〉闇�瑕侀噸鏂板埛鏂�
+ UserView.UserPage.Instance.RefreshAllForm = true;
}
});
}
@@ -486,7 +508,7 @@
btnRoomList.TextSize = 15;
frameRoom.AddChidren(btnRoomList, ChidrenBindMode.NotBind);
- listView = new VerticalListControl(29);
+ listView = new FrameListControl(29);
listView.BackgroundColor = UserCenterColor.Current.White;
listView.Y = frameRoom.Bottom;
listView.Height = frameTable.Height - frameRoom.Bottom;
@@ -503,19 +525,13 @@
{
//鑾峰彇妤煎眰鐨勬埧闂�
var listRoom = HdlRoomLogic.Current.GetFloorSortRoom(string.Empty);
- this.listRoomSort.Clear();
- for (int i = 0; i < listRoom.Count; i++)
- {
- this.listRoomSort.Add(listRoom[i].Id);
- }
-
for (int i = 0; i < listRoom.Count; i++)
{
//娣诲姞鎴块棿琛�
this.AddRoomRow(listRoom[i], i != listRoom.Count - 1);
}
- //璋冩暣鎺т欢鐪熷疄楂樺害
- listView.AdjustRealHeight(Application.GetRealHeight(23));
+ //璋冩暣妗屽竷楂樺害
+ this.AdjustContrlTableHeight();
}
#endregion
@@ -530,6 +546,7 @@
private void AddRoomRow(Common.Room room, bool addLine)
{
var frameRow = new RowLayoutControl(listView.rowSpace / 2);
+ frameRow.MainKeys = room.Id;
listView.AddChidren(frameRow);
//鍥炬爣
var btnIcon = frameRow.frameTable.AddLeftIcon(81);
@@ -555,7 +572,6 @@
//濡傛灉鏄垎浜殑鎴块棿锛屼笉鑳界紪杈戝拰淇敼
return;
}
-
//缂栬緫
var btnEditor = frameRow.AddEditorControl();
btnEditor.ButtonClickEvent += (sender, e) =>
@@ -567,7 +583,12 @@
btnName.Text = roomName;
};
};
-
+ //鏌ョ湅妯℃澘鏃�,涓嶅厑璁哥紪杈�
+ if (Common.Config.Instance.Home.IsShowTemplate == true)
+ {
+ btnEditor.Text = Language.StringByID(R.MyInternationalizationString.uSearch1);
+ return;
+ }
//鍒犻櫎
var btnDelete = frameRow.AddDeleteControl();
btnDelete.ButtonClickEvent += (sender, e) =>
@@ -575,15 +596,7 @@
//纭鍒犻櫎鎴块棿?
this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uDeleteRoomMsg), () =>
{
- if (HdlRoomLogic.Current.CurrentRoom.Id == room.Id)
- {
- //濡傛灉鍒犻櫎鐨勬槸褰撳墠鎴块棿鐨勮瘽
- HdlRoomLogic.Current.CurrentRoom = HdlRoomLogic.Current.GetLoveRoom();
- }
HdlRoomLogic.Current.RemoveRoom(room.Id);
- //淇濆瓨椤哄簭
- this.listRoomSort.Remove(room.Id);
- HdlRoomLogic.Current.SaveRoomSort(string.Empty, this.listRoomSort);
var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
if (listAllRoom.Count <= 1)
@@ -593,9 +606,27 @@
}
else
{
+ bool canMove = false;
+ for (int i = 0; i < listView.ChildrenCount; i++)
+ {
+ var myRow = listView.GetChildren(i) as RowLayoutControl;
+ if (myRow != null && myRow.MainKeys == room.Id)
+ {
+ canMove = true;
+ continue;
+ }
+ if (canMove == true)
+ {
+ //瀹冧箣鍚庣殑琛岋紝鍏ㄩ儴寰�涓婄Щ
+ myRow.Y -= frameRow.Height;
+ }
+ }
frameRow.RemoveFromParent();
- listView.AdjustRealHeight(Application.GetRealHeight(23));
+ //璋冩暣妗屽竷楂樺害
+ this.AdjustContrlTableHeight();
}
+ //鍒犻櫎鎴块棿鐨勮瘽,涓婚〉闇�瑕侀噸鏂板埛鏂�
+ UserView.UserPage.Instance.RefreshAllForm = true;
});
};
}
@@ -607,21 +638,41 @@
/// <summary>
/// 鍒犻櫎浣忓畢
/// </summary>
- public async void DeleteResidence()
+ private void DeleteResidence()
{
//寮�鍚繘搴︽潯
this.ShowProgressBar();
- var Pra = new DeleteResidencePra();
- Pra.HomeId = Common.Config.Instance.Home.Id;
- Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
-
- bool result = await UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
- if (result == false)
+ if (Common.Config.Instance.Home.IsOthreShare == false)
{
- //鍏抽棴杩涘害鏉�
- this.CloseProgressBar();
- return;
+ //鍒犻櫎涓讳汉鑷繁鐨勪綇瀹�
+ var Pra = new DeleteResidencePra();
+ Pra.HomeId = Common.Config.Instance.Home.Id;
+ Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+
+ bool result = UserCenterLogic.GetResultStatuByRequestHttps("App/DelHome", true, Pra);
+ if (result == false)
+ {
+ //鍏抽棴杩涘害鏉�
+ this.CloseProgressBar();
+ return;
+ }
+ }
+ else
+ {
+ //鍒犻櫎鍒嗕韩鐨勪綇瀹�
+ var Pra2 = new
+ {
+ HomeId = Common.Config.Instance.Home.Id,
+ PrimaryUserId = Common.Config.Instance.Home.MainUserDistributedMark
+ };
+ bool result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/SubAccountDelShareHome", false, Pra2);
+ if (result == false)
+ {
+ //鍏抽棴杩涘害鏉�
+ this.CloseProgressBar();
+ return;
+ }
}
//鍥犱负鍒犻櫎鐨勬槸褰撳墠鐨勪綇瀹�,鎵�浠ラ渶瑕佸厛鍒囨崲鍒板埆鐨勪綇瀹�
@@ -647,24 +698,89 @@
}
}
- var myHouse = Common.House.GetHouseByFilePath(Common.Config.Instance.HomeFilePathList[index]);
+ var myHouse = HdlResidenceLogic.Current.GetHouseByFilePath(Common.Config.Instance.HomeFilePathList[index]);
//鍒囨崲浣忓畢
Common.Config.Instance.HomeId = myHouse.Id;
+ Common.Config.Instance.Home = myHouse;
Common.Global.CreateHomeDirectory(myHouse.Id);
Common.Config.Instance.Save();
//鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
- await UserCenterLogic.InitUserCenterMenmoryAndThread(false);
- HdlRoomLogic.Current.InitAllRoom();
+ bool result2 = UserCenterLogic.InitUserCenterMenmoryAndThread(false);
+ if (result2 == false)
+ {
+ //寮�鍚簡璋冭瘯鍔熻兘
+ return;
+ }
//鍒犻櫎浣忓畢
- Common.House.DeleteHouseByHouseId(deleteId);
+ HdlResidenceLogic.Current.DeleteHouseMemmory(deleteId);
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
//鍏抽棴鐣岄潰
this.CloseForm();
});
+ }
+
+ #endregion
+
+ #region 鈻� 鏄剧ず鍦板浘___________________________
+
+ /// <summary>
+ /// 妫�娴嬫潈闄�,鐒跺悗鏄剧ず鍦板浘
+ /// </summary>
+ /// <param name="btnLocation">鍦板潃鏄剧ず鎺т欢</param>
+ private void CheckAuthorityAndShowMap(NormalViewControl btnLocation)
+ {
+#if Android
+ //鏄剧ず鍦板浘
+ this.ShowMap(btnLocation);
+ ////鐢宠瀹氫綅鏉冮檺
+ //((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) =>
+ //{
+ // if (result1 == false) { return; }
+ // //鐢宠璇绘潈闄�
+ // ((BaseActivity)Application.Activity).ReadWriteContact((result2) =>
+ // {
+ // if (result2 == false) { return; }
+ // //鐢宠璇诲彇鎵嬫満鍙锋潈闄�
+ // ((BaseActivity)Application.Activity).SetPermission((result3) =>
+ // {
+ // if (result3 == false) { return; }
+ // //鏄剧ず鍦板浘
+ // this.ShowMap(btnLocation);
+ // }, "android.permission.READ_PHONE_STATE");
+ // });
+ //});
+#endif
+#if iOS
+ //鏄剧ず鍦板浘
+ this.ShowMap(btnLocation);
+#endif
+ }
+
+ /// <summary>
+ /// 鏄剧ず鍦板浘
+ /// </summary>
+ /// <param name="btnLocation">鍦板潃鏄剧ず鎺т欢</param>
+ private void ShowMap(NormalViewControl btnLocation)
+ {
+ //榛樿鍊� 23.134421,113.267189
+ double latitude = Common.Config.Instance.Home.Latitude;
+ double longitude = Common.Config.Instance.Home.Longitude;
+ //鍦板浘
+ GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
+ {
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ //淇濆瓨浣忓畢鍦板潃
+ this.SaveResidenceAdrress(btnLocation, mLatitude, mLongitude, name);
+ });
+ },
+ Language.StringByID(R.MyInternationalizationString.uSelectAdrress),
+ Language.StringByID(R.MyInternationalizationString.uSave),
+ true, latitude, longitude, 100);
}
#endregion
@@ -677,54 +793,60 @@
/// <param name="btnLocation">鏄剧ず鎺т欢</param>
/// <param name="latitude">绾害</param>
/// <param name="longitude">缁忓害</param>
- private async void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude)
+ /// <param name="addresName">浣嶇疆鍚嶇О</param>
+ private void SaveResidenceAdrress(NormalViewControl btnLocation, double latitude, double longitude, string addresName)
{
- //寮�鍚繘搴︽潯
- this.ShowProgressBar();
-
- var Pra = new EditorResidencePra();
- Pra.HomeId = Common.Config.Instance.Home.Id;
- Pra.Name = Common.Config.Instance.Home.Name;
- Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
- Pra.Latitude = latitude;
- Pra.Longitude = longitude;
-
- //缂栬緫浣忓畢
- bool flage = await UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", true, Pra);
- if (flage == false)
+ //濡傛灉涓嶆槸铏氭嫙浣忓畢,鎵嶆洿鏂颁簯绔�
+ if (Common.Config.Instance.Home.IsVirtually == false)
{
- //鍏抽棴杩涘害鏉�
- this.CloseProgressBar();
- return;
- }
- //璁剧疆鍏ㄩ儴缃戝叧鐨勪綇瀹呭湴鍧�
- var listGateway = HdlGatewayLogic.Current.GetAllLocalGateway();
- foreach (var gateway in listGateway)
- {
- ZigBee.Device.ZbGateway realWay = null;
- if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, gateway) == false)
- {
- //閿欒:缃戝叧瀵硅薄涓㈠け
- continue;
- }
- var result = HdlGatewayLogic.Current.SetGatewaySite(gateway, longitude, latitude);
- if (result == false)
+ //寮�鍚繘搴︽潯
+ this.ShowProgressBar();
+
+ var Pra = new EditorResidencePra();
+ Pra.HomeId = Common.Config.Instance.Home.Id;
+ Pra.Name = Common.Config.Instance.Home.Name;
+ Pra.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+ Pra.Latitude = latitude;
+ Pra.Longitude = longitude;
+
+ //缂栬緫浣忓畢
+ bool flage = UserCenterLogic.GetResultStatuByRequestHttps("App/EditHome", true, Pra);
+ if (flage == false)
{
//鍏抽棴杩涘害鏉�
this.CloseProgressBar();
return;
}
+ //璁剧疆鍏ㄩ儴缃戝叧鐨勪綇瀹呭湴鍧�
+ var listGateway = HdlGatewayLogic.Current.GetAllLocalGateway();
+ foreach (var gateway in listGateway)
+ {
+ ZigBee.Device.ZbGateway realWay = null;
+ if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, gateway) == false)
+ {
+ //閿欒:缃戝叧瀵硅薄涓㈠け
+ continue;
+ }
+ var result = HdlGatewayLogic.Current.SetGatewaySite(gateway, longitude, latitude, ShowErrorMode.YES);
+ if (result == false)
+ {
+ //鍏抽棴杩涘害鏉�
+ this.CloseProgressBar();
+ return;
+ }
+ }
+ //鍏抽棴杩涘害鏉�
+ this.CloseProgressBar();
}
- //鍏抽棴杩涘害鏉�
- this.CloseProgressBar();
//淇濆瓨缂撳瓨
Common.Config.Instance.Home.Longitude = longitude;
Common.Config.Instance.Home.Latitude = latitude;
+ Common.Config.Instance.Home.ResidenceAddressName = addresName;
Common.Config.Instance.Home.Save();
HdlThreadLogic.Current.RunMain(() =>
{
- btnLocation.Text = this.GetLatitudeAndLongitudeText(longitude, latitude);
+ btnLocation.Text = addresName;
});
}
@@ -765,7 +887,7 @@
{
//璇疯緭鍏ヤ綇瀹呭悕绉�
string msg = Language.StringByID(R.MyInternationalizationString.uPleaseInputFloorName);
- this.ShowMassage(ShowMsgType.Error, msg);
+ this.ShowMassage(ShowMsgType.Tip, msg);
return false;
}
foreach (string floorKeys in Common.Config.Instance.Home.FloorDics.Keys)
@@ -774,7 +896,7 @@
{
//妤煎眰鍚嶇О宸茬粡瀛樺湪
string msg = Language.StringByID(R.MyInternationalizationString.uFloorNameIsExist);
- this.ShowMassage(ShowMsgType.Error, msg);
+ this.ShowMassage(ShowMsgType.Tip, msg);
return false;
}
}
@@ -782,47 +904,14 @@
}
/// <summary>
- /// 鑾峰彇缁忕含搴︾殑缈昏瘧鍚嶅瓧
+ /// 璋冩暣鎺т欢妗屽竷楂樺害
/// </summary>
- /// <param name="Longitude">缁忓害</param>
- /// <param name="Latitude">绾害</param>
- /// <returns></returns>
- private string GetLatitudeAndLongitudeText(double Longitude, double Latitude)
+ private void AdjustContrlTableHeight()
{
- string value1 = string.Empty;
- string value2 = string.Empty;
- if (Longitude == 0)
- {
- //榛樿涓滅粡
- value1 = "0掳00'E";
- }
- else if (Longitude > 0)
- {
- //涓滅粡
- value1 = Math.Round(Longitude, 2).ToString().Replace(".", "掳") + "'E";
- }
- else if (Longitude < 0)
- {
- //瑗跨粡
- value1 = Math.Round(-Longitude, 2).ToString().Replace(".", "掳") + "'W";
- }
-
- if (Latitude == 0)
- {
- //榛樿鍖楃含
- value2 = "0掳00'N";
- }
- else if (Latitude > 0)
- {
- //鍖楃含
- value2 = Math.Round(Latitude, 2).ToString().Replace(".", "掳") + "'N";
- }
- else if (Latitude < 0)
- {
- //鍗楃含
- value2 = Math.Round(-Latitude, 2).ToString().Replace(".", "掳") + "'S";
- }
- return value1 + " " + value2;
+ //璋冩暣妗屽竷楂樺害
+ listView.AdjustRealHeight(Application.GetRealHeight(23));
+ this.frameTable.Height = listView.Bottom;
+ this.listBackContr.AdjustTableHeight();
}
#endregion
--
Gitblit v1.8.0