using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
namespace Shared.Phone.UserCenter.GatewayUpdate
{
///
/// 网关虚拟驱动列表界面
///
public class GatewayVirtualDriveInfoForm : EditorCommonForm
{
#region ■ 变量声明___________________________
///
/// 虚拟驱动号列表信息
///
private List listCode = null;
#endregion
#region ■ 初始化_____________________________
///
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
///
/// 虚拟驱动号列表信息
public void ShowForm(List i_listCode)
{
this.listCode = i_listCode;
//设置标题信息
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uVirtualDrive));
//初始化中部控件
this.InitMiddleFrame();
}
///
/// 初始化中部控件
///
private void InitMiddleFrame()
{
//清空bodyFrame
this.ClearBodyFrame();
var listView = new VerticalListControl(23);
listView.BackgroundColor = UserCenterColor.Current.White;
listView.Height = bodyFrameLayout.Height;
bodyFrameLayout.AddChidren(listView);
for (int i = 0; i < listCode.Count; i++)
{
//创建一个可以展开和收缩的FrameLayout,相当于菜单栏
var frameTable = new FrameListControl(12);
frameTable.Height = HdlControlResourse.ListViewRowHeight + listView.rowSpace;
listView.AddChidren(frameTable);
//驱动号菜单
var rowMenu = new FrameRowControl(frameTable.rowSpace / 2);
frameTable.AddChidren(rowMenu);
rowMenu.AddLeftCaption(listCode[i].DriveCode.ToString(), 400);
rowMenu.AddBottomLine();
var btnRight = rowMenu.AddMostRightEmptyIcon(58, 58);
btnRight.UnSelectedImagePath = "Item/RightNext.png";
btnRight.SelectedImagePath = "Item/Down.png";
rowMenu.ButtonClickEvent += (sender, e) =>
{
btnRight.IsSelected = !btnRight.IsSelected;
//变更的高度,默认为列表隐藏
int heightValue = HdlControlResourse.ListViewRowHeight + listView.rowSpace;
if (btnRight.IsSelected == true)
{
//展开模式时,扩大依据为:它有几个子控件
heightValue = frameTable.ChildrenCount * (HdlControlResourse.ListViewRowHeight + frameTable.rowSpace);
}
//自身高度变更
frameTable.Height = heightValue;
//变更列表高度
int realHeight = 0;
for (int j = 0; j < listView.ChildrenCount; j++)
{
realHeight += listView.GetChildren(j).Height;
}
//底部空白
realHeight += Application.GetRealHeight(23);
if (realHeight > bodyFrameLayout.Height)
{
realHeight = bodyFrameLayout.Height;
}
listView.Height = realHeight;
};
//镜像ID
var row1 = new FrameRowControl(frameTable.rowSpace / 2);
row1.LeftOffset = Application.GetRealWidth(167) - HdlControlResourse.XXLeft;
row1.UseClickStatu = false;
frameTable.AddChidren(row1);
row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uImageId), 300);
row1.AddMostRightView(listCode[i].DriveImageType.ToString(), 400);
row1.AddBottomLine();
//固件版本
var row2 = new FrameRowControl(frameTable.rowSpace / 2);
row2.LeftOffset = Application.GetRealWidth(167) - HdlControlResourse.XXLeft;
row2.UseClickStatu = false;
frameTable.AddChidren(row2);
row2.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFirmwareVersion), 300);
row2.AddMostRightView(HdlDeviceCommonLogic.Current.AppendVersion(listCode[i].DriveFwVersion), 400);
row2.AddBottomLine();
//固件日期
var row3 = new FrameRowControl(frameTable.rowSpace / 2);
row3.LeftOffset = Application.GetRealWidth(167) - HdlControlResourse.XXLeft;
row3.UseClickStatu = false;
frameTable.AddChidren(row3);
row3.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uHardwareDate), 300);
row3.AddMostRightView("", 400);
row3.AddBottomLine();
//硬件版本
var row4 = new FrameRowControl(frameTable.rowSpace / 2);
row4.LeftOffset = Application.GetRealWidth(167) - HdlControlResourse.XXLeft;
row4.UseClickStatu = false;
frameTable.AddChidren(row4);
row4.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uHardwareVersion), 300);
row4.AddMostRightView(listCode[i].DriveHwVersion.ToString(), 400);
row4.AddBottomLine();
}
listView.AdjustRealHeight(Application.GetRealHeight(23));
}
#endregion
}
}