wxr
2024-06-06 f54a487bb42ac49bf81bd7b5eea311fc79231bc6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
using System;
using System.Collections.Generic;
 
namespace HDL_ON.UI
{
    public class VideoDoorlockHistoryPage : FrameLayout
    {
        private VideoDoorlockHistoryPage bodyView;
        private VerticalScrolViewLayout histroyView;
        private Function device;
 
        public VideoDoorlockHistoryPage(Function function)
        {
            bodyView = this;
            device = function;
 
        }
 
 
        public void LoadPage()
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.HistoryLog)).LoadTopView();
 
            histroyView = new VerticalScrolViewLayout()
            {
                Height = Application.GetRealHeight(600),
            };
            bodyView.AddChidren(histroyView);
 
            GetDoorlockHistory();
        }
 
 
        public void GetDoorlockHistory()
        {
 
            var waitPage = new Loading();
            bodyView.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");
                    if (pack == null)
                    {
                        return;
                    }
                    var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<Cloud_ArmSensorHistory>(pack.Data.ToString());
                    List<string> years = new List<string>();
                    if (revData == null)
                        return;
                    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();
        }
 
 
 
    }
 
    /// <summary>
    /// 萤石视频门锁历史记录控件行
    /// </summary>
    public class DoorlockHistoryRow : FrameLayout
    {
        public DoorlockHistoryRow bodyView;
 
        public DoorlockHistoryRow()
        {
            bodyView = this;
            bodyView.Height = Application.GetRealHeight(77);
            bodyView.BackgroundColor = CSS.CSS_Color.MainBackgroundColor;
        }
 
        public void Init(string msg,string time,string imagePath)
        {
            FrameLayout contentView;
            Button btnInfo;
            Button btnTime;
            Button btnImage;
 
            contentView = new FrameLayout()
            {
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(65),
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(12),
                BackgroundColor = CSS.CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(contentView);
 
 
            btnInfo = new Button()
            {
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(250),
                Height = Application.GetRealHeight(24),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
                TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                Text = msg,
            };
            bodyView.AddChidren(btnInfo);
 
            btnTime = new Button()
            {
                Y = btnInfo.Bottom,
                Width = Application.GetRealWidth(250),
                Height = Application.GetRealHeight(20),
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 12,
                TextColor = CSS.CSS_Color.PromptingColor1,
                Text = time,
            };
            bodyView.AddChidren(btnTime);
 
            btnImage = new Button()
            {
                X = Application.GetRealWidth(287),
                Gravity = Gravity.CenterRight,
                Radius = (uint)Application.GetRealWidth(4),
                Width = Application.GetRealWidth(72),
                Height = Application.GetRealHeight(41),
                UnSelectedImagePath = imagePath,
            };
            bodyView.AddChidren(btnImage);
 
        }
    }
}