using System;
|
using System.Collections.Generic;
|
namespace Shared.SimpleControl.Phone
|
{
|
public class MonitorType : FrameLayout
|
{
|
VerticalScrolViewLayout middleVerticalScrolViewLayout;
|
|
public MonitorType ()
|
{
|
BackgroundColor = SkinStyle.Current.MainColor;
|
}
|
|
public void ShowVideoMonitoring ()
|
{
|
#region 标题
|
var topView = new FrameLayout () {
|
Height = Application.GetRealHeight (136),
|
};
|
AddChidren (topView);
|
|
var title = new Button () {
|
Y = Application.GetRealHeight (10),
|
TextAlignment = TextAlignment.Center,
|
Text = Language.StringByID (R.MyInternationalizationString.VideoMonitoring),
|
TextSize = 19,
|
TextColor = SkinStyle.Current.TextColor1
|
};
|
topView.AddChidren (title);
|
|
var back = new Button () {
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (85),
|
UnSelectedImagePath = "Item/Back.png",
|
SelectedImagePath = "Item/BackSelected.png",
|
Y = Application.GetRealHeight (30),
|
};
|
topView.AddChidren (back);
|
back.MouseUpEventHandler += (sender, e) => {
|
(Parent as PageLayout).PageIndex -= 1;
|
};
|
#endregion
|
|
VerticalScrolViewLayout BodyView = new VerticalScrolViewLayout () {
|
Y = topView.Bottom,
|
Height = Application.GetRealHeight (Application.DesignHeight - 126),
|
BackgroundColor = SkinStyle.Current.ViewColor,
|
};
|
AddChidren (BodyView);
|
|
for (int i = 0; i < 2; i++) {
|
FrameLayout RowView = new FrameLayout () {
|
Height = Application.GetRealHeight (110),
|
};
|
BodyView.AddChidren (RowView);
|
|
Button btnIcon = new Button () {
|
Width = Application.GetRealHeight (13),
|
Height = Application.GetRealHeight (13),
|
X = Application.GetRealWidth (40),
|
UnSelectedImagePath = "Item/Point.png",
|
SelectedImagePath = "Item/PointSelected.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
RowView.AddChidren (btnIcon);
|
|
Button monitorName = new Button () {
|
X = btnIcon.Right + Application.GetRealWidth (20),
|
Width = Application.GetRealWidth (300),
|
Height = Application.GetRealHeight (110),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = SkinStyle.Current.TextColor1
|
};
|
RowView.AddChidren (monitorName);
|
if (i == 0) {
|
monitorName.TextID = R.MyInternationalizationString.EZVIZ;
|
} else if (i == 1) {
|
monitorName.TextID = R.MyInternationalizationString.URL;
|
}
|
|
Button btnRight = new Button () {
|
Width = Application.GetRealWidth (28),
|
Height = Application.GetRealHeight (40),
|
X = monitorName.Right + Application.GetRealWidth (200),
|
UnSelectedImagePath = "Item/Right.png",
|
SelectedImagePath = "Item/RightSelected.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
RowView.AddChidren (btnRight);
|
|
Button btnLineNull = new Button () {
|
Y = RowView.Height - 1,
|
Height = 1,
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
RowView.AddChidren (btnLineNull);
|
|
|
EventHandler<MouseEventArgs> eHandler = null;
|
if (i == 0) {
|
eHandler = (sender, e) => {
|
MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
|
System.Threading.Tasks.Task.Run (() => {
|
System.Threading.Thread.Sleep (2000);
|
Application.RunOnMainThread (() => {
|
MainPage.Loading.Hide ();
|
});
|
});
|
try {
|
//初始化萤石库
|
EZMonitor.Ezviz.LibInit ();
|
//跳转到萤石摄像头
|
EZMonitor.CommonList.AddEzvizMonitor ();
|
} catch (Exception ex) {
|
Application.RunOnMainThread (() => {
|
new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.CheckInternet),
|
Language.StringByID (R.MyInternationalizationString.Close)).Show ();
|
});
|
}
|
};
|
} else if (i == 1) {
|
eHandler = (sender, e) => {
|
URLMonitor urlView = new URLMonitor ();
|
UserMiddle.DevicePageView.AddChidren (urlView);
|
urlView.ShowVideoMonitoring ();
|
UserMiddle.DevicePageView.PageIndex = 2;
|
};
|
}
|
btnRight.MouseUpEventHandler += eHandler;
|
btnIcon.MouseUpEventHandler += eHandler;
|
RowView.MouseUpEventHandler += eHandler;
|
monitorName.MouseUpEventHandler += eHandler;
|
|
}
|
}
|
}
|
}
|