From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 14 十二月 2020 09:59:01 +0800
Subject: [PATCH] 请合并代码,完成晾衣架最终功能。

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

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionGatewayListFileForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionGatewayListFileForm.cs
new file mode 100755
index 0000000..61669cd
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionGatewayListFileForm.cs
@@ -0,0 +1,203 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.UserCenter.HideOption
+{
+    /// <summary>
+    /// 闅愬尶鍔熻兘鐨勭綉鍏虫枃浠跺垪琛ㄧ晫闈�
+    /// </summary>
+    public class HideOptionGatewayListFileForm : EditorCommonForm
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 缃戝叧瀵硅薄
+        /// </summary>
+        private ZbGateway zbGateway = null;
+        private BottomClickButton btnDelete = null;
+        private List<string> listDeleteFile = new List<string>();
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓)
+        /// </summary>
+        /// <param name="i_gateway"></param>
+        public void ShowForm(ZbGateway i_gateway)
+        {
+            HdlFileLogic.Current.CreateDirectory(System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, "MyTempDir"), true);
+            this.zbGateway = i_gateway;
+            //璁剧疆鏍囬淇℃伅
+            base.SetTitleText("缃戝叧鏂囦欢鍒楄〃");
+            //鍒濆鍖栦腑閮ㄦ帶浠�
+            this.InitMiddleFrame();
+
+            var btnButton = new NormalViewControl(300, 69, true);
+            btnButton.Gravity = Gravity.CenterVertical;
+            btnButton.X = bodyFrameLayout.Width - Application.GetRealWidth(300) - ControlCommonResourse.XXLeft;
+            btnButton.TextColor = UserCenterColor.Current.TopLayoutTitleText;
+            btnButton.TextAlignment = TextAlignment.CenterRight;
+            btnButton.TextSize = 17;
+            btnButton.Text = "涓�閿垹闄�";
+            topFrameLayout.AddChidren(btnButton);
+            btnButton.ButtonClickEvent += (sender, e) =>
+            {
+                btnDelete.Visible = true;
+            };
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栦腑閮ㄦ帶浠�
+        /// </summary>
+        private void InitMiddleFrame()
+        {
+            //娓呯┖bodyFrame
+            this.ClearBodyFrame();
+
+            var listview = new VerticalListControl(29);
+            listview.Height = bodyFrameLayout.Height;
+            listview.BackgroundColor = UserCenterColor.Current.White;
+            bodyFrameLayout.AddChidren(listview);
+
+            this.ShowProgressBar();
+            HdlThreadLogic.Current.RunThread(async () =>
+            {
+                var result = await zbGateway.FileTransferLsDirAsync();
+
+                this.CloseProgressBar();
+                if (result == null || result.fileTransferLsDiResponseData == null)
+                {
+                    this.ShowMassage(ShowMsgType.Tip, "鑾峰彇鍒楄〃澶辫触,缃戝叧娌℃湁鍥炲");
+                    return;
+                }
+                if (result.fileTransferLsDiResponseData.Result != 0)
+                {
+                    this.ShowMassage(ShowMsgType.Tip, "鏌ョ湅澶辫触,濂藉儚缃戝叧涓嶅厑璁告煡鐪嬭繖涓洰褰�");
+                    return;
+                }
+
+                var listFile = new List<string>();
+                foreach (var data in result.fileTransferLsDiResponseData.Dir)
+                {
+                    string[] strArry = data.File.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
+                    listFile.Add(strArry[strArry.Length - 1]);
+                }
+                listFile.Sort();
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    foreach (var fileName in listFile)
+                    {
+                        var rowContr1 = new RowLayoutControl(listview.rowSpace / 2);
+                        listview.AddChidren(rowContr1);
+                        rowContr1.frameTable.AddLeftCaption(fileName, 700);
+                        rowContr1.frameTable.AddBottomLine();
+
+                        var btnSelect = new IconViewControl(58);
+                        btnSelect.UnSelectedImagePath = "Item/ItemSelected.png";
+                        btnSelect.Gravity = Gravity.Center;
+                        rowContr1.frameTable.AddChidren(btnSelect);
+                        btnSelect.Visible = false;
+
+                        var btnDelete = rowContr1.AddDeleteControl();
+                        btnDelete.ButtonClickEvent += (sender, e) =>
+                        {
+                            this.ShowMassage(ShowMsgType.Confirm, "鏄惁鍒犻櫎缃戝叧鐨勮繖涓枃浠�(闇�璋ㄦ厧)", async () =>
+                            {
+                                var result9 = await zbGateway.DelFileOrDirAsync("/etc/hdlDat/" + fileName);
+                                if (result9 == null || result9.delFileOrDirResponseData == null)
+                                {
+                                    this.ShowMassage(ShowMsgType.Tip, "鍒犻櫎鏂囦欢澶辫触,缃戝叧娌℃湁鍥炲");
+                                    return;
+                                }
+                                if (result9.delFileOrDirResponseData.Result == 1)
+                                {
+                                    this.ShowMassage(ShowMsgType.Tip, "鍒犻櫎鏂囦欢澶辫触,缃戝叧璇磋繖涓笢瑗夸笉瀛樺湪");
+                                    return;
+                                }
+                                if (result9.delFileOrDirResponseData.Result == 2)
+                                {
+                                    this.ShowMassage(ShowMsgType.Tip, "鍒犻櫎鏂囦欢澶辫触,缃戝叧璇磋繖涓笢瑗夸笉鍏佽鍒犻櫎");
+                                    return;
+                                }
+                                if (result9.delFileOrDirResponseData.Result != 0)
+                                {
+                                    this.ShowMassage(ShowMsgType.Tip, "鍒犻櫎鏂囦欢澶辫触,鏃犳硶璇嗗埆鐨勭姸鎬佺爜(" + result9.delFileOrDirResponseData.Result + ")");
+                                    return;
+                                }
+                                rowContr1.RemoveFromParent();
+                                this.ShowMassage(ShowMsgType.Tip, "鍒犻櫎鏂囦欢鎴愬姛");
+                            });
+                        };
+                    }
+
+                    listview.AdjustRealHeightByBottomButton(Application.GetRealHeight(23));
+
+                    this.btnDelete = new BottomClickButton();
+                    btnDelete.Text = "鍒犻櫎";
+                    bodyFrameLayout.AddChidren(btnDelete);
+                    btnDelete.Visible = false;
+                    btnDelete.ButtonClickEvent += (sender, e) =>
+                    {
+                        this.ShowMassage(ShowMsgType.Confirm, "纭畾鏄惁鍒犻櫎杩欎簺鏂囦欢?", async () =>
+                        {
+                            foreach (var listfile in this.listDeleteFile)
+                            {
+                                var result9 = await zbGateway.DelFileOrDirAsync("/etc/hdlDat/" + listfile);
+                                if (result9 == null || result9.delFileOrDirResponseData == null)
+                                {
+                                    this.ShowMassage(ShowMsgType.Tip, "鍒犻櫎鏂囦欢澶辫触,缃戝叧娌℃湁鍥炲");
+                                    this.InitMiddleFrame();
+                                    this.listDeleteFile = new List<string>();
+                                    return;
+                                }
+                                if (result9.delFileOrDirResponseData.Result == 1)
+                                {
+                                    this.ShowMassage(ShowMsgType.Tip, "鍒犻櫎鏂囦欢澶辫触,缃戝叧璇磋繖涓笢瑗夸笉瀛樺湪");
+                                    this.InitMiddleFrame();
+                                    this.listDeleteFile = new List<string>();
+                                    return;
+                                }
+                                if (result9.delFileOrDirResponseData.Result == 2)
+                                {
+                                    this.ShowMassage(ShowMsgType.Tip, "鍒犻櫎鏂囦欢澶辫触,缃戝叧璇磋繖涓笢瑗夸笉鍏佽鍒犻櫎");
+                                    this.InitMiddleFrame();
+                                    this.listDeleteFile = new List<string>();
+                                    return;
+                                }
+                                if (result9.delFileOrDirResponseData.Result != 0)
+                                {
+                                    this.ShowMassage(ShowMsgType.Tip, "鍒犻櫎鏂囦欢澶辫触,鏃犳硶璇嗗埆鐨勭姸鎬佺爜(" + result9.delFileOrDirResponseData.Result + ")");
+                                    this.InitMiddleFrame();
+                                    this.listDeleteFile = new List<string>();
+                                    return;
+                                }
+                            }
+                            this.InitMiddleFrame();
+                            this.listDeleteFile = new List<string>();
+                        });
+                    };
+                });
+            });
+        }
+
+        #endregion
+
+        #region 鈻� 鐣岄潰鍏抽棴___________________________
+
+        /// <summary>
+        /// 鐣岄潰鍏抽棴
+        /// </summary>
+        public override void CloseFormBefore()
+        {
+            HdlFileLogic.Current.DeleteDirectory(System.IO.Path.Combine(DirNameResourse.LocalMemoryDirectory, "MyTempDir"));
+
+            base.CloseFormBefore();
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0