From 224ea4055d5359d0bae0e7087ccc11724a2e49e5 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期二, 14 七月 2020 16:09:19 +0800 Subject: [PATCH] 备份新改的代码 --- ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs | 220 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 220 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs new file mode 100755 index 0000000..1809c0f --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs @@ -0,0 +1,220 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter.HideOption +{ + /// <summary> + /// 鏌ョ湅鍏ㄩ儴鏂囦欢 + /// </summary> + public class HideOptionSearchAllFile : EditorCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 瑙e瘑 + /// </summary> + private bool decryptPassword = false; + private string nowDirectory = string.Empty; + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm(string directory) + { + this.nowDirectory = 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(nowDirectory); + } + }; + + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(nowDirectory); + + this.BackButtonClickEvent = (btnContr) => + { + string rootPath = Shared.IO.FileUtils.RootPath.Trim('/'); + if (this.nowDirectory.Trim('/') == rootPath) + { + this.CloseForm(); + return; + } + string[] Arry = this.nowDirectory.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries); + string nextDir = string.Empty; + for (int i = 0; i < Arry.Length - 1; i++) + { + nextDir += Arry[i] + "/"; + } + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(nextDir); + }; + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + private void InitMiddleFrame(string directory) + { + this.nowDirectory = directory; + this.ClearBodyFrame(); + + var listDirectory = new List<string>(); + var listAllFile = new List<string>(); + + 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 + { + 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 = HdlAutoBackupLogic.GetFileFromDirectory(directory.TrimEnd('/')); + listAllFile.Sort(); + } + + var listView = new VerticalListControl(23); + listView.BackgroundColor = UserCenterColor.Current.White; + listView.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listView); + + if (listDirectory.Count > 0) + { + var row1 = new RowLayoutControl(listView.rowSpace / 2); + listView.AddChidren(row1); + row1.frameTable.UseClickStatu = false; + row1.frameTable.AddLeftCaption("銆愭枃浠跺す鍒楄〃銆�", 800); + + for (int i = 0; i < listDirectory.Count; i++) + { + this.AddDirectoryRowControl(listView, listDirectory[i], directory, i != listDirectory.Count - 1); + } + } + + if (listAllFile.Count > 0) + { + var row1 = new RowLayoutControl(listView.rowSpace / 2); + listView.AddChidren(row1); + row1.frameTable.UseClickStatu = false; + row1.frameTable.AddLeftCaption("銆愭枃浠跺垪琛ㄣ��", 800); + for (int i = 0; i < listAllFile.Count; i++) + { + this.AddFileRowControl(listView, listAllFile[i], directory, i != listAllFile.Count - 1); + } + } + listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(50)); + } + + private void AddDirectoryRowControl(VerticalListControl listView, string directoryName, string directory, bool addLine) + { + string dirNewName = directoryName; + if (decryptPassword == true) + { + try + { + dirNewName = UserCenterLogic.DecryptPassword(UserCenterResourse.FileEncryptKey, directoryName); + } + catch { dirNewName = directoryName; } + } + + var row1 = new RowLayoutControl(listView.rowSpace / 2); + listView.AddChidren(row1); + var btnName = row1.frameTable.AddLeftCaption(dirNewName, 800); + btnName.IsMoreLines = true; + if (addLine == true) + { + row1.frameTable.AddBottomLine(); + } + row1.frameTable.AddRightArrow(); + + row1.frameTable.ButtonClickEvent += (sender, e) => + { + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.decryptPassword = false; + this.InitMiddleFrame(System.IO.Path.Combine(directory, directoryName)); + }; + } + + private void AddFileRowControl(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 btnDelete = row1.AddDeleteControl(); + btnDelete.ButtonClickEvent += (sender, e) => + { + this.ShowMassage(ShowMsgType.Confirm, "鏄惁娓呴櫎璇ョ紦瀛樻枃浠�", () => + { + var myFile = System.IO.Path.Combine(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(directory, fileName)); + }; + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + #endregion + } +} -- Gitblit v1.8.0