using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.HideOption
{
///
/// 本地缓存设备列表的界面
///
public class HideOptionMemoryListDeviceForm : EditorCommonForm
{
#region ■ 变量声明___________________________
#endregion
#region ■ 初始化_____________________________
///
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
///
public void ShowForm()
{
//设置头部信息
base.SetTitleText("设备列表");
//初始化中部信息
this.InitMiddleFrame();
}
///
/// 初始化中部信息
///
private void InitMiddleFrame()
{
var listView = new VerticalListControl(23);
listView.BackgroundColor = UserCenterColor.Current.White;
listView.Height = bodyFrameLayout.Height;
bodyFrameLayout.AddChidren(listView);
var listDevice = Common.LocalDevice.Current.listAllDevice;
for (int i = 0; i < listDevice.Count; i++)
{
this.AddRowControl(listView, listDevice[i], i != listDevice.Count - 1);
}
listView.AdjustRealHeight(Application.GetRealHeight(23));
}
private void AddRowControl(VerticalListControl listView, CommonDevice device, bool addLine)
{
var row1 = new RowLayoutControl(listView.rowSpace / 2);
listView.AddChidren(row1);
row1.frameTable.AddTopView(Common.LocalDevice.Current.GetDeviceEpointName(device), 800);
row1.frameTable.AddBottomView(device.FilePath, 800);
if (addLine == true)
{
row1.frameTable.AddBottomLine();
}
row1.frameTable.AddRightArrow();
row1.frameTable.ButtonClickEvent += (sender, e) =>
{
var txtContent = Newtonsoft.Json.JsonConvert.SerializeObject(device);
var form = new HideOptionFileContentForm();
form.AddForm(string.Empty);
form.SetTextContent(txtContent);
};
}
#endregion
#region ■ 一般方法___________________________
#endregion
}
}