From c0ce2f57a4f836ebeb9e7b8b4b5a4407fd78dc86 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 23 九月 2020 10:06:05 +0800
Subject: [PATCH] 上传

---
 ZigbeeApp/Shared/Common/CommonPage.cs                                                  |    2 
 ZigbeeApp/GateWay.Droid/Assets/Language.ini                                            |    1 
 ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs            |   90 ++++++------
 ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs                                  |   38 +++++
 ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs                   |   85 +++++++++++
 ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs                |   27 +--
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs        |   12 +
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs           |   72 +++++++++
 ZigbeeApp/Shared/R.cs                                                                  |    6 
 ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayModuleUpdateForm.cs |   54 ++++++-
 ZigbeeApp/GateWay.Droid/Assets/DeviceName.ini                                          |    4 
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs                |    4 
 12 files changed, 307 insertions(+), 88 deletions(-)

diff --git a/ZigbeeApp/GateWay.Droid/Assets/DeviceName.ini b/ZigbeeApp/GateWay.Droid/Assets/DeviceName.ini
index a8bd491..caf9e46 100755
--- a/ZigbeeApp/GateWay.Droid/Assets/DeviceName.ini
+++ b/ZigbeeApp/GateWay.Droid/Assets/DeviceName.ini
@@ -139,9 +139,9 @@
 ;妯″潡ID=DeviceConcreteType鐨勫�� / 璁惧鐨勫畼鏂瑰悕瀛� / 璁惧榛樿澶囨敞鍚嶅瓧 / DeviceBeloneType鐨勫�� /璁惧鎵�灞炵绫荤殑鍚嶅瓧 / 璁惧绫诲瀷鍚嶅瓧
 
 ;鏅鸿兘闂ㄩ攣(H06C)銆�
-H06C = 2800 / S-one 鏅鸿兘闂ㄩ攣 / H06C 鏅鸿兘闂ㄩ攣 / 2800 / 闂ㄩ攣 / 鏅鸿兘闂ㄩ攣
+H06C = 2800 / H06C 鏅鸿兘闂ㄩ攣 / H06C 鏅鸿兘闂ㄩ攣 / 2800 / 闂ㄩ攣 / 鏅鸿兘闂ㄩ攣
 ;鏅鸿兘闂ㄩ攣(S-one)銆�
-S-one = 2802 / H06C 鏅鸿兘闂ㄩ攣 / S-one 鏅鸿兘闂ㄩ攣 / 2800 / 闂ㄩ攣 / 鏅鸿兘闂ㄩ攣
+S-one = 2802 / S-one 鏅鸿兘闂ㄩ攣 / S-one 鏅鸿兘闂ㄩ攣 / 2800 / 闂ㄩ攣 / 鏅鸿兘闂ㄩ攣
 
 ;***************************************************************
 ;                           绌鸿皟璁惧
diff --git a/ZigbeeApp/GateWay.Droid/Assets/Language.ini b/ZigbeeApp/GateWay.Droid/Assets/Language.ini
index 754fb8d..c41659f 100755
--- a/ZigbeeApp/GateWay.Droid/Assets/Language.ini
+++ b/ZigbeeApp/GateWay.Droid/Assets/Language.ini
@@ -2039,6 +2039,7 @@
 16164=杩囨埛鎴愬姛
 16165=杩囨埛澶辫触
 16166=鎭枩{0}鎴愪负銆寋1}銆嶇鐞嗗憳
+16167=妫�娴嬪埌杩樻病鏈夊浠�,璇峰厛澶囦唤
 
 ;鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽�
 18004=鎸囧畾缃戝叧宸茬粡琚粦瀹�
diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs
index e595c06..34864f1 100755
--- a/ZigbeeApp/Shared/Common/CommonPage.cs
+++ b/ZigbeeApp/Shared/Common/CommonPage.cs
@@ -42,7 +42,7 @@
         /// <summary>
         /// 鐗堟湰鍙�
         /// </summary>
-        public static string CodeIDString = "1.1.0120092101";
+        public static string CodeIDString = "1.1.0120092301";
         /// <summary>
         /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee)
         /// </summary>
diff --git a/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs b/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs
index 0cbedac..9629a44 100755
--- a/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs
+++ b/ZigbeeApp/Shared/Phone/CommonForm/EditorCommonForm.cs
@@ -330,6 +330,44 @@
 
         #endregion
 
+        #region 鈻� 鏄剧ず寮圭獥杈撳叆鐣岄潰___________________
+
+        /// <summary>
+        /// <para>鏄剧ず涓�涓狣ialog鐨勫脊绐楄緭鍏ョ晫闈�,瀹冧笉浼氳嚜鍔ㄥ叧闂�,闇�瑕佹墜鍔ㄥ叧闂�</para>
+        /// <para>.CloseDialog()涓哄叧闂脊绐�</para>
+        /// <para>濡傛灉杈撳叆妗嗙殑鍐呭涓虹┖,骞朵笖璁剧疆鏈夈�恑_TipText銆�,鍒欎笉浼氳皟鐢ㄥ洖璋冨嚱鏁�,骞朵笖鎻愮ず銆恑_TipText銆戠殑鍐呭</para>
+        /// </summary>
+        /// <param name="i_TitleText">寮圭獥鐨勬爣棰樹俊鎭�</param>
+        /// <param name="i_InputText">杈撳叆妗嗗垵濮嬪寲鍊�(蹇界暐璇疯缃负null)</param>
+        /// <param name="i_TipText">杈撳叆妗嗙伆鑹插瓧浣撹鏄�(蹇界暐璇疯缃负null)</param>
+        /// <param name="i_ComfirmClickEvent">纭鎸夐挳浜嬩欢</param>
+        /// <returns></returns>
+        public void ShowDialogInputForm(string i_TitleText, string i_InputText, string i_TipText, Action<DialogInputControl, string> i_ComfirmClickEvent)
+        {
+            //鐢熸垚涓�涓脊绐楃敾闈�
+            var dialogForm = new DialogInputControl();
+            //鏍囬
+            dialogForm.SetTitleText(i_TitleText);
+            //杈撳叆妗嗙伆鑹插瓧浣撹鏄�
+            if (i_TipText != null)
+            {
+                dialogForm.SetTipText(i_TipText);
+            }
+            //杈撳叆妗嗗垵濮嬪��
+            if (i_InputText != null)
+            {
+                dialogForm.Text = i_InputText;
+            }
+
+            //鎸変笅纭鎸夐挳
+            dialogForm.ComfirmClickEvent += ((textValue) =>
+            {
+                i_ComfirmClickEvent?.Invoke(dialogForm, textValue);
+            });
+        }
+
+        #endregion
+
         #region 鈻� 鏄剧ず娌℃湁鏁版嵁鐨勫浘鍍忔樉绀虹壒鏁坃________
 
         /// <summary>
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs
index ef0aaaa..a356a87 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Common/UserCenterCommon.cs
@@ -507,7 +507,7 @@
     public class FirmwareVersionInfo
     {
         /// <summary>
-        /// 浜戠涓婇潰鐨勯偅涓悕瀛�
+        /// 浜戠涓婇潰鐨勯偅涓悕瀛�,濡傛灉鏄湰鍦扮┖璋冪殑妯″潡鏃�,瀹冧负鍏ㄨ矾寰�
         /// </summary>
         public string Name = string.Empty;
         /// <summary>
@@ -535,7 +535,7 @@
         /// </summary>
         public string HardwareVersion = string.Empty;
         /// <summary>
-        /// 闀滃儚绫诲瀷
+        /// 闀滃儚绫诲瀷(褰撶瓑浜�-100鏃�,浠h〃瀹冩槸绌鸿皟鐨勬湰鍦版ā鍧�)
         /// </summary>
         public string ImagType = string.Empty;
         /// <summary>
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs
index 4d96275..8a341c1 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs
@@ -172,8 +172,16 @@
             await System.Threading.Tasks.Task.Delay(1000);
 
             //涓嬭浇鍥轰欢璧勬簮
-            var pra = new { RequestVersion = Common.CommonPage.RequestVersion, DistributedMark = this.deviceFirmware.DistributedMark };
-            this.deviceFirmwareByte = Common.CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("FirmwareMana/DownloadPlatformUploadFirmware", Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(pra)));
+            if (this.deviceFirmware.ImagType != "-100")
+            {
+                var pra = new { RequestVersion = Common.CommonPage.RequestVersion, DistributedMark = this.deviceFirmware.DistributedMark };
+                this.deviceFirmwareByte = Common.CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("FirmwareMana/DownloadPlatformUploadFirmware", Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(pra)));
+            }
+            else
+            {
+                //鍙栨湰鍦版ā鏉�
+                this.deviceFirmwareByte = HdlFileLogic.Current.ReadFileByteContent(this.deviceFirmware.Name);
+            }
             if (this.deviceFirmwareByte == null)
             {
                 //璁惧鍥轰欢璧勬簮涓嬭浇澶辫触
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs
index 45aed43..36407c7 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlFirmwareUpdateLogic.cs
@@ -445,7 +445,11 @@
 
             //鑾峰彇闇�瑕佷笅杞界殑鍥轰欢鏁版嵁
             var listVersion = GetNeedToDownLoadVersionData(listTempDevice, listTempGateway);
-            if (listVersion.Count == 0)
+            //鑾峰彇闇�瑕佷笅杞界殑绌鸿皟妯″潡
+            var listAcOta = new List<OTADevice>();
+            var listAcUpdate = GetNeedDownLoadAirConditionerModule(listTempDevice, ref listAcOta);
+
+            if (listVersion.Count == 0 && listAcUpdate.Count == 0)
             {
                 return 0;
             }
@@ -468,6 +472,8 @@
             //鍥轰欢瀛樺偍璺緞
             string firmwareDir = DirNameResourse.FirmwareUpdateDirectory;
             int nowCount = 0;
+            int macCount = listVersion.Count + listAcUpdate.Count;
+
             foreach (var versionData in listVersion)
             {
                 nowCount++;
@@ -476,6 +482,8 @@
                 if (result == -1)
                 {
                     ProgressFormBar.Current.Close();
+                    //淇濆瓨鍒楄〃鍚嶅瓧
+                    HdlFileLogic.Current.SaveFileContent(DirNameResourse.FirmwareUpdateList, dicFirmwareName);
                     return -1;
                 }
                 //鑾峰彇褰撳墠杩欎釜鐗堟湰鐨勫浐浠朵俊鎭�
@@ -483,15 +491,17 @@
                 if (versionFirmware == null)
                 {
                     //浜戠娌℃湁杩欎釜鐗堟湰  杩涘害鍊�
-                    ProgressFormBar.Current.SetValue(nowCount, listVersion.Count);
+                    ProgressFormBar.Current.SetValue(nowCount, macCount);
                     continue;
                 }
                 //鍘讳笅杞借繖涓浐浠�
                 var pra = new { RequestVersion = Common.CommonPage.RequestVersion, DistributedMark = versionFirmware.DistributedMark };
-                var byteData = UserCenterLogic.GetByteResponseDataByRequestHttps("FirmwareMana/DownloadPlatformUploadFirmware", false, pra, null, true);
+                var byteData = UserCenterLogic.GetByteResponseDataByRequestHttps("FirmwareMana/DownloadPlatformUploadFirmware", false, pra, new List<string> { "NotCheck" }, true);
                 if (byteData == null)
                 {
                     ProgressFormBar.Current.Close();
+                    //淇濆瓨鍒楄〃鍚嶅瓧
+                    HdlFileLogic.Current.SaveFileContent(DirNameResourse.FirmwareUpdateList, dicFirmwareName);
                     return -1;
                 }
                 //淇濆瓨鍥轰欢
@@ -500,8 +510,29 @@
                 dicFirmwareName[saveFile] = versionFirmware.Name;
 
                 //杩涘害鍊�
-                ProgressFormBar.Current.SetValue(nowCount, listVersion.Count);
+                ProgressFormBar.Current.SetValue(nowCount, macCount);
             }
+            for (int i = 0; i < listAcUpdate.Count; i++)
+            {
+                //涓嬭浇绌鸿皟妯″潡
+                var pra = new { RequestVersion = Common.CommonPage.RequestVersion, DistributedMark = listAcUpdate[i].DistributedMark };
+                var deviceFirmwareByte = UserCenterLogic.GetByteResponseDataByRequestHttps("FirmwareMana/DownloadPlatformUploadFirmware", false, pra, new List<string> { "NotCheck" }, true);
+                if (deviceFirmwareByte == null)
+                {
+                    ProgressFormBar.Current.Close();
+                    //淇濆瓨鍒楄〃鍚嶅瓧
+                    HdlFileLogic.Current.SaveFileContent(DirNameResourse.FirmwareUpdateList, dicFirmwareName);
+                    return -1;
+                }
+                //淇濆瓨鍥轰欢
+                string fileName = "AC_" + listAcOta[i].HwVersion + "_" + listAcOta[i].ImgTypeId + "_" + listAcUpdate[i].Name;
+                var saveFile = System.IO.Path.Combine(firmwareDir, fileName);
+                HdlFileLogic.Current.SaveByteToFile(saveFile, deviceFirmwareByte);
+
+                //杩涘害鍊�
+                ProgressFormBar.Current.SetValue(nowCount, macCount);
+            }
+
             //淇濆瓨鍒楄〃鍚嶅瓧
             HdlFileLogic.Current.SaveFileContent(DirNameResourse.FirmwareUpdateList, dicFirmwareName);
             ProgressFormBar.Current.Close();
@@ -601,6 +632,39 @@
         }
 
         /// <summary>
+        /// 鑾峰彇闇�瑕佷笅杞界殑绌鸿皟妯″潡
+        /// </summary>
+        /// <param name="listDevice">璁惧鍒楄〃</param>
+        /// <param name="listTaget">涓庤繑鍥炲�煎搴旂殑涓滆タ</param>
+        private static List<FirmwareVersionInfo> GetNeedDownLoadAirConditionerModule(List<OTADevice> listDevice, ref List<OTADevice> listTaget)
+        {
+            var listUpdate = new List<FirmwareVersionInfo>();
+            //鍥轰欢瀛樺偍璺緞
+            string firmwareDir = DirNameResourse.FirmwareUpdateDirectory;
+
+            foreach (var otaDevice in listDevice)
+            {
+                var myType = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice> { otaDevice });
+                if (myType.ConcreteType != Common.DeviceConcreteType.AirConditioner_ZbGateway)
+                {
+                    //鍙鐞嗕腑澶┖璋�
+                    continue;
+                }
+                var list = GetFirmwareVersionListInfo(FirmwareLevelType.A璁惧, otaDevice.HwVersion.ToString(), otaDevice.ImgTypeId.ToString());
+                foreach (var data in list)
+                {
+                    if (data.Name.EndsWith(".bin") == true && System.IO.File.Exists(firmwareDir) == false)
+                    {
+                        //鍙.bin鏂囦欢
+                        listUpdate.Add(data);
+                        listTaget.Add(otaDevice);
+                    }
+                }
+            }
+            return listUpdate;
+        }
+
+        /// <summary>
         /// 妯℃澘璁惧鐨勭増鏈俊鎭�
         /// </summary>
         private class TemplateDeviceVersion
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayModuleUpdateForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayModuleUpdateForm.cs
index d92d8ae..67d7b61 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayModuleUpdateForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/ACZbGatewayModuleUpdateForm.cs
@@ -77,16 +77,7 @@
         /// </summary>
         private void InitAirConditioningModuleList(VerticalListControl listView)
         {
-            var list = HdlFirmwareUpdateLogic.GetFirmwareVersionListInfo(FirmwareLevelType.A璁惧, otaDevice.HwVersion.ToString(), otaDevice.ImgTypeId.ToString());
-            var listUpdate = new List<FirmwareVersionInfo>();
-            foreach (var data in list)
-            {
-                if (data.Name.EndsWith(".bin") == true)
-                {
-                    //鍙.bin鏂囦欢
-                    listUpdate.Add(data);
-                }
-            }
+            var listUpdate = this.GetAirConditioningModuleData();
             if (listUpdate.Count == 0)
             {
                 //娌℃湁鍙崌绾х殑绌鸿皟妯″潡
@@ -130,7 +121,7 @@
         /// <param name="listView"></param>
         /// <param name="info"></param>
         /// <param name="mainkeys"></param>
-        private void AddModuleRow(VerticalListControl listView, FirmwareVersionInfo info, string mainkeys,bool addLine)
+        private void AddModuleRow(VerticalListControl listView, FirmwareVersionInfo info, string mainkeys, bool addLine)
         {
             //鑾峰彇绌鸿皟妯″潡鐨勫悕瀛�
             string textView = this.GetAirConditioningModuleName(info);
@@ -214,6 +205,47 @@
 
         #endregion
 
+        #region 鈻� 鑾峰彇绌鸿皟妯″潡鏁版嵁___________________
+
+        /// <summary>
+        /// 鑾峰彇绌鸿皟妯″潡鏁版嵁
+        /// </summary>
+        /// <returns></returns>
+        private List<FirmwareVersionInfo> GetAirConditioningModuleData()
+        {
+            var listUpdate = new List<FirmwareVersionInfo>();
+
+            var list = HdlFirmwareUpdateLogic.GetFirmwareVersionListInfo(FirmwareLevelType.A璁惧, otaDevice.HwVersion.ToString(), otaDevice.ImgTypeId.ToString());
+            foreach (var data in list)
+            {
+                if (data.Name.EndsWith(".bin") == true)
+                {
+                    //鍙.bin鏂囦欢
+                    listUpdate.Add(data);
+                }
+            }
+            if (Common.Config.Instance.Home.TemplateMode == 2 && listUpdate.Count == 0)
+            {
+                //浠庢湰鍦拌幏鍙�
+                var listFile = HdlFileLogic.Current.GetFileFromDirectory(DirNameResourse.FirmwareUpdateDirectory);
+                string otaKey = otaDevice.HwVersion.ToString() + "_" + otaDevice.ImgTypeId.ToString();
+                foreach (var file in listFile)
+                {
+                    if (file.StartsWith("AC_" + otaKey) == true && file.EndsWith(".bin") == true)
+                    {
+                        var info = new FirmwareVersionInfo();
+                        info.Name = System.IO.Path.Combine(DirNameResourse.FirmwareUpdateDirectory, file);
+                        info.ImagType = "-100";
+                        listUpdate.Add(info);
+                    }
+                }
+            }
+
+            return listUpdate;
+        }
+
+        #endregion
+
         #region 鈻� 涓�鑸柟娉昣__________________________
 
         /// <summary>
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs
index fdfbbc8..6e2ceb4 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionDirectoryListForm.cs
@@ -1,6 +1,6 @@
 锘縰sing System;
 using System.Collections.Generic;
-using System.IO;
+using System.IO;
 using System.Text;
 
 namespace Shared.Phone.UserCenter.HideOption
@@ -66,10 +66,10 @@
             {
                 var form = new HideOptionSearchAllFile();
                 form.AddForm(Common.Config.Instance.FullPath);
-            };
-
+            };
+
 #if iOS
-            //鏌ョ湅鍏ㄩ儴鏂囦欢
+            //鏌ョ湅鍏ㄩ儴鏂囦欢
             var row0 = new FrameRowControl(listView.rowSpace / 2);
             listView.AddChidren(row0);
             row0.AddLeftCaption("IOS鍥剧墖", 800);
@@ -79,47 +79,47 @@
             row0.ButtonClickEvent += (sender, e) =>
             {
                 string fileName = "Item/Add.png";
-                if (File.Exists(Path.Combine(Application.RootPath, fileName)))
-                {
-                    var form = new HideOptionSearchAllFile();
-                    form.AddForm(Application.RootPath);
-                    return;
-                }
-
-                string dirPath = string.Empty;
-                if (Application.Skin != null)
-                {
-                    dirPath = Application.Skin + "/" + fileName;
-                    if (File.Exists(Path.Combine(Application.RootPath, dirPath)))
-                    {
-                        var form = new HideOptionSearchAllFile();
-                        form.AddForm(Path.Combine(Application.RootPath, Application.Skin + "/"));
-                        return;
-                    }
-                    string text2 = Foundation.NSBundle.MainBundle.PathForResource(dirPath, null);
-                    if (text2 != null)
-                    {
-                        var form = new HideOptionSearchAllFile();
-                        form.AddForm(text2.Replace(dirPath, string.Empty));
-                        return;
-                    }
-                }
-                else
-                {
-                    dirPath = "Phone/" + fileName;
-                    if (File.Exists(Path.Combine(Application.RootPath, dirPath)))
-                    {
-                        var form = new HideOptionSearchAllFile();
-                        form.AddForm(Path.Combine(Application.RootPath, "Phone/"));
-                        return;
-                    }
-                    string text2 = Foundation.NSBundle.MainBundle.PathForResource(dirPath, null);
-                    if (text2 != null)
-                    {
-                        var form = new HideOptionSearchAllFile();
-                        form.AddForm(text2.Replace(dirPath, string.Empty));
-                        return;
-                    }
+                if (File.Exists(Path.Combine(Application.RootPath, fileName)))
+                {
+                    var form = new HideOptionSearchAllFile();
+                    form.AddForm(Application.RootPath);
+                    return;
+                }
+
+                string dirPath = string.Empty;
+                if (Application.Skin != null)
+                {
+                    dirPath = Application.Skin + "/" + fileName;
+                    if (File.Exists(Path.Combine(Application.RootPath, dirPath)))
+                    {
+                        var form = new HideOptionSearchAllFile();
+                        form.AddForm(Path.Combine(Application.RootPath, Application.Skin + "/"));
+                        return;
+                    }
+                    string text2 = Foundation.NSBundle.MainBundle.PathForResource(dirPath, null);
+                    if (text2 != null)
+                    {
+                        var form = new HideOptionSearchAllFile();
+                        form.AddForm(text2.Replace(dirPath, string.Empty));
+                        return;
+                    }
+                }
+                else
+                {
+                    dirPath = "Phone/" + fileName;
+                    if (File.Exists(Path.Combine(Application.RootPath, dirPath)))
+                    {
+                        var form = new HideOptionSearchAllFile();
+                        form.AddForm(Path.Combine(Application.RootPath, "Phone/"));
+                        return;
+                    }
+                    string text2 = Foundation.NSBundle.MainBundle.PathForResource(dirPath, null);
+                    if (text2 != null)
+                    {
+                        var form = new HideOptionSearchAllFile();
+                        form.AddForm(text2.Replace(dirPath, string.Empty));
+                        return;
+                    }
                 }
             };
 #endif
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs b/ZigbeeApp/Shared/Phone/UserCenter/HideOption/HideOptionSearchAllFile.cs
index a32d8ec..74bfc7b 100644
--- 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.Trim('/'));
+                this.InitMiddleFrame(nextDir);
             };
         }
 
@@ -89,23 +89,16 @@
             //}
             //else
             {
-                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();
+                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]);
                 }
-                catch
-                {
-                    this.ShowMassage(ShowMsgType.Tip, "璇诲彇鏂囦欢澶瑰唴瀹瑰け璐�");
-                }
+                listDirectory.Sort();
+
+                listAllFile = HdlFileLogic.Current.GetFileFromDirectory(directory.TrimEnd('/'));
+                listAllFile.Sort();
             }
 
             var listView = new VerticalListControl(23);
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs
index 93d88bc..3484cb6 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/ResidenceListMainForm.cs
@@ -258,11 +258,11 @@
                 btnTransfer.TextID = R.MyInternationalizationString.uTransfer;
                 btnTransfer.ButtonClickEvent += (sender, e) =>
                 {
+                    rowLayout.HideMenu();
                     HdlCheckLogic.Current.CheckSecondarySecurity(() =>
                     {
-                        //楠岃瘉鎴愬姛
-                        var form = new Transfer.TransferResidenceMainForm();
-                        form.AddForm(1);
+                        //鎵ц杩囨埛鎿嶄綔
+                        this.DoTransferResidence();
                     },
                     () =>
                     {
@@ -576,6 +576,85 @@
 
         #endregion
 
+        #region 鈻� 杩囨埛_______________________________
+
+        /// <summary>
+        /// 鎵ц杩囨埛鎿嶄綔
+        /// </summary>
+        private void DoTransferResidence()
+        {
+            this.ShowProgressBar();
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //妫�娴嬪畠鏈夋病鏈夊浠�
+                var listBack = HdlBackupLogic.Current.GetBackupListNameFromDB();
+                this.CloseProgressBar();
+
+                if (listBack == null)
+                {
+                    return;
+                }
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    if (listBack.Count > 0)
+                    {
+                        var form = new Transfer.TransferResidenceMainForm();
+                        form.AddForm(1);
+                    }
+                    else
+                    {
+                        //妫�娴嬪埌杩樻病鏈夊浠�,璇峰厛澶囦唤
+                        this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uIsNotHadBackupByCheckPleaseBackup));
+
+                        //鐢熸垚涓�涓脊绐楃敾闈�
+                        this.ShowDialogInputForm(Language.StringByID(R.MyInternationalizationString.uAddBackup),
+                         Config.Instance.Home.Name,
+                         Language.StringByID(R.MyInternationalizationString.uPleaseInpuBackupName), (dialogForm, textValue) =>
+                         {
+                             //鐢婚潰鍏抽棴
+                             dialogForm.CloseDialog();
+
+                             HdlThreadLogic.Current.RunThread(() =>
+                             {
+                                 //鍒涘缓涓�涓浠藉悕瀛�
+                                 string backupClassId = HdlBackupLogic.Current.CreatNewBackupNameToDB(textValue);
+                                 if (backupClassId == null)
+                                 {
+                                     //鍒涘缓澶囦唤鍚嶅瓧澶辫触
+                                     string msg = Language.StringByID(R.MyInternationalizationString.uCreatBackupNameFail);
+                                     this.ShowMassage(ShowMsgType.Error, msg);
+
+                                     return;
+                                 }
+
+                                 //涓婁紶鏁版嵁鍒颁簯绔�
+                                 bool result = HdlBackupLogic.Current.UpLoadBackupFileToDB(backupClassId);
+                                 if (result == false)
+                                 {
+                                     //鏂囦欢涓婁紶澶辫触
+                                     string msg = Language.StringByID(R.MyInternationalizationString.uFileUpLoadFail);
+                                     this.ShowMassage(ShowMsgType.Error, msg);
+
+                                     //濡傛灉涓婁紶澶辫触鐨勮瘽锛屽氨鎶婂畠鍒犻櫎
+                                     HdlBackupLogic.Current.DeleteDbBackupData(backupClassId);
+
+                                     return;
+                                 }
+
+                                 HdlThreadLogic.Current.RunMain(() =>
+                                 {
+                                     var form = new Transfer.TransferResidenceMainForm();
+                                     form.AddForm(1);
+                                 });
+                             });
+                         });
+                    }
+                });
+            });
+        }
+
+        #endregion
+
         #region 鈻� 涓�鑸柟娉昣__________________________
 
         /// <summary>
diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs
index 1f4212d..5adc1c0 100755
--- a/ZigbeeApp/Shared/R.cs
+++ b/ZigbeeApp/Shared/R.cs
@@ -6479,7 +6479,11 @@
         /// <summary>
         /// 鎭枩XXXXX鎴愪负銆孨NNNN銆嶇鐞嗗憳
         /// </summary>
-        public const int uCongratulationsXXBecomingNNAdministrator = 16166;
+        public const int uCongratulationsXXBecomingNNAdministrator = 16166;
+        /// <summary>
+        /// 妫�娴嬪埌杩樻病鏈夊浠�,璇峰厛澶囦唤
+        /// </summary>
+        public const int uIsNotHadBackupByCheckPleaseBackup = 16167;
 
 
         //鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽�

--
Gitblit v1.8.0