| | |
| | | /// </summary> |
| | | /// <param name="home">Home.</param> |
| | | /// <param name="VerticalScrolViewMiddle">Vertical scrol view middle.</param> |
| | | void AddResidenceListRow (RegionInfoRes home, VerticalScrolViewLayout VerticalScrolViewMiddle ) |
| | | void AddResidenceListRow (RegionInfoRes home, VerticalScrolViewLayout VerticalScrolViewMiddle) |
| | | { |
| | | var rowView = new RowLayout () { |
| | | Height = Application.GetRealHeight (110), |
| | |
| | | }; |
| | | rowView.AddChidren (btnName); |
| | | |
| | | |
| | | //显示分享按钮 |
| | | if (home.IsOthreShare) { |
| | | Button FromSharingButton = new Button () { |
| | | X = Application.GetRealWidth (480), |
| | | Width = Application.GetRealWidth (30), |
| | | Height = Application.GetRealHeight (30), |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "CrabtreeAdd/FromSharing.png", |
| | | SelectedImagePath = "CrabtreeAdd/FromSharing.png", |
| | | }; |
| | | rowView.AddChidren (FromSharingButton); |
| | | } |
| | | |
| | | var goNextButton = new Button () { |
| | | X = Application.GetRealWidth (500), |
| | | Width = Application.GetRealWidth (120), |
| | | }; |
| | | rowView.AddChidren (goNextButton); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | Button rightButton1 = new Button () { |
| | |
| | | SelectedImagePath = "Item/RightSelected.png", |
| | | }; |
| | | rowView.AddChidren (rightButton1); |
| | | |
| | | |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => { |
| | | if (home.Id == UserConfig.Instance.CurrentRegion.Id) { |
| | | if (home.IsOthreShare) { |
| | | //提示没有分享住宅的权限 |
| | | new Alert ("", ErrorCode.InsufficientAuthority, "Close").Show (); |
| | | return; |
| | | } |
| | | //UserConfig.Instance.GatewayMAC = gatewayMAC; |
| | | var addGatewayDialog = new GuideAddGateway (); |
| | | (Parent as PageLayout).AddChidren (addGatewayDialog); |
| | |
| | | ChangeRegion (home); |
| | | } |
| | | }; |
| | | rightButton1.MouseUpEventHandler += eHandler; |
| | | rightButton1.MouseUpEventHandler += eHandler; |
| | | goNextButton.MouseUpEventHandler += eHandler; |
| | | btnName.MouseUpEventHandler += (sender,e)=> { |
| | | btnName.MouseUpEventHandler += (sender, e) => { |
| | | if (home.Id == UserConfig.Instance.CurrentRegion.Id) { |
| | | GuideAddHomeDialog (home, false,true, btnName); |
| | | if (home.IsOthreShare) { |
| | | //提示没有分享住宅的权限 |
| | | new Alert ("", ErrorCode.InsufficientAuthority, "Close").Show (); |
| | | return; |
| | | } |
| | | GuideAddHomeDialog (home, false, true, btnName); |
| | | } else { |
| | | ChangeRegion (home); |
| | | } |
| | |
| | | }; |
| | | rowView.AddRightView (btnDel); |
| | | btnDel.MouseUpEventHandler += (sd, ee) => { |
| | | if (home.IsOthreShare) { |
| | | //提示没有分享住宅的权限 |
| | | new Alert ("", ErrorCode.InsufficientAuthority, "Close").Show (); |
| | | return; |
| | | } |
| | | |
| | | Dialog dialog = new Dialog (); |
| | | |
| | | FrameLayout dialogBody = new FrameLayout () { |
| | |
| | | var requestObj = new LoginObj () { Account = MainPage.LoginUser.AccountString, Password = password }; |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj); |
| | | var revertObj = MainPage.RequestHttps (API.Login, requestJson); |
| | | if (revertObj.StateCode.ToUpper() == "SUCCESS") { |
| | | if (revertObj.StateCode.ToUpper () == "SUCCESS") { |
| | | |
| | | var requestObj2 = new DelHomeObj () { |
| | | HomeId = home.Id, |
| | |
| | | return; |
| | | } |
| | | if (isChangeName) { |
| | | home.Name = button.Text = etZoneName.Text; |
| | | var requestObj2 = new EditHomeObj () { HomeId = home.Id, Name = home.Name, LoginAccessToken = MainPage.LoginUser.LoginTokenString }; |
| | | //home.Name = button.Text = etZoneName.Text; |
| | | var requestObj2 = new EditHomeObj () { HomeId = home.Id, Name = etZoneName.Text, LoginAccessToken = MainPage.LoginUser.LoginTokenString }; |
| | | string urlHead = MainPage.RequestHttpsHost; |
| | | if (requestObj2.IsOtherAccountCtrl) { |
| | | urlHead = UserConfig.Instance.MasterAccountRequestBaseUrl; |
| | |
| | | if (revertObj2.StateCode.ToUpper () != "SUCCESS") { |
| | | ShowEditHomeErrorInfo (revertObj2.StateCode); |
| | | return; |
| | | } |
| | | } |
| | | home.Name = button.Text = etZoneName.Text; |
| | | IO.FileUtils.ReNameFoler (UserConfig.Instance.CurrentRegion.Name, home.Name); |
| | | return; |
| | | } |
| | |
| | | bool EditResidence (RegionInfoRes home, string residenceName, bool goToGuideAddGatewayView = false) |
| | | { |
| | | if (home.Name != residenceName) { |
| | | home.Name = residenceName; |
| | | |
| | | if (string.IsNullOrEmpty(home.Id)) { |
| | | var requestObj21 = new AddHomeObj () { |
| | | Name = residenceName , |
| | |
| | | ShowAddHomeErrorInfo (revertObj21.StateCode); |
| | | return false; |
| | | } |
| | | home.Name = residenceName; |
| | | //创建住宅成功,切换到该住宅 |
| | | var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoRes>> (revertObj21.ResponseData.ToString ()); |
| | | if (responseDataObj != null && responseDataObj.Count > 0) { |
| | |
| | | |
| | | } |
| | | } else { |
| | | var requestObj2 = new EditHomeObj () { HomeId = home.Id, Name = home.Name, LoginAccessToken = MainPage.LoginUser.LoginTokenString }; |
| | | var requestObj2 = new EditHomeObj () { HomeId = home.Id, Name = residenceName, LoginAccessToken = MainPage.LoginUser.LoginTokenString }; |
| | | string urlHead = MainPage.RequestHttpsHost; |
| | | if (requestObj2.IsOtherAccountCtrl) { |
| | | urlHead = UserConfig.Instance.MasterAccountRequestBaseUrl; |
| | |
| | | ShowEditHomeErrorInfo (revertObj2.StateCode); |
| | | return false; |
| | | } |
| | | home.Name = residenceName; |
| | | IO.FileUtils.ReNameFoler (UserConfig.Instance.CurrentRegion.Name, home.Name); |
| | | ChangeRegion (home, false, true, goToGuideAddGatewayView); |
| | | //CheckIfNeedAddRoom (); |