From f2dc339a90467553ef7fe86a8312bdc9d590e420 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 23 九月 2020 09:27:11 +0800
Subject: [PATCH] 更新 DeviceName.ini

---
 ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs |  110 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 92 insertions(+), 18 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs
old mode 100755
new mode 100644
index 1809c0f..a32d8ec
--- a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs
@@ -65,7 +65,7 @@
                     nextDir += Arry[i] + "/";
                 }
                 //鍒濆鍖栦腑閮ㄤ俊鎭�
-                this.InitMiddleFrame(nextDir);
+                this.InitMiddleFrame(nextDir.Trim('/'));
             };
         }
 
@@ -80,25 +80,32 @@
             var listDirectory = new List<string>();
             var listAllFile = new List<string>();
 
-            string rootPath = Shared.IO.FileUtils.RootPath.Trim('/');
-            if (this.nowDirectory.Trim('/') == rootPath)
+            //string rootPath = Shared.IO.FileUtils.RootPath.Trim('/');
+            //if (this.nowDirectory.Trim('/') == rootPath)
+            //{
+            //    //鏍圭洰褰曞彧瑕佷袱涓氨鍙互浜�
+            //    listDirectory.Add(Common.Config.Instance.Guid);
+            //    listDirectory.Add(Application.Skin != null ? Application.Skin : "Phone");
+            //}
+            //else
             {
-                //鏍圭洰褰曞彧瑕佷袱涓氨鍙互浜�
-                listDirectory.Add(Common.Config.Instance.Guid);
-                listDirectory.Add(Application.Skin != null ? Application.Skin : "Phone");
-            }
-            else
-            {
-                var files = System.IO.Directory.GetDirectories(directory);
-                foreach (var file in files)
-                {
-                    string[] arry = file.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
-                    listDirectory.Add(arry[arry.Length - 1]);
+                try
+                {
+                    var files = System.IO.Directory.GetDirectories(directory);
+                    foreach (var file in files)
+                    {
+                        string[] arry = file.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
+                        listDirectory.Add(arry[arry.Length - 1]);
+                    }
+                    listDirectory.Sort();
+
+                    listAllFile = HdlFileLogic.Current.GetFileFromDirectory(directory.TrimEnd('/'));
+                    listAllFile.Sort();
                 }
-                listDirectory.Sort();
-
-                listAllFile = HdlAutoBackupLogic.GetFileFromDirectory(directory.TrimEnd('/'));
-                listAllFile.Sort();
+                catch
+                {
+                    this.ShowMassage(ShowMsgType.Tip, "璇诲彇鏂囦欢澶瑰唴瀹瑰け璐�");
+                }
             }
 
             var listView = new VerticalListControl(23);
@@ -131,6 +138,30 @@
                 }
             }
             listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(50));
+
+            var btnButon = new BottomClickButton();
+            btnButon.Text = "鍒犻櫎鏂囦欢澶�";
+            bodyFrameLayout.AddChidren(btnButon);
+            btnButon.ButtonClickEvent += (sender, e) =>
+            {
+                this.ShowMassage(ShowMsgType.Confirm, "鏄惁娓呴櫎璇ユ枃浠跺す", () =>
+                {
+                    try
+                    {
+                        System.IO.Directory.Delete(directory, true);
+                        this.CloseForm();
+                    }
+                    catch (Exception ex)
+                    {
+                        this.ShowMassage(ShowMsgType.Error, "娓呴櫎缂撳瓨鏂囦欢澶瑰紓甯�");
+                        HdlLogLogic.Current.WriteLog(ex, "娓呴櫎缂撳瓨鏂囦欢澶瑰紓甯�");
+                    }
+                });
+            };
+            if (directory == Common.Config.Instance.FullPath)
+            {
+                btnButon.CanClick = false;
+            }
         }
 
         private void AddDirectoryRowControl(VerticalListControl listView, string directoryName, string directory, bool addLine)
@@ -185,6 +216,49 @@
             }
             row1.frameTable.AddRightArrow();
 
+            var btnReName = row1.AddDeleteControl();
+            btnReName.Text = "閲嶅懡鍚�";
+            btnReName.ButtonClickEvent += (sender, e) =>
+            {
+                //鐢熸垚涓�涓脊绐楃敾闈�
+                var dialogForm = new DialogInputControl();
+                //淇濆瓨妯℃澘鍒癆pp
+                dialogForm.SetTitleText("閲嶅懡鍚�");
+                //璇疯緭鍏ユ柊鍚嶅瓧
+                dialogForm.SetTipText("璇疯緭鍏ユ柊鍚嶅瓧");
+                dialogForm.Text = fileName;
+
+                //鎸変笅纭鎸夐挳
+                dialogForm.ComfirmClickEvent += ((textValue) =>
+                {
+                    //鐢婚潰鍏抽棴
+                    dialogForm.CloseDialog();
+                    if (textValue == string.Empty)
+                    {
+                        return;
+                    }
+                    HdlFileLogic.Current.MoveFileToDirectory(System.IO.Path.Combine(directory, fileName), System.IO.Path.Combine(directory, textValue));
+
+                    fileNewName = textValue;
+                    fileName = textValue;
+                    btnName.Text = textValue;
+                });
+            };
+
+            var btnUpLoad = row1.AddEditorControl();
+            btnUpLoad.Text = "涓婁紶";
+            btnUpLoad.ButtonClickEvent += (sender, e) =>
+            {
+                this.ShowMassage(ShowMsgType.Confirm, "鏄惁涓婁紶璇ユ枃浠�(娴嬭瘯)?", () =>
+                {
+                    HdlThreadLogic.Current.RunThread(() =>
+                    {
+                        string tagrtFile = System.IO.Path.Combine(directory, fileName);
+                        HdlBackupLogic.Current.UpLoadByteDataToOptionBackup(fileNewName, HdlFileLogic.Current.ReadFileByteContent(tagrtFile));
+                    });
+                });
+            };
+
             var btnDelete = row1.AddDeleteControl();
             btnDelete.ButtonClickEvent += (sender, e) =>
             {

--
Gitblit v1.8.0