From 5266531a3a1552a11a29473974481d60100812c6 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 04 三月 2021 19:24:44 +0800 Subject: [PATCH] Merge branch 'temp-wxr' into NewFilePath --- HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 168 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs new file mode 100644 index 0000000..bd249f2 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmSensor/ArmSensorHistroyPaging.cs @@ -0,0 +1,168 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON.UI +{ + public class ArmSensorHistroyPaging + { + Function device; + public ArmSensorHistroyPaging(Function function) + { + device = function; + } + + public void InitFrame(FrameLayout FrameWhiteCentet2) + { + Button btnTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(220), + Height = Application.GetRealHeight(65), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel, + TextColor = CSS_Color.FirstLevelTitleColor, + IsBold = true, + TextID = StringId.Log, + }; + FrameWhiteCentet2.AddChidren(btnTitle); + + VerticalScrolViewLayout histroyView = new VerticalScrolViewLayout() + { + Y = btnTitle.Bottom, + Height = Application.GetRealHeight(450), + }; + FrameWhiteCentet2.AddChidren(histroyView); + + var waitPage = new Loading(); + FrameWhiteCentet2.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + new System.Threading.Thread(() => + { + try + { + int pageCount = 1; + var pm = new DAL.Server.HttpServerRequest(); + var pack = pm.GetArmSensorHistory(device.deviceId, "20", "1"); + var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud_ArmSensorHistory>(pack.Data.ToString()); + List<string> years = new List<string>(); + Application.RunOnMainThread(() => + { + var startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 褰撳湴鏃跺尯 + foreach (var data in revData.list) + { + var yearString = startTime.AddMilliseconds(Convert.ToDouble(data.createTime)).ToString("yyyy") + Language.StringByID(StringId.Years); + var monthString = startTime.AddMilliseconds(Convert.ToDouble(data.createTime)).ToString("m"); + var timeString = startTime.AddMilliseconds(Convert.ToDouble(data.createTime)).ToString("HH:mm:ss"); + var dateString = monthString + " " + timeString; + if (!years.Contains(yearString)) + { + years.Add(yearString); + Button btnYear = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(46), + Width = Application.GetRealWidth(220), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + IsBold = true, + Text = yearString, + }; + histroyView.AddChidren(btnYear); + } + var cell = new ArmSensorHistoryMsgCell() + { + Height = Application.GetRealHeight(50), + }; + histroyView.AddChidren(cell); + cell.InitControl(data.content, dateString); + } + }); + } + catch + { + + } + finally + { + Application.RunOnMainThread(() => + { + waitPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); + } + } + + public class ArmSensorHistoryMsgCell : FrameLayout + { + Button btnMsg; + Button btnTime; + + public void InitControl(string msg, string time) + { + btnMsg = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(40), + Width = Application.GetRealWidth(300), + //Width = Application.GetRealWidth(220), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + Text = msg, + }; + this.AddChidren(btnMsg); + + btnTime = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(35), + Width = Application.GetRealWidth(295), + //Width = Application.GetRealWidth(80), + Height = Application.GetRealHeight(15), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextColor = CSS_Color.PromptingColor1, + Text = time, + IsMoreLines = true + }; + this.AddChidren(btnTime); + + AddChidren(new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(49), + Width = Application.GetRealWidth(295), + Height = 1, + BackgroundColor = CSS_Color.DividingLineColor, + }); + } + + + } + + /// <summary> + /// 浜戠api鎺ュ彛杩斿洖鐨勫畨闃蹭紶鎰熷櫒鍘嗗彶鏁版嵁瀵硅薄 + /// </summary> + public class Cloud_ArmSensorHistory + { + public string totalCount = ""; + public string totalPage = ""; + public string pageNo = ""; + public string pageSize = ""; + public List<ArmSensorHistory> list = new List<ArmSensorHistory>(); + } + + public class ArmSensorHistory + { + public string title = ""; + public string content = ""; + public string level = ""; + public string createTime = ""; + } +} -- Gitblit v1.8.0