wxr
2020-12-21 064501c0cbf8643cfb2bdb2c295055189cf3287f
HDL_ON/UI/UI2/4-PersonalCenter/AboutOn/FunctionIntroductionPage.cs
old mode 100755 new mode 100644
@@ -2,6 +2,8 @@
using Shared;
using HDL_ON.UI.CSS;
using System.Collections.Generic;
using System.Threading;
using HDL_ON.DAL.Server;
namespace HDL_ON.UI
{
@@ -22,13 +24,23 @@
        /// <summary>
        /// 内容为空提示View
        /// </summary>
        EmptyTipView emptyTipView;
        FrameLayout emptyTipView;
        /// <summary>
        /// 功能介绍List
        /// </summary>
        List<APPFunctionURLInfo> functionURLInfoList = new List<APPFunctionURLInfo>();
        /// <summary>
        ///
        /// </summary>
        public FunctionIntroductionPage()
        {
            bodyView = this;
        }
        /// <summary>
        ///
        /// </summary>
        public void LoadPage()
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.FunctionIntroduced)).LoadTopView();
@@ -42,9 +54,9 @@
            };
            bodyView.AddChidren(bodyScrolView);
            AddEmptyTipView();
            //TestLoad();
            //AddEmptyTipView();
            //
            GetFunctionIntroductionList();
        }
        /// <summary>
@@ -52,22 +64,29 @@
        /// </summary>
        void AddEmptyTipView()
        {
            emptyTipView = new EmptyTipView()
            emptyTipView = new FrameLayout()
            {
                Height = bodyScrolView.Height,
                Width = bodyScrolView.Width,
            };
            bodyScrolView.AddChidren(emptyTipView);
            var tipView = new EmptyTipView()
            {
                Gravity = Gravity.Center
            };
            bodyView.AddChidren(emptyTipView);
            emptyTipView.AddChidren(tipView);
        }
        /// <summary>
        /// 加载区域选择RowView
        /// 加载功能介绍列表查询
        /// </summary>
        /// <param name="VerticalScrolViewMiddle"></param>
        void AddRowView(VerticalScrolViewLayout VerticalScrolViewMiddle, APPFunctionURLInfo functionInfo)
        {
            var rowView = new FrameLayout()
            {
                Height = Application.GetRealHeight(54),
                Height = Application.GetRealWidth(54),
            };
            VerticalScrolViewMiddle.AddChidren(rowView);
@@ -75,9 +94,9 @@
            var btnTilte = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(8),
                Y = Application.GetRealWidth(8),
                Width = Application.GetRealWidth(320),
                Height = Application.GetRealHeight(20),
                Height = Application.GetRealWidth(20),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
@@ -89,13 +108,13 @@
            var btnSubtitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = btnTilte.Bottom + Application.GetRealHeight(4),
                Y = btnTilte.Bottom + Application.GetRealWidth(4),
                Width = Application.GetRealWidth(320),
                Height = Application.GetRealHeight(14),
                Height = Application.GetRealWidth(14),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                Text = functionInfo.CreateTime
                //Text = functionInfo.CreateTime
            };
            rowView.AddChidren(btnSubtitle);
@@ -104,8 +123,8 @@
            {
                X = Application.GetRealWidth(343),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                Width = Application.GetRealWidth(16),
                Height = Application.GetRealWidth(16),
                UnSelectedImagePath = "Public/Right.png",
            };
@@ -122,42 +141,137 @@
            btnTilte.MouseUpEventHandler = eventHandler;
            btnSubtitle.MouseUpEventHandler = eventHandler;
            btnGo.MouseUpEventHandler = eventHandler;
            if (Language.CurrentLanguage == "Chinese")
            {
                btnSubtitle.Text = Utlis.UnixToDateTimeWithFormatMS(functionInfo.CreateTime, "MM月dd日");
            }
            else
            {
                btnSubtitle.Text = Utlis.UnixToDateTimeWithFormatMS(functionInfo.CreateTime, "MM/dd");
            }
        }
        #region 测试
        List<APPFunctionURLInfo> list = new List<APPFunctionURLInfo>();
        /// <summary>
        ///
        /// 功能介绍列表查询
        /// </summary>
        void TestLoad()
        void GetFunctionIntroductionList()
        {
            list.Add(new APPFunctionURLInfo()
            bodyScrolView.RemoveAll();
            if (functionURLInfoList == null)
            {
                Title = "HDL ON PRO 1.0.10 主要更新",
                CreateTime = "11月26",
                Url = Constant.URL_PRIVACYPOLICY,
            });
            list.Add(new APPFunctionURLInfo()
                functionURLInfoList = new List<APPFunctionURLInfo>();
            }
            else
            {
                Title = "HDL ON PRO 1.0.09 主要更新",
                CreateTime = "10月26",
                Url = Constant.URL_PRIVACYPOLICY,
            });
                functionURLInfoList.Clear();
            }
            list.Add(new APPFunctionURLInfo()
            var waitPage = new Loading();
            bodyView.AddChidren(waitPage);
            waitPage.Start(Language.StringByID(StringId.PleaseWait));
            new Thread(() =>
            {
                Title = "HDL ON PRO 1.0.08 主要更新",
                CreateTime = "09月26",
                Url = Constant.URL_PRIVACYPOLICY,
            });
                try
                {
            foreach (var info in list)
                    Dictionary<string, object> AppName = new Dictionary<string, object>();
                    //ON_Plus 2
                    AppName.Add("appName", 2);
                    var requestJson = HttpUtil.GetSignRequestJson(AppName);
                    var result = HttpUtil.RequestHttpsPost(NewAPI.API_POST_FunctionIntroductionList, requestJson);
                    if (result.Code == StateCode.SUCCESS)
                    {
                        functionURLInfoList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<APPFunctionURLInfo>>(result.Data.ToString());
                        Application.RunOnMainThread(() =>
                        {
                            if (functionURLInfoList != null && functionURLInfoList.Count > 0)
                            {
                                //加载刷新List
                                LoadAPPFunctionURLInfoView(functionURLInfoList);
                            }
                            else
                            {
                                AddEmptyTipView();
                            }
                        });
                    }
                    else
                    {
                        Application.RunOnMainThread(() =>
                        {
                            AddEmptyTipView();
                        });
                        IMessageCommon.Current.ShowErrorInfoAlter(result.Code);
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    Application.RunOnMainThread(() =>
                    {
                        if (waitPage != null)
                        {
                            waitPage.RemoveFromParent();
                            waitPage = null;
                        }
                    });
                }
            })
            { IsBackground = true }.Start();
        }
        /// <summary>
        /// 加载功能介绍CellView
        /// </summary>
        void LoadAPPFunctionURLInfoView(List<APPFunctionURLInfo> mList)
        {
            foreach (var info in mList)
            {
                AddRowView(bodyScrolView, info);
            }
        }
        #endregion
        //#region 测试
        //List<APPFunctionURLInfo> list = new List<APPFunctionURLInfo>();
        ///// <summary>
        /////
        ///// </summary>
        //void TestLoad()
        //{
        //    list.Add(new APPFunctionURLInfo()
        //    {
        //        Title = "HDL ON PRO 1.0.10 主要更新",
        //        CreateTime = "11月26",
        //        Url = Constant.URL_PRIVACYPOLICY,
        //    });
        //    list.Add(new APPFunctionURLInfo()
        //    {
        //        Title = "HDL ON PRO 1.0.09 主要更新",
        //        CreateTime = "10月26",
        //        Url = Constant.URL_PRIVACYPOLICY,
        //    });
        //    list.Add(new APPFunctionURLInfo()
        //    {
        //        Title = "HDL ON PRO 1.0.08 主要更新",
        //        CreateTime = "09月26",
        //        Url = Constant.URL_PRIVACYPOLICY,
        //    });
        //    foreach (var info in list)
        //    {
        //        AddRowView(bodyScrolView, info);
        //    }
        //}
        //#endregion
    }
@@ -168,15 +282,15 @@
    public class APPFunctionURLInfo
    {
        /// <summary>
        ///
        /// 功能介绍标题
        /// </summary>
        public string Title;
        /// <summary>
        ///
        /// 功能介绍发布事件
        /// </summary>
        public string CreateTime;
        public long CreateTime;
        /// <summary>
        ///
        /// 功能介绍对应的HTML地址
        /// </summary>
        public string Url;
    }