using System; using Shared; using HDL_ON.UI.CSS; using System.Collections.Generic; using System.Threading; using HDL_ON.DAL.Server; namespace HDL_ON.UI { /// /// 功能介绍 /// public class FunctionIntroductionPage : FrameLayout { FrameLayout bodyView; /// /// /// FrameLayout emptyTipFrameLayout; /// /// 当前 /// VerticalScrolViewLayout bodyScrolView; /// /// 内容为空提示View /// FrameLayout emptyTipView; /// /// 功能介绍List /// List functionURLInfoList = new List(); /// /// /// public FunctionIntroductionPage() { bodyView = this; } /// /// /// public void LoadPage() { new TopViewDiv(bodyView, Language.StringByID(StringId.FunctionIntroduced)).LoadTopView(); int bodyY = Application.GetRealHeight(64); bodyScrolView = new VerticalScrolViewLayout() { Y = bodyY, Height = bodyView.Height - bodyY, BackgroundColor = CSS_Color.MainBackgroundColor, }; bodyView.AddChidren(bodyScrolView); //AddEmptyTipView(); // GetFunctionIntroductionList(); } /// /// 添加内容为空提示页面 /// void AddEmptyTipView() { emptyTipView = new FrameLayout() { Height = bodyScrolView.Height, Width = bodyScrolView.Width, }; bodyScrolView.AddChidren(emptyTipView); var tipView = new EmptyTipView() { Gravity = Gravity.Center }; emptyTipView.AddChidren(tipView); } /// /// 加载功能介绍列表查询 /// /// void AddRowView(VerticalScrolViewLayout VerticalScrolViewMiddle, APPFunctionURLInfo functionInfo) { var rowView = new FrameLayout() { Height = Application.GetRealWidth(54), }; VerticalScrolViewMiddle.AddChidren(rowView); //标题 var btnTilte = new Button() { X = Application.GetRealWidth(16), Y = Application.GetRealWidth(8), Width = Application.GetRealWidth(320), Height = Application.GetRealWidth(20), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.TextFontSize, Text = functionInfo.Title }; rowView.AddChidren(btnTilte); //副标题 var btnSubtitle = new Button() { X = Application.GetRealWidth(16), Y = btnTilte.Bottom + Application.GetRealWidth(4), Width = Application.GetRealWidth(320), Height = Application.GetRealWidth(14), TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, //Text = functionInfo.CreateTime }; rowView.AddChidren(btnSubtitle); var btnGo = new Button() { X = Application.GetRealWidth(343), Gravity = Gravity.CenterVertical, Width = Application.GetRealWidth(16), Height = Application.GetRealWidth(16), UnSelectedImagePath = "Public/Right.png", }; rowView.AddChidren(btnGo); var lineView = new LineView(rowView.Height); rowView.AddChidren(lineView); EventHandler eventHandler = (sender, e) => { new WebViewDialog().LoadPage(functionInfo.Title, functionInfo.Url); }; 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"); } } /// /// 功能介绍列表查询 /// void GetFunctionIntroductionList() { bodyScrolView.RemoveAll(); if (functionURLInfoList == null) { functionURLInfoList = new List(); } else { functionURLInfoList.Clear(); } var waitPage = new Loading(); bodyView.AddChidren(waitPage); waitPage.Start(Language.StringByID(StringId.PleaseWait)); new Thread(() => { try { Dictionary AppName = new Dictionary(); //ON_Plus 2 AppName.Add("appName", 2); AppName.Add("languages", Utlis.GetPostLanguageType()); var requestJson = HttpUtil.GetSignRequestJson(AppName); var result = HttpUtil.RequestHttpsPost(NewAPI.API_POST_FunctionIntroductionList, requestJson); if (result.Code == StateCode.SUCCESS) { functionURLInfoList = Newtonsoft.Json.JsonConvert.DeserializeObject>(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(); } /// /// 加载功能介绍CellView /// void LoadAPPFunctionURLInfoView(List mList) { foreach (var info in mList) { AddRowView(bodyScrolView, info); } } //#region 测试 //List list = new List(); ///// ///// ///// //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 } /// /// 功能介绍网页信息 /// [System.Serializable] public class APPFunctionURLInfo { /// /// 功能介绍标题 /// public string Title; /// /// 功能介绍发布事件 /// public long CreateTime; /// /// 功能介绍对应的HTML地址 /// public string Url; } }