黄学彪
2020-09-22 ade5917841b0fdcb1df7353ef7c56b1a1bdc9282
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter.HideOption
{
    /// <summary>
    /// 本地缓存文件夹列表的界面
    /// </summary>
    public class HideOptionDirectoryListForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        public void ShowForm()
        {
            //设置头部信息
            base.SetTitleText("文件夹列表");
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        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<System.Reflection.FieldInfo>();
            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
    }
}