using System;
using System.Collections.Generic;
using System.Text;
namespace Shared.Phone.UserCenter.HideOption
{
///
/// 本地缓存文件夹列表的界面
///
public class HideOptionDirectoryListForm : 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);
Type type = typeof(DirNameResourse);
var PropertyList = type.GetFields();
var listFile = new List();
foreach (var item in PropertyList)
{
if (item.Name.EndsWith("Directory") == true)
{
listFile.Add(item);
}
}
for (int i = 0; i < listFile.Count; i++)
{
var item = listFile[i];
this.AddRowControl(listView, item.Name, item.GetValue(null).ToString(), true);
}
//本地文件
var row1 = new FrameRowControl(listView.rowSpace / 2);
listView.AddChidren(row1);
row1.AddLeftCaption("根目录文件", 800);
row1.AddRightArrow();
row1.AddBottomLine();
row1.ButtonClickEvent += (sender, e) =>
{
var form = new HideOptionFileListForm();
form.AddForm(UserCenterLogic.CombinePath());
};
//查看全部文件
var row2 = new FrameRowControl(listView.rowSpace / 2);
listView.AddChidren(row2);
row2.AddLeftCaption("查看全部文件", 800);
row2.AddRightArrow();
row2.ButtonClickEvent += (sender, e) =>
{
var form = new HideOptionSearchAllFile();
form.AddForm(Shared.IO.FileUtils.RootPath);
};
listView.AdjustRealHeight(Application.GetRealHeight(23));
}
private void AddRowControl(VerticalListControl listView, string directory, string directoryValue, bool addLine)
{
string myPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory, directoryValue);
if (directoryValue == DirNameResourse.LocalMemoryDirectory)
{
myPath = UserCenterLogic.CombinePath(DirNameResourse.LocalMemoryDirectory);
}
if (System.IO.Directory.Exists(myPath) == false)
{
return;
}
var row1 = new FrameRowControl(listView.rowSpace / 2);
listView.AddChidren(row1);
row1.AddLeftCaption(directory, 800);
row1.AddRightArrow();
if (addLine == true)
{
row1.AddBottomLine();
}
row1.ButtonClickEvent += (sender, e) =>
{
var form = new HideOptionFileListForm();
form.AddForm(myPath);
};
}
#endregion
#region ■ 一般方法___________________________
#endregion
}
}