| | |
| | | base.RemoveFromParent (); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="stateCodeStr"></param> |
| | | void ShowGetHomePagerErrorInfo (string stateCodeStr) |
| | | { |
| | | string mes = ""; |
| | | //2020-01-06 待补充 |
| | | if (stateCodeStr == ErrorCode.NetworkError) { |
| | | mes = ErrorCode.NetworkError; |
| | | } else { |
| | | mes = ErrorCode.OperationFailed + ErrorCode.Reason + stateCodeStr; |
| | | |
| | | } |
| | | if (!string.IsNullOrEmpty (mes)) { |
| | | Application.RunOnMainThread (() => { |
| | | new Alert ("", mes, Language.StringByID (R.MyInternationalizationString.Close)).Show (); |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | public void InitRoomView (string RoomFilePath) |
| | | { |
| | | try { |
| | |
| | | Height = Application.GetRealHeight (26), |
| | | UnSelectedImagePath = "Room/godown.png", |
| | | }; |
| | | NameButton.Text = UserConfig.Instance.CurrentRegion.RegionName; |
| | | NameButton.Text = UserConfig.Instance.CurrentRegion.Name; |
| | | topView.AddChidren (btnGoDownTip); |
| | | |
| | | //顶部标题按钮切换住宅区域 |
| | |
| | | MainPage.Loading.Start (); |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | if (UserConfig.Instance.HomeLists.Count == 0) { |
| | | var requestObj2 = new HomeListObj (); |
| | | var requestObj2 = new GetHomePagerObj (); |
| | | requestObj2.ReqDto.LoginAccessToken = MainPage.LoginUser.LoginTokenString; |
| | | //var requestObj2 = new HomeListObj (); |
| | | var requestJson2 = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj2); |
| | | var revertObj2 = MainPage.RequestHttps ("HomeList", requestJson2); |
| | | if (revertObj2.StateCode == "SUCCESS") { |
| | | var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoRes>> (revertObj2.ResponseData.ToString ()); |
| | | UserConfig.Instance.HomeLists = responseDataObj; |
| | | UserConfig.Instance.SaveUserConfig (); |
| | | var revertObj2 = MainPage.RequestHttps (API.GetHomePager, requestJson2); |
| | | if (revertObj2.StateCode.ToUpper() == "SUCCESS") { |
| | | var mResidenceRes = Newtonsoft.Json.JsonConvert.DeserializeObject<ResidenceRes> (revertObj2.ResponseData.ToString ()); |
| | | |
| | | if (mResidenceRes.PageData != null && mResidenceRes.PageData.Count > 0) { |
| | | UserConfig.Instance.HomeLists = mResidenceRes.PageData; |
| | | UserConfig.Instance.SaveUserConfig (); |
| | | } |
| | | } else { |
| | | ShowGetHomePagerErrorInfo (revertObj2.StateCode); |
| | | } |
| | | } |
| | | Application.RunOnMainThread (() => { |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "Item/Point.png", |
| | | SelectedImagePath = "Item/Point.png", |
| | | Visible = homeTemp.RegionID != UserConfig.Instance.CurrentRegion.RegionID |
| | | Visible = homeTemp.Id != UserConfig.Instance.CurrentRegion.Id |
| | | }; |
| | | rowView.AddChidren (btnPoint); |
| | | |
| | | var btnName = new Button () { |
| | | Width = Application.GetRealWidth (550), |
| | | Text = homeTemp.RegionName, |
| | | Text = homeTemp.Name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | X = Application.GetRealWidth (90), |
| | | TextColor = SkinStyle.Current.TextColor1, |
| | |
| | | rowView.AddChidren (btnName); |
| | | |
| | | btnName.MouseUpEventHandler += (ss, ee) => { |
| | | if (UserConfig.Instance.CurrentRegion.RegionID == homeTemp.RegionID) { |
| | | if (UserConfig.Instance.CurrentRegion.Id == homeTemp.Id) { |
| | | return; |
| | | } |
| | | MainPage.Loading.Start ("Please wait..."); |
| | |
| | | try { |
| | | var backuplist = IO.FileUtils.ReadFiles (); |
| | | int index = 0; |
| | | string oldRegionRootPath = IO.FileUtils.CreateRegionBackup (UserConfig.Instance.CurrentRegion.RegionName); |
| | | string oldRegionRootPath = IO.FileUtils.CreateRegionBackup (UserConfig.Instance.CurrentRegion.Name); |
| | | IO.FileUtils.DeleteRegionFiles (oldRegionRootPath); |
| | | foreach (var fileName in backuplist) { |
| | | System.IO.FileInfo fileInfo = new System.IO.FileInfo (IO.FileUtils.RootPath + fileName); |
| | |
| | | }); |
| | | } |
| | | IO.FileUtils.DeleteAllFile (); |
| | | string newRegionRootPath = IO.FileUtils.CreateRegionBackup (homeTemp.RegionName); |
| | | string newRegionRootPath = IO.FileUtils.CreateRegionBackup (homeTemp.Name); |
| | | IO.FileUtils.RestoreRegionFiles (newRegionRootPath); |
| | | UserConfig.Instance.RefreshUserConfig (); |
| | | UserConfig.Instance.CurrentRegion = homeTemp; |
| | |
| | | } |
| | | }); |
| | | }; |
| | | if (homeTemp.RegionID == UserConfig.Instance.CurrentRegion.RegionID) { |
| | | if (homeTemp.Id == UserConfig.Instance.CurrentRegion.Id) { |
| | | Button btnCheck = new Button () { |
| | | X = Application.GetRealWidth (20), |
| | | Y = Application.GetRealHeight (25), |