From ecba45c93391066bc30c7bd602c3a7683fbb99a7 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 31 七月 2020 10:56:12 +0800
Subject: [PATCH] 临时备份

---
 ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileListForm.cs |  167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 167 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileListForm.cs
new file mode 100755
index 0000000..a4a3e23
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionFileListForm.cs
@@ -0,0 +1,167 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone.UserCenter.HideOption
+{
+    /// <summary>
+    /// 鏈湴缂撳瓨鏂囦欢鍒楄〃鐨勭晫闈�
+    /// </summary>
+    public class HideOptionFileListForm : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 瑙e瘑
+        /// </summary>
+        private bool decryptPassword = false;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        public void ShowForm(string directory)
+        {
+            //璁剧疆澶撮儴淇℃伅
+            base.SetTitleText("鏂囦欢鍒楄〃");
+
+            var btnButton = new NormalViewControl(200, 69, true);
+            btnButton.Gravity = Gravity.CenterVertical;
+            btnButton.X = bodyFrameLayout.Width - Application.GetRealWidth(200) - ControlCommonResourse.XXLeft;
+            btnButton.TextColor = UserCenterColor.Current.TopLayoutTitleText;
+            btnButton.TextAlignment = TextAlignment.BottomRight;
+            btnButton.TextSize = 17;
+            btnButton.Text = "缈昏瘧";
+            topFrameLayout.AddChidren(btnButton);
+            btnButton.ButtonClickEvent += (sender, e) =>
+            {
+                if (this.decryptPassword == false)
+                {
+                    this.decryptPassword = true;
+                    //鍒濆鍖栦腑閮ㄤ俊鎭�
+                    this.InitMiddleFrame(directory);
+                }
+            };
+
+            //鍒濆鍖栦腑閮ㄤ俊鎭�
+            this.InitMiddleFrame(directory);
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄤ俊鎭�
+        /// </summary>
+        private void InitMiddleFrame(string directory)
+        {
+            this.ClearBodyFrame();
+
+            var listAllFile = HdlFileLogic.Current.GetFileFromDirectory(directory);
+            listAllFile.Sort();
+
+            var listView = new VerticalListControl(23);
+            listView.BackgroundColor = UserCenterColor.Current.White;
+            listView.Height = bodyFrameLayout.Height;
+            bodyFrameLayout.AddChidren(listView);
+
+            for (int i = 0; i < listAllFile.Count; i++)
+            {
+                this.AddRowControl(listView, listAllFile[i], directory, i != listAllFile.Count - 1);
+            }
+            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 AddRowControl(VerticalListControl listView, string fileName, string directory, bool addLine)
+        {
+            string fileNewName = fileName;
+            if (decryptPassword == true && fileName.StartsWith("Device_") == false)
+            {
+                try
+                {
+                    fileNewName = UserCenterLogic.DecryptPassword(UserCenterResourse.FileEncryptKey, fileName);
+                }
+                catch { fileNewName = fileName; }
+            }
+
+            var row1 = new RowLayoutControl(listView.rowSpace / 2);
+            listView.AddChidren(row1);
+            var btnName = row1.frameTable.AddLeftCaption(fileNewName, 800);
+            btnName.IsMoreLines = true;
+            if (addLine == true)
+            {
+                row1.frameTable.AddBottomLine();
+            }
+            row1.frameTable.AddRightArrow();
+
+            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(fileName, HdlFileLogic.Current.ReadFileByteContent(tagrtFile));
+                    });
+                });
+            };
+
+            var btnDelete = row1.AddDeleteControl();
+            btnDelete.ButtonClickEvent += (sender, e) =>
+            {
+                this.ShowMassage(ShowMsgType.Confirm, "鏄惁娓呴櫎璇ョ紦瀛樻枃浠�", () =>
+                {
+                    var myFile = System.IO.Path.Combine(Common.Config.Instance.FullPath, directory, fileName);
+                    try
+                    {
+                        System.IO.File.Delete(myFile);
+                        row1.RemoveFromParent();
+                    }
+                    catch (Exception ex)
+                    {
+                        this.ShowMassage(ShowMsgType.Error, "娓呴櫎缂撳瓨鏂囦欢寮傚父");
+                        HdlLogLogic.Current.WriteLog(ex, "娓呴櫎缂撳瓨鏂囦欢寮傚父");
+                    }
+                });
+            };
+
+            row1.frameTable.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new HideOptionFileContentForm();
+                form.AddForm(System.IO.Path.Combine(Common.Config.Instance.FullPath, directory, fileName));
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0