wxr
2020-11-12 a715181089be0d31cd737a5367ffd02690b9d77f
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
@@ -15,13 +15,13 @@
        {
            LoadEvent_SwitchHome();
            LoadEvent_GoPersonalDataPage();
            LoadEvent_SkipAboutOnPage();
            LoadEvent_SkipGetSupportPage();
            if (!DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
            {
                LoadEvent_SkipResdentialManagePage();
            }
            if (!DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
            {
                LoadEvent_GoMemberManagement();
                LoadEvent_SkipbtnAddFunctionPage();
            }
        }
@@ -31,106 +31,92 @@
        /// </summary>
        void LoadEvent_SwitchHome()
        {
#if DEBUG
            btnUserTypeName.MouseUpEventHandler = (sender, e) =>
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                var pm = new DAL.Server.HttpServerRequest();
                var iddd = pm.GetRegionLastBackupId();
                Dialog dialog = new Dialog();
                FrameLayout bodyView = new FrameLayout();
                dialog.AddChidren(bodyView);
                bodyView.MouseUpEventHandler = (sender3, e3) => {
                    dialog.Close();
                };
                FrameLayout frame = new FrameLayout()
                {
                    Gravity = Gravity.Center,
                    Width = Application.GetRealWidth(280),
                    Height =Application.GetRealHeight(300),
                    BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
                    Radius = (uint)Application.GetRealWidth(16),
                };
                dialog.AddChidren(frame);
                Button btnTitleDialog = new Button()
                {
                    Height = Application.GetRealHeight(60),
                    TextAlignment = TextAlignment.Center,
                    Text = "数据恢复",
                    TextSize = CSS.CSS_FontSize.SubheadingFontSize,
                    TextColor = CSS.CSS_Color.SecondLevelTitleColor,
                    BackgroundColor = CSS.CSS_Color.PromptingColor2,
                };
                frame.AddChidren(btnTitleDialog);
                VerticalScrolViewLayout view = new VerticalScrolViewLayout()
                {
                    Y = Application.GetRealHeight(60),
                    Height = Application.GetRealHeight(240),
                };
                frame.AddChidren(view);
                foreach(var dd in iddd)
                {
                    Button btn = new Button()
                    {
                        Height = Application.GetRealHeight(50),
                        TextAlignment = TextAlignment.Center,
                        TextSize = CSS.CSS_FontSize.TextFontSize,
                        TextColor = CSS.CSS_Color.TextualColor,
                        Text = dd.Value,
                    };
                    view.AddChidren(btn);
                    btn.MouseUpEventHandler = (sender1, e1) =>
                    {
                        dialog.Close();
                        pm.GetBackupFileList(dd.Key);
                    };
                    view.AddChidren(new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Height = Application.GetRealHeight(1),
                        BackgroundColor = CSS.CSS_Color.BackgroundColor
                    });
                }
                dialog.Show();
            };
#endif
            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,
@@ -148,7 +134,6 @@
                    {
                        contentView.AddChidren(new Button()
                        {
                            Gravity = Gravity.CenterHorizontal,
                            Width = Application.GetRealWidth(112),
                            Height = Application.GetRealHeight(1),
                            BackgroundColor = CSS.CSS_Color.BackgroundColor
@@ -159,8 +144,9 @@
                    {
                        var regionId = (string)btnHomeName.Tag;
                        dialog.Close();
                        //DB_ResidenceData.residenceData.CurReginID = regionId;
                        LoadEvent_ChangeCurHome(MainPage.LoginUser.regionList.Find((obj) => obj.RegionID == regionId));
                        LoadContentView();
                    };
                }
                dialog.Show();
@@ -179,6 +165,10 @@
            {
                return;
            }
            string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString());
            string newRegionRootPath = FileUtils.CreateRegionBackup(homeTemp.RegionID.ToString());
            DB_ResidenceData.residenceData.CurReginID = homeTemp.RegionID;
            DB_ResidenceData.residenceData.SaveResidenceData();
            var waitPage = new Loading();
            new System.Threading.Thread(() =>
            {
@@ -186,13 +176,12 @@
                {
                    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")
                        if (fileName == "headImage.png")
                        {
                            continue;
                        }
@@ -218,7 +207,6 @@
                        FileUtils.DeleteFile(fileName);
                    }
                    //倒出新住宅数据
                    string newRegionRootPath = FileUtils.CreateRegionBackup(homeTemp.RegionID.ToString());
                    FileUtils.RestoreRegionFiles(newRegionRootPath);
                    MainPage.LoginUser.SaveUserInfo();
                    DB_ResidenceData.residenceData.EixtAccount();
@@ -260,7 +248,8 @@
            {
                EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
                {
                    Action updateResidenceName = () => {
                    Action updateResidenceName = () =>
                    {
                        btnCurResidenceName.Text = DB_ResidenceData.residenceData.residecenInfo.Name;
                    };
                    var residentialManagePage = new ResidentialManagePage(updateResidenceName);
@@ -303,17 +292,7 @@
        #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();
@@ -324,5 +303,50 @@
        }
        #endregion
        #region 添加设备
        void LoadEvent_SkipbtnAddFunctionPage()
        {
            EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
                var page = new SearchDevicePage();
                MainPage.BasePageView.AddChidren(page);
                page.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            btnResidenceAddFunctionIcon.MouseUpEventHandler = eventHandler;
            btnResidenceAddFunctionText.MouseUpEventHandler = eventHandler;
        }
        #endregion
        #region 关于On、获取支持
        /// <summary>
        /// 跳转至关于On页面
        /// </summary>
        void LoadEvent_SkipAboutOnPage()
        {
            btnAboutOnText.MouseUpEventHandler = (sender, e) =>
            {
                var aboutOnPage = new AboutOnPage();
                MainPage.BasePageView.AddChidren(aboutOnPage);
                aboutOnPage.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
        /// <summary>
        /// 跳转至获取支持页面
        /// </summary>
        void LoadEvent_SkipGetSupportPage()
        {
            btnSupportText.MouseUpEventHandler = (sender, e) =>
            {
                var getsupportPage = new GetSupportPage();
                MainPage.BasePageView.AddChidren(getsupportPage);
                getsupportPage.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
        }
        #endregion
    }
}
}