| | |
| | | { |
| | | LoadEvent_SwitchHome(); |
| | | LoadEvent_GoPersonalDataPage(); |
| | | if (MainPage.LoginUser.accountType == 0) |
| | | if (!DB_ResidenceData.residenceData.residecenInfo.IsOthreShare) |
| | | { |
| | | LoadEvent_SkipResdentialManagePage(); |
| | | } |
| | | if (!DB_ResidenceData.residenceData.residecenInfo.IsOthreShare) |
| | | { |
| | | LoadEvent_GoMemberManagement(); |
| | | } |
| | | } |
| | | |
| | |
| | | #if DEBUG |
| | | btnUserTypeName.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var pm = new HDL_ON.DAL.Server.HttpServerRequest(); |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | var iddd = pm.GetRegionLastBackupId(); |
| | | Dialog dialog = new Dialog(); |
| | | |
| | |
| | | BackgroundColor = CSS.CSS_Color.BackgroundColor |
| | | }); |
| | | } |
| | | |
| | | dialog.Show(); |
| | | |
| | | }; |
| | | #endif |
| | | |
| | | |
| | | btnCurResidenceName.MouseUpEventHandler += (sender, e) => { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | var dialog = new Dialog(); |
| | | var dialogBody = new FrameLayout(); |
| | | dialog.AddChidren(dialogBody); |
| | | dialogBody.MouseUpEventHandler += (sender1, e1) => { |
| | | dialogBody.MouseUpEventHandler = (sender1, e1) => { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(22), |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(268), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(198), |
| | | BackgroundImagePath = "PersonalCenter/HomeListbg.png", |
| | | Height = Application.GetRealHeight(110), |
| | | BackgroundImagePath = "PersonalCenter/HomeList1bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | var contentView = new VerticalScrolViewLayout() { |
| | | X = Application.GetRealWidth(8), |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(22), |
| | | Y = Application.GetRealHeight(15), |
| | | Width = Application.GetRealWidth(150), |
| | | Height = Application.GetRealHeight(45*4), |
| | | Height = Application.GetRealHeight(45 ), |
| | | ScrollEnabled = false |
| | | }; |
| | | dispalyView.AddChidren(contentView); |
| | | |
| | | foreach(var home in MainPage.LoginUser.regionList) |
| | | if (MainPage.LoginUser.regionList.Count < 3) |
| | | { |
| | | } |
| | | else if (MainPage.LoginUser.regionList.Count < 4) |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(268), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(155), |
| | | BackgroundImagePath = "PersonalCenter/HomeList2bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 3); |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | else if (MainPage.LoginUser.regionList.Count < 5) |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(268), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(200), |
| | | BackgroundImagePath = "PersonalCenter/HomeList3bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 4); |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | else |
| | | { |
| | | dispalyView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(10), |
| | | Y = Application.GetRealHeight(268), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(245), |
| | | BackgroundImagePath = "PersonalCenter/HomeList4bg.png", |
| | | }; |
| | | dialogBody.AddChidren(dispalyView); |
| | | |
| | | contentView.Height = Application.GetRealHeight(45 * 5); |
| | | contentView.ScrollEnabled = true; |
| | | dispalyView.AddChidren(contentView); |
| | | } |
| | | |
| | | |
| | | |
| | | foreach (var home in MainPage.LoginUser.regionList) |
| | | { |
| | | var btnHomeName = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | |
| | | TextSize = home.Name.Length > 14 ? CSS.CSS_FontSize.TextFontSize : CSS.CSS_FontSize.SubheadingFontSize, |
| | | IsSelected = DB_ResidenceData.residenceData.residecenInfo.RegionID == home.RegionID, |
| | | IsMoreLines = true, |
| | | Tag = MainPage.LoginUser.regionList.IndexOf(home) |
| | | Tag = home.RegionID |
| | | }; |
| | | contentView.AddChidren(btnHomeName); |
| | | //if(btnHomeName) |
| | | |
| | | if (MainPage.LoginUser.regionList.IndexOf(home) < MainPage.LoginUser.regionList.Count - 1) |
| | | { |
| | | contentView.AddChidren(new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(112), |
| | | Height = Application.GetRealHeight(1), |
| | | BackgroundColor = CSS.CSS_Color.BackgroundColor |
| | |
| | | |
| | | btnHomeName.MouseUpEventHandler += (senderH, en) => |
| | | { |
| | | var regionIndex = (int)btnHomeName.Tag; |
| | | var regionId = (string)btnHomeName.Tag; |
| | | dialog.Close(); |
| | | |
| | | DB_ResidenceData.residenceData.CurReginIndex = regionIndex; |
| | | btnCurResidenceName.Text = DB_ResidenceData.residenceData.residecenInfo.Name; |
| | | OnAppConfig.Instance.SaveUserConfig(); |
| | | LoadEvent_ChangeCurHome(MainPage.LoginUser.regionList.Find((obj) => obj.RegionID == regionId)); |
| | | LoadContentView(); |
| | | }; |
| | | } |
| | | |
| | | dialog.Show(); |
| | | }; |
| | | } |
| | | |
| | | btnResidenceDownIcon.MouseUpEventHandler = eventHandler; |
| | | btnCurResidenceName.MouseUpEventHandler = eventHandler; |
| | | } |
| | | /// <summary> |
| | | /// 更换当前选中住宅 |
| | | /// </summary> |
| | | /// <param name="homeTemp"></param> |
| | | void LoadEvent_ChangeCurHome(RegionInfoRes homeTemp) |
| | | { |
| | | if (DB_ResidenceData.residenceData.CurReginID == homeTemp.RegionID) |
| | | { |
| | | return; |
| | | } |
| | | var waitPage = new Loading(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var backuplist = FileUtils.ReadFiles(); |
| | | int index = 0; |
| | | string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); |
| | | FileUtils.DeleteRegionFiles(oldRegionRootPath); |
| | | //移动文件 |
| | | foreach (var fileName in backuplist) |
| | | { |
| | | System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); |
| | | if(fileName == "headImage.png") |
| | | { |
| | | continue; |
| | | } |
| | | if (fileInfo.Exists) |
| | | { |
| | | fileInfo.MoveTo(oldRegionRootPath + fileName); |
| | | MainPage.Log("move file : " + fileName); |
| | | } |
| | | index++; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | int pro = (int)(index * 1.0 / backuplist.Count * 50); |
| | | waitPage.Text = pro.ToString() + "%"; |
| | | }); |
| | | } |
| | | //删除本地文件 |
| | | foreach (var fileName in backuplist) |
| | | { |
| | | if (fileName == "headImage.png") |
| | | { |
| | | continue; |
| | | } |
| | | FileUtils.DeleteFile(fileName); |
| | | } |
| | | //倒出新住宅数据 |
| | | string newRegionRootPath = FileUtils.CreateRegionBackup(homeTemp.RegionID.ToString()); |
| | | FileUtils.RestoreRegionFiles(newRegionRootPath); |
| | | MainPage.LoginUser.SaveUserInfo(); |
| | | DB_ResidenceData.residenceData.EixtAccount(); |
| | | DB_ResidenceData.residenceData.CurReginID = homeTemp.RegionID; |
| | | OnAppConfig.Instance.SaveUserConfig(); |
| | | DB_ResidenceData.InitRoomFunction(); |
| | | DB_ResidenceData.residenceData.SaveResidenceData(); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnCurResidenceName.Text = DB_ResidenceData.residenceData.residecenInfo.Name; |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.OperationFailed), |
| | | Language.StringByID(StringId.Close)).Show(); |
| | | }); |
| | | MainPage.Log(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | #endregion |
| | | |
| | | #region 住宅管理 |
| | | void LoadEvent_SkipResdentialManagePage() |
| | | { |
| | | if (MainPage.LoginUser.accountType == 0) |
| | | if (!DB_ResidenceData.residenceData.residecenInfo.IsOthreShare) |
| | | { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | |
| | | #region 个人中心 |
| | | void LoadEvent_GoPersonalDataPage() |
| | | { |
| | | userHeadImageView.MouseUpEventHandler += (sender, e) => { |
| | | Action updataHeadImage = () => { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | Action updataHeadImage = () => |
| | | { |
| | | userHeadImageView.ImagePath = MainPage.LoginUser.headImagePagePath; |
| | | }; |
| | | Action updataUserName = () => { |
| | | Action updataUserName = () => |
| | | { |
| | | btnUserName.Text = MainPage.LoginUser.userName; |
| | | }; |
| | | |
| | | var personalDataView = new PersonalDataPage(updataHeadImage,updataUserName); |
| | | var personalDataView = new PersonalDataPage(updataHeadImage, updataUserName); |
| | | MainPage.BasePageView.AddChidren(personalDataView); |
| | | personalDataView.LoadView(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | userHeadImageView.MouseUpEventHandler = eventHandler; |
| | | btnUserName.MouseUpEventHandler = eventHandler; |
| | | btnEmail.MouseUpEventHandler = eventHandler; |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 成员管理 |
| | | void LoadEvent_GoMemberManagement() |
| | | { |
| | | |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => { |
| | | //}; |
| | | //residenceMemberView.MouseUpEventHandler = (sender, e) => { |
| | | //Action updataHeadImage = () => { |
| | | // userHeadImageView.ImagePath = MainPage.LoginUser.headImagePagePath; |
| | | //}; |
| | | //Action updataUserName = () => { |
| | | // btnUserName.Text = MainPage.LoginUser.userName; |
| | | //}; |
| | | |
| | | var mmp = new MemberManagementPage(); |
| | | MainPage.BasePageView.AddChidren(mmp); |
| | | mmp.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnResidenceMemberIcon.MouseUpEventHandler = eHandler; |
| | | btnResidenceMemberText.MouseUpEventHandler = eHandler; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |