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);
|
|
}
|
}
|
}
|