using System; using Shared; namespace HDL_ON.UI { public partial class UserPage : PageLayout { #region 控件列表 /// /// 当前区域 /// static PageLayout bodyView; /// /// 内容区域 /// FrameLayout ContextView; /// /// 导航栏区域 /// FrameLayout navigationView; /// /// 导航栏点击区域 /// FrameLayout NavigationSubView; #region 底部区域控件 /// /// 收藏子区域 /// FrameLayout collectionView; /// /// 收藏图标 /// Button btnCollectionIcon; /// /// 收藏文本 /// Button btnCollectionText; /// /// 分类子区域 /// FrameLayout classificationView; /// /// 分类图标 /// Button btnClassificationIcon; /// /// 分类文本 /// Button btnClassificationText; /// /// 智能子区域 /// FrameLayout intellectualizationView; /// /// 智能图标 /// Button btnIntellectualizationIcon; /// /// 智能文本 /// Button btnIntellectualizationText; /// /// 个人中心子区域 /// FrameLayout personalCenterView; /// /// 个人中心图标 /// Button btnPersonalCenterIcon; /// /// 个人中心文本 /// Button btnPersonalCenterText; /// /// 选中区域 /// FrameLayout navigationSelectionView; /// /// 选中区域图标 /// Button btnNavigationSelectionIcon; #endregion #endregion public void LoadPage() { bodyView = this; ContextView = new FrameLayout() { Height = Application.GetRealHeight(618), BackgroundColor = CSS.CSS_Color.BackgroundColor }; bodyView.AddChidren(ContextView); navigationView = new FrameLayout() { Y = Application.GetRealHeight(607), Height = Application.GetRealHeight(60), }; bodyView.AddChidren(navigationView); InitBottomView(); LoadEventList(); } /// /// 初始化底部区域 /// void InitBottomView() { NavigationSubView = new FrameLayout() { Y = Application.GetRealHeight(11), Height = Application.GetRealHeight(49), BackgroundColor = CSS.CSS_Color.MainBackgroundColor, }; navigationView.AddChidren(NavigationSubView); #region 收藏区域 collectionView = new FrameLayout() { Width = Application.GetRealWidth(94), }; NavigationSubView.AddChidren(collectionView); btnCollectionIcon = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(5), Width = Application.GetMinRealAverage(22), Height = Application.GetMinRealAverage(22), UnSelectedImagePath = "Navigation/CollectionIcon.png", }; collectionView.AddChidren(btnCollectionIcon); btnCollectionText = new Button() { Gravity = Gravity.CenterHorizontal, Y = btnCollectionIcon.Bottom, Height = Application.GetRealHeight(16), SelectedTextColor = CSS.CSS_Color.MainColor, TextColor =CSS.CSS_Color.FirstLevelTitleColor, TextSize = CSS.CSS_FontSize.PromptFontSize_SecondaryLevel, TextID = InternationalizationString.Collection, TextAlignment = TextAlignment.Center, }; collectionView.AddChidren(btnCollectionText); #endregion #region 分类区域 classificationView = new FrameLayout() { Width = Application.GetRealWidth(94), X = collectionView.Right, }; NavigationSubView.AddChidren(classificationView); btnClassificationIcon = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(5), Width = Application.GetMinRealAverage(22), Height = Application.GetMinRealAverage(22), UnSelectedImagePath = "Navigation/ClassificationIcon.png", }; classificationView.AddChidren(btnClassificationIcon); btnClassificationText = new Button() { Gravity = Gravity.CenterHorizontal, Y = btnCollectionIcon.Bottom, Height = Application.GetRealHeight(16), SelectedTextColor = CSS.CSS_Color.MainColor, TextColor = CSS.CSS_Color.FirstLevelTitleColor, TextSize = CSS.CSS_FontSize.PromptFontSize_SecondaryLevel, TextID = InternationalizationString.Classification, TextAlignment = TextAlignment.Center, }; classificationView.AddChidren(btnClassificationText); #endregion #region 智能区域 intellectualizationView = new FrameLayout() { Width = Application.GetRealWidth(94), X = classificationView.Right, }; NavigationSubView.AddChidren(intellectualizationView); btnIntellectualizationIcon = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(5), Width = Application.GetMinRealAverage(22), Height = Application.GetMinRealAverage(22), UnSelectedImagePath = "Navigation/IntellectualizationIcon.png", }; intellectualizationView.AddChidren(btnIntellectualizationIcon); btnIntellectualizationText = new Button() { Gravity = Gravity.CenterHorizontal, Y = btnCollectionIcon.Bottom, Height = Application.GetRealHeight(16), TextColor = CSS.CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS.CSS_Color.MainColor, TextSize = CSS.CSS_FontSize.PromptFontSize_SecondaryLevel, TextID = InternationalizationString.Intellectualization, TextAlignment = TextAlignment.Center, }; intellectualizationView.AddChidren(btnIntellectualizationText); #endregion #region 个人中心 personalCenterView = new FrameLayout() { Width = Application.GetRealWidth(94), X = intellectualizationView.Right, }; NavigationSubView.AddChidren(personalCenterView); btnPersonalCenterIcon = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(5), Width = Application.GetMinRealAverage(22), Height = Application.GetMinRealAverage(22), UnSelectedImagePath = "Navigation/PersonalCenterIcon.png", SelectedImagePath = "Navigation/PersonalCenterIconOn.png", }; personalCenterView.AddChidren(btnPersonalCenterIcon); btnPersonalCenterText = new Button() { Gravity = Gravity.CenterHorizontal, Y = btnCollectionIcon.Bottom, Height = Application.GetRealHeight(16), TextColor = CSS.CSS_Color.FirstLevelTitleColor, SelectedTextColor = CSS.CSS_Color.MainColor, TextSize = CSS.CSS_FontSize.PromptFontSize_SecondaryLevel, TextID = InternationalizationString.Personal, TextAlignment = TextAlignment.Center, }; personalCenterView.AddChidren(btnPersonalCenterText); #endregion navigationSelectionView = new FrameLayout() { X = Application.GetRealWidth(0), Width = Application.GetRealWidth(94), Height = Application.GetRealHeight(40), BackgroundImagePath = "Navigation/UserPageNavbg.png", }; navigationView.AddChidren(navigationSelectionView); btnNavigationSelectionIcon = new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(6), Width = Application.GetMinRealAverage(22), Height = Application.GetMinRealAverage(22), UnSelectedImagePath = "Navigation/CollectionIconOn.png", }; navigationSelectionView.AddChidren(btnNavigationSelectionIcon); } /// /// 切换到收藏界面 /// void ChooseCollection() { btnCollectionText.IsSelected = false; btnClassificationText.IsSelected = false; btnIntellectualizationText.IsSelected = false; btnPersonalCenterText.IsSelected = false; #region 移动动画 var distance = navigationSelectionView.X - collectionView.X; int total = 10; int sleepTime = 300; if (distance > 200) { sleepTime = 600; total = 30; } else if (distance > 100) { sleepTime = 450; total = 20; } distance /= total; new System.Threading.Thread(() => { int index = 0; while (index < total+1) { Application.RunOnMainThread(() => { //移动 if (index < total) { navigationSelectionView.X -= distance; } else { navigationSelectionView.X = collectionView.X; btnCollectionText.IsSelected = true; } if (index == (total/2)) { btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/CollectionIconOn.png"; } //旋转 btnNavigationSelectionIcon.SetRotation(-36f * index); }); System.Threading.Thread.Sleep(sleepTime / total); index++; } }) { IsBackground = true }.Start(); #endregion } /// /// 切换到分类界面 /// void ChooseClassification() { btnCollectionText.IsSelected = false; btnClassificationText.IsSelected = false; btnIntellectualizationText.IsSelected = false; btnPersonalCenterText.IsSelected = false; #region 移动动画 var distance = navigationSelectionView.X - classificationView.X; int total = 10; int sleepTime = 300; if (distance > 100 || distance < -100) { sleepTime = 450; total = 20; } distance /= total; new System.Threading.Thread(() => { int index = 0; while (index < total+1) { Application.RunOnMainThread(() => { //移动 if (index < total) { navigationSelectionView.X -= distance; } else { navigationSelectionView.X = classificationView.X; btnClassificationText.IsSelected = true; } if (index == (total / 2 )) { btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/ClassificationIconOn.png"; } //旋转 if (distance < 0) { btnNavigationSelectionIcon.SetRotation(36f * index); } else { btnNavigationSelectionIcon.SetRotation(-36f * index); } }); System.Threading.Thread.Sleep(sleepTime / total); index++; } }) { IsBackground = true }.Start(); #endregion } /// /// 切换到智能界面 /// void ChooseIntellectualization() { btnCollectionText.IsSelected = false; btnClassificationText.IsSelected = false; btnIntellectualizationText.IsSelected = false; btnPersonalCenterText.IsSelected = false; #region 移动动画 var distance = navigationSelectionView.X - intellectualizationView.X; int total = 10; int sleepTime = 300; if (distance > 100 || distance < -100) { sleepTime = 450; total = 20; } distance /= total; new System.Threading.Thread(() => { int index = 0; while (index < total+1) { Application.RunOnMainThread(() => { //移动 if (index < total) { navigationSelectionView.X -= distance; } else { navigationSelectionView.X = intellectualizationView.X; btnIntellectualizationText.IsSelected = true; } if (index == (total / 2 )) { btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/IntellectualizationIconOn.png"; } //旋转 if (distance < 0) { btnNavigationSelectionIcon.SetRotation(36f * index); } else { btnNavigationSelectionIcon.SetRotation(-36f * index); } }); System.Threading.Thread.Sleep(sleepTime / total); index++; } }) { IsBackground = true }.Start(); #endregion } /// /// 切换到个人中心界面 /// void ChoosePersonalCenter() { btnCollectionText.IsSelected = false; btnClassificationText.IsSelected = false; btnIntellectualizationText.IsSelected = false; btnPersonalCenterText.IsSelected = false; #region 移动动画 var distance = navigationSelectionView.X - personalCenterView.X; int total = 10; int sleepTime = 300; if (distance < -200) { sleepTime = 600; total = 30; } else if (distance < -100) { sleepTime = 450; total = 20; } distance /= total; new System.Threading.Thread(() => { int index = 0; while (index < total+1) { Application.RunOnMainThread(() => { //移动 if (index < total) { navigationSelectionView.X -= distance; } else { navigationSelectionView.X = personalCenterView.X; btnPersonalCenterText.IsSelected = true; } if (index == (total / 2 )) { btnNavigationSelectionIcon.UnSelectedImagePath = "Navigation/PersonalCenterIconOn.png"; } //旋转 btnNavigationSelectionIcon.SetRotation(36f * index); }); System.Threading.Thread.Sleep(sleepTime / total); index++; } }) { IsBackground = true }.Start(); #endregion var personalCenterPage = new UI2.PersonalCenterPage(); ContextView.AddChidren(personalCenterPage); personalCenterPage.LoadView(); } } }