xm
2021-12-01 6d73bf6e816570291865674bef8bce8972e4de3f
HDL_ON/UI/UI2/UserPage.cs
@@ -2,12 +2,12 @@
using HDL_ON.Entity;
using Shared;
using HDL_ON.UI.CSS;
using HDL_ON.DAL.Server;
namespace HDL_ON.UI
{
    public partial class UserPage : FrameLayout
    {
        #region 控件列表
        /// <summary>
        /// 当前区域
@@ -17,6 +17,7 @@
        /// 内容区域
        /// </summary>
        FrameLayout ContextView;
        //VerticalRefreshLayout ContextView;
        /// <summary>
        /// 导航栏区域
        /// </summary>
@@ -85,14 +86,6 @@
        #endregion
        #endregion
        /// <summary>
        /// 当前动画效果
        /// 0:收藏
        /// 1:分类
        /// 2:智能
        /// 3:个人
        /// </summary>
        int CurAnimationEffect = 0;
        public void LoadPage()
        {
@@ -128,8 +121,34 @@
                ContextView.AddChidren(homePage);
                homePage.LoadPage();
                //刷新功能状态
                DB_ResidenceData.residenceData.RefreshResidenceFunctionStatus();
                if (!MainPage.NoLoginMode)
                {
                    //注册推送ID
                    RegisteredPush();
                }
                //2020-12-07 增加版本检测更新方法
                HDLCommon.Current.CheckIfNeedForceUpdate();
#if __Android__
                //开启定位服务
                Shared.Application.StartGPSLocationService();
                if (DB_ResidenceData.Instance.NeedTip) {
                    DB_ResidenceData.Instance.LastTipTime = DateTime.Now;
                    if (CN.Jpush.Android.Api.JPushInterface.IsNotificationEnabled(Shared.Application.Activity) != 1)
                    {
                        Action action = () =>
                        {
                            CN.Jpush.Android.Api.JPushInterface.GoToAppNotificationSettings(Shared.Application.Activity);
                        };
                        Shared.Application.RunOnMainThread(() =>
                        {
                            new HDL_ON.UI.ConfirmDialog().ShowDialog(StringId.Tip, StringId.Android_MessagePushTip, action);
                        });
                    }
                }
#endif
            }
            catch (Exception ex)
            {
@@ -158,7 +177,7 @@
                Y = Application.GetRealWidth(6),
                Width = Application.GetRealWidth(22),
                Height = Application.GetRealWidth(22),
                UnSelectedImagePath = "Navigation/CollectionIconOn.png",
                UnSelectedImagePath = "Navigation/HomePageIconOn.png",
            };
            navigationSelectionView.AddChidren(btnNavigationSelectionIcon);
@@ -170,7 +189,7 @@
            };
            navigationView.AddChidren(NavigationSubView);
            #region 收藏区域
#region 收藏区域
            collectionView = new FrameLayout() {
                Width  = Application.GetRealWidth(94),
            };
@@ -180,7 +199,7 @@
                Y = Application.GetRealHeight(5),
                Width = Application.GetMinRealAverage(22),
                Height = Application.GetMinRealAverage(22),
                UnSelectedImagePath = "Navigation/CollectionIcon.png",
                UnSelectedImagePath = "Navigation/HomePageIcon.png",
                SelectedImagePath = "Public/transparent.png",
                IsSelected = true,
            };
@@ -198,9 +217,9 @@
                IsSelected = true,
            };
            collectionView.AddChidren(btnCollectionText);
            #endregion
#endregion
            #region 分类区域
#region 分类区域
            classificationView = new FrameLayout()
            {
                Width = Application.GetRealWidth(94),
@@ -229,9 +248,9 @@
                TextAlignment = TextAlignment.Center,
            };
            classificationView.AddChidren(btnClassificationText);
            #endregion
#endregion
            #region 智能区域
#region 智能区域
            intellectualizationView = new FrameLayout()
            {
                Width = Application.GetRealWidth(94),
@@ -260,9 +279,9 @@
                TextAlignment = TextAlignment.Center,
            };
            intellectualizationView.AddChidren(btnIntellectualizationText);
            #endregion
#endregion
            
            #region 个人中心
#region 个人中心
            personalCenterView = new FrameLayout()
            {
                Width = Application.GetRealWidth(94),
@@ -293,7 +312,7 @@
                TextAlignment = TextAlignment.Center,
            };
            personalCenterView.AddChidren(btnPersonalCenterText);
            #endregion
#endregion
            var homePage = new HomePage();
            ContextView.AddChidren(homePage);
@@ -303,9 +322,9 @@
        /// <summary>
        /// 切换到收藏界面
        /// </summary>
        void ChooseCollection()
        public void ChooseCollection()
        {
            if (CurAnimationEffect == 0)
            if (MainPage.CurPageIndex == 0)
            {
                return;
            }
@@ -316,7 +335,7 @@
            btnClassificationText.IsSelected = false;
            btnIntellectualizationText.IsSelected = false;
            btnPersonalCenterText.IsSelected = false;
            #region 移动动画
#region 移动动画
            //移动距离
            var distance = navigationSelectionView.X - collectionView.X + Application.GetRealWidth(94*3);
            int total = 10;
@@ -333,10 +352,10 @@
            distance /= total;
            new System.Threading.Thread(() => {
                int index = 0;
                CurAnimationEffect = 0;
                MainPage.CurPageIndex = 0;
                while (index < total+1)
                {
                    if (CurAnimationEffect != 0)
                    if (MainPage.CurPageIndex != 0)
                    {
                        break;
                    }
@@ -358,10 +377,11 @@
                            btnClassificationText.IsSelected = false;
                            btnIntellectualizationText.IsSelected = false;
                            btnPersonalCenterText.IsSelected = false;
                            btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/HomePageIconOn.png";
                        }
                        if (index == (total/2))
                        {
                            btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/CollectionIconOn.png";
                            btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/HomePageIconOn.png";
                        }
                        //旋转
                        btnNavigationSelectionIcon.SetRotation(-36f * index);
@@ -374,8 +394,8 @@
                {
                    btnNavigationSelectionIcon.SetRotation(0f);
                });
            }) { IsBackground = true }.Start();
            #endregion
            }) { IsBackground = true ,Priority = System.Threading.ThreadPriority.Highest}.Start();
#endregion
            ContextView.RemoveAll();
            var homePage = new HomePage();
            ContextView.AddChidren(homePage);
@@ -386,7 +406,7 @@
        /// </summary>
        void ChooseClassification()
        {
            if (CurAnimationEffect == 1)
            if (MainPage.CurPageIndex == 1)
            {
                return;
            }
@@ -397,7 +417,7 @@
            btnClassificationText.IsSelected = false;
            btnIntellectualizationText.IsSelected = false;
            btnPersonalCenterText.IsSelected = false;
            #region 移动动画
#region 移动动画
            var distance = navigationSelectionView.X - classificationView.X + Application.GetRealWidth(94 * 3);
            int total = 10;
            int sleepTime = 300;
@@ -408,15 +428,15 @@
            distance /= total;
            new System.Threading.Thread(() =>
            {
                if (CurAnimationEffect == 1)
                if (MainPage.CurPageIndex == 1)
                {
                    return;
                }
                CurAnimationEffect = 1;
                MainPage.CurPageIndex = 1;
                int index = 0;
                while (index < total+1)
                {
                    if (CurAnimationEffect != 1)
                    if (MainPage.CurPageIndex != 1)
                    {
                        break;
                    }
@@ -438,6 +458,7 @@
                            btnCollectionText.IsSelected = false;
                            btnIntellectualizationText.IsSelected = false;
                            btnPersonalCenterText.IsSelected = false;
                            btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/ClassificationIconOn.png";
                        }
                        if (index == (total / 2 ))
                        {
@@ -462,8 +483,8 @@
                    btnNavigationSelectionIcon.SetRotation(0f);
                });
            })
            { IsBackground = true }.Start();
            #endregion
            { IsBackground = true, Priority = System.Threading.ThreadPriority.Highest }.Start();
#endregion
            ContextView.RemoveAll();
            var classificaitionView = new ClassificationPage();
            ContextView.AddChidren(classificaitionView);
@@ -476,7 +497,7 @@
        /// </summary>
        void ChooseIntellectualization()
        {
            if (CurAnimationEffect == 2)
            if (MainPage.CurPageIndex == 2)
            {
                return;
            }
@@ -487,7 +508,7 @@
            btnCollectionIcon.IsSelected = false;
            btnClassificationIcon.IsSelected = false;
            btnPersonalCenterIcon.IsSelected = false;
            #region 移动动画
#region 移动动画
            var distance = navigationSelectionView.X - intellectualizationView.X + Application.GetRealWidth(94 * 3);
            int total = 10;
            int sleepTime = 300;
@@ -497,15 +518,15 @@
            }
            distance /= total;
            new System.Threading.Thread(() => {
                if (CurAnimationEffect == 2)
                if (MainPage.CurPageIndex == 2)
                {
                    return;
                }
                CurAnimationEffect = 2;
                MainPage.CurPageIndex = 2;
                int index = 0;
                while (index < total+1)
                {
                    if(CurAnimationEffect!=2)
                    if(MainPage.CurPageIndex!=2)
                    {
                        break;
                    }
@@ -527,6 +548,7 @@
                            btnCollectionIcon.IsSelected = false;
                            btnClassificationIcon.IsSelected = false;
                            btnPersonalCenterIcon.IsSelected = false;
                            btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/IntellectualizationIconOn.png";
                        }
                        if (index == (total / 2 ))
                        {
@@ -551,23 +573,22 @@
                    btnNavigationSelectionIcon.SetRotation(0f);
                });
            })
            { IsBackground = true }.Start();
            #endregion
            { IsBackground = true, Priority = System.Threading.ThreadPriority.Highest }.Start();
#endregion
            ContextView.RemoveAll();
            var intelligenceView = new IntelligencePage();
            ContextView.AddChidren(intelligenceView);
            intelligenceView.LoadPage();
        }
        /// <summary>
        /// 切换到个人中心界面
        /// </summary>
        void ChoosePersonalCenter()
        public void ChoosePersonalCenter()
        {
#if DEBUG
            if(MainPage.LocalMode)
            {
                return;
            }
#endif
            if (CurAnimationEffect == 3)
            if (MainPage.CurPageIndex == 3)
            {
                return;
            }
@@ -578,7 +599,7 @@
            btnCollectionIcon.IsSelected = false;
            btnClassificationIcon.IsSelected = false;
            btnIntellectualizationIcon.IsSelected = false;
            #region 移动动画
#region 移动动画
            var distance = navigationSelectionView.X - personalCenterView.X + Application.GetRealWidth(94 * 3);
            int total = 10;
            int sleepTime = 300;
@@ -593,11 +614,11 @@
            }
            distance /= total;
            new System.Threading.Thread(() => {
                CurAnimationEffect = 3;
                MainPage.CurPageIndex = 3;
                int index = 0;
                while (index < total+1)
                {
                    if (CurAnimationEffect != 3)
                    if (MainPage.CurPageIndex != 3)
                    {
                        break;
                    }
@@ -619,6 +640,7 @@
                            btnCollectionIcon.IsSelected = false;
                            btnClassificationIcon.IsSelected = false;
                            btnIntellectualizationIcon.IsSelected = false;
                            btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/PersonalCenterIconOn.png";
                        }
                        if (index == (total / 2 ))
                        {
@@ -635,13 +657,21 @@
                    btnNavigationSelectionIcon.SetRotation(0f);
                });
            })
            { IsBackground = true }.Start();
            #endregion
            { IsBackground = true, Priority = System.Threading.ThreadPriority.Highest }.Start();
#endregion
            ContextView.RemoveAll();
            var personalCenterPage = new UI.PersonalCenterPage();
            ContextView.AddChidren(personalCenterPage);
            personalCenterPage.LoadView();
        }
        /// <summary>
        /// 注册推送
        /// </summary>
        void RegisteredPush()
        {
            new HttpServerRequest().RegisteredPush();
        }
    }
}