From 0d9f64668fd7350d6a21fd157e32009a96d98134 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 16 十二月 2020 13:09:08 +0800 Subject: [PATCH] 新云端代码Ver1.2 --- ZigbeeApp/Shared/Phone/Common/Logic/HdlTemplateDataFormLogic.cs | 260 ++++++++++++++++++++++++++-------------------------- 1 files changed, 130 insertions(+), 130 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/TemplateData/TemplateDataFormLogic.cs b/ZigbeeApp/Shared/Phone/Common/Logic/HdlTemplateDataFormLogic.cs old mode 100755 new mode 100644 similarity index 91% rename from ZigbeeApp/Shared/Phone/TemplateData/TemplateDataFormLogic.cs rename to ZigbeeApp/Shared/Phone/Common/Logic/HdlTemplateDataFormLogic.cs index f1191b1..08286b5 --- a/ZigbeeApp/Shared/Phone/TemplateData/TemplateDataFormLogic.cs +++ b/ZigbeeApp/Shared/Phone/Common/Logic/HdlTemplateDataFormLogic.cs @@ -1,130 +1,130 @@ -锘縰sing Shared.Phone.UserCenter; -using System; -using System.Collections.Generic; -using System.Text; - -namespace Shared.Phone.TemplateData -{ - /// <summary> - /// 妯℃澘鏁版嵁鐨勭晫闈㈤�昏緫 - /// </summary> - public class TemplateDataFormLogic - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 妯℃澘鏁版嵁鐨勭晫闈㈤�昏緫 - /// </summary> - private static TemplateDataFormLogic m_Current = null; - /// <summary> - /// 妯℃澘鏁版嵁鐨勭晫闈㈤�昏緫 - /// </summary> - public static TemplateDataFormLogic Current - { - get - { - if (m_Current == null) - { - m_Current = new TemplateDataFormLogic(); - } - return m_Current; - } - } - - #endregion - - #region 鈻� 鏄剧ず妯℃澘閫夋嫨鑿滃崟___________________ - - /// <summary> - /// 鏄剧ず搴曢儴妯℃澘閫夋嫨鑿滃崟 - /// </summary> - /// <param name="nowSelectFile">褰撳墠閫夋嫨鐨勬ā鏉跨殑鏂囦欢鍚嶅瓧</param> - /// <param name="finishEvent">缁撴潫閫夋嫨鐨勪簨浠�,绗竴涓弬鏁版槸閫夋嫨鐨勬ā鏉跨殑鍚嶅瓧,绗簩涓弬鏁版槸閫夋嫨鐨勬ā鏉跨殑鏂囦欢鍚嶅瓧</param> - public void ShowBottomSelectTemplateForm(string nowSelectFile, Action<string, string> finishEvent) - { - //2020.09.15 涓嶅啀鑾峰彇浜戠妯℃澘 - - //鑾峰彇鏈湴鐨勬ā鏉� - var listLocal = TemplateCommonLogic.Current.GetLocalAllModelList(); - //鑾峰彇浜戠鐨勬ā鏉� - //var listClound = TemplateCommonLogic.Current.GetCloundAllModelList(); - //if (listLocal.Count == 0 && listClound.Count == 0) - if (listLocal.Count == 0) - { - //妫�娴嬩笉鍒板彲渚涢�夋嫨鐨勬ā鏉挎暟鎹� - HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NotHadTemplateDataToSelect)); - return; - } - var listEsixtName = new HashSet<string>(); - - var listText1 = new List<string>(); - var listText2 = new List<string>(); - int defultIndex = -1; - for (int i = 0; i < listLocal.Count; i++) - { - //ModelData_Local_yyyyMMdd_HHmmss.bin - string[] strArry = listLocal[i].FileName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); - if (strArry.Length != 4) { continue; } - - listText1.Add(listLocal[i].ModelName); - - string strTime = strArry[2].Substring(0, 4) + "."; - strTime += strArry[2].Substring(4, 2) + "."; - strTime += strArry[2].Substring(6, 2) + " "; - strTime += strArry[3].Substring(0, 2) + ":"; - strTime += strArry[3].Substring(2, 2); - - listText2.Add(strTime); - if (nowSelectFile == listLocal[i].FileName) - { - defultIndex = i; - } - //宸茬粡瀛樺湪浜嗙殑妯℃澘鍚嶅瓧 - listEsixtName.Add(listLocal[i].ModelName); - } - //for (int i = 0; i < listClound.Count; i++) - //{ - // //濡傛灉鏈湴宸茬粡瀛樺湪浜嗚繖涓ā鏉�,鍒欏凡鏈湴鐨勪负鍑� - // if (listEsixtName.Contains(listClound[i].TemplateName) == true) - // { - // continue; - // } - // listText1.Add(listClound[i].TemplateName); - // listText2.Add(listClound[i].CreatedOnUtc); - //} - - var selectForm = new BottomItemSelectForm(); - selectForm.SelectRowCanCancel = false; - selectForm.AddForm(Language.StringByID(R.MyInternationalizationString.SelectTemplate), listText1, listText2, defultIndex); - selectForm.FinishSelectEvent += (select) => - { - //宸查�夋ā鐗堬細鍗楁矙閲戣寕搴淿鎴峰瀷A - //if (select >= listLocal.Count) - //{ - // //濡傛灉閫夋嫨鐨勬槸浜戠妯℃澘鐨勮瘽 - // int index = select - listLocal.Count; - // //闇�瑕佸幓涓嬭浇杩欎釜妯℃澘 - // TemplateCommonLogic.Current.DownLoadTemplate(listClound[index].Id, (fullName) => - // { - // if (fullName != null) - // { - // string fileName = fullName.Substring(DirNameResourse.AllResidenceTemplateDirectory.Length + 1); - // //璋冪敤鍥炶皟鍑芥暟 - // HdlThreadLogic.Current.RunMain(() => - // { - // finishEvent?.Invoke(listText1[select], fileName); - // }); - // } - // }); - //} - //else - { - //璋冪敤鍥炶皟鍑芥暟 - finishEvent?.Invoke(listText1[select], listLocal[select].FileName); - } - }; - } - - #endregion - } -} +锘縰sing Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone +{ + /// <summary> + /// 妯℃澘鏁版嵁鐨勭晫闈㈤�昏緫 + /// </summary> + public class HdlTemplateDataFormLogic + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 妯℃澘鏁版嵁鐨勭晫闈㈤�昏緫 + /// </summary> + private static HdlTemplateDataFormLogic m_Current = null; + /// <summary> + /// 妯℃澘鏁版嵁鐨勭晫闈㈤�昏緫 + /// </summary> + public static HdlTemplateDataFormLogic Current + { + get + { + if (m_Current == null) + { + m_Current = new HdlTemplateDataFormLogic(); + } + return m_Current; + } + } + + #endregion + + #region 鈻� 鏄剧ず妯℃澘閫夋嫨鑿滃崟___________________ + + /// <summary> + /// 鏄剧ず搴曢儴妯℃澘閫夋嫨鑿滃崟 + /// </summary> + /// <param name="nowSelectFile">褰撳墠閫夋嫨鐨勬ā鏉跨殑鏂囦欢鍚嶅瓧</param> + /// <param name="finishEvent">缁撴潫閫夋嫨鐨勪簨浠�,绗竴涓弬鏁版槸閫夋嫨鐨勬ā鏉跨殑鍚嶅瓧,绗簩涓弬鏁版槸閫夋嫨鐨勬ā鏉跨殑鏂囦欢鍚嶅瓧</param> + public void ShowBottomSelectTemplateForm(string nowSelectFile, Action<string, string> finishEvent) + { + //2020.09.15 涓嶅啀鑾峰彇浜戠妯℃澘 + + //鑾峰彇鏈湴鐨勬ā鏉� + var listLocal = HdlTemplateCommonLogic.Current.GetLocalAllModelList(); + //鑾峰彇浜戠鐨勬ā鏉� + //var listClound = TemplateCommonLogic.Current.GetCloundAllModelList(); + //if (listLocal.Count == 0 && listClound.Count == 0) + if (listLocal.Count == 0) + { + //妫�娴嬩笉鍒板彲渚涢�夋嫨鐨勬ā鏉挎暟鎹� + HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NotHadTemplateDataToSelect)); + return; + } + var listEsixtName = new HashSet<string>(); + + var listText1 = new List<string>(); + var listText2 = new List<string>(); + int defultIndex = -1; + for (int i = 0; i < listLocal.Count; i++) + { + //ModelData_Local_yyyyMMdd_HHmmss.bin + string[] strArry = listLocal[i].FileName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); + if (strArry.Length != 4) { continue; } + + listText1.Add(listLocal[i].ModelName); + + string strTime = strArry[2].Substring(0, 4) + "."; + strTime += strArry[2].Substring(4, 2) + "."; + strTime += strArry[2].Substring(6, 2) + " "; + strTime += strArry[3].Substring(0, 2) + ":"; + strTime += strArry[3].Substring(2, 2); + + listText2.Add(strTime); + if (nowSelectFile == listLocal[i].FileName) + { + defultIndex = i; + } + //宸茬粡瀛樺湪浜嗙殑妯℃澘鍚嶅瓧 + listEsixtName.Add(listLocal[i].ModelName); + } + //for (int i = 0; i < listClound.Count; i++) + //{ + // //濡傛灉鏈湴宸茬粡瀛樺湪浜嗚繖涓ā鏉�,鍒欏凡鏈湴鐨勪负鍑� + // if (listEsixtName.Contains(listClound[i].TemplateName) == true) + // { + // continue; + // } + // listText1.Add(listClound[i].TemplateName); + // listText2.Add(listClound[i].CreatedOnUtc); + //} + + var selectForm = new BottomItemSelectForm(); + selectForm.SelectRowCanCancel = false; + selectForm.AddForm(Language.StringByID(R.MyInternationalizationString.SelectTemplate), listText1, listText2, defultIndex); + selectForm.FinishSelectEvent += (select) => + { + //宸查�夋ā鐗堬細鍗楁矙閲戣寕搴淿鎴峰瀷A + //if (select >= listLocal.Count) + //{ + // //濡傛灉閫夋嫨鐨勬槸浜戠妯℃澘鐨勮瘽 + // int index = select - listLocal.Count; + // //闇�瑕佸幓涓嬭浇杩欎釜妯℃澘 + // TemplateCommonLogic.Current.DownLoadTemplate(listClound[index].Id, (fullName) => + // { + // if (fullName != null) + // { + // string fileName = fullName.Substring(HdlFileNameResourse.AllResidenceTemplateDirectory.Length + 1); + // //璋冪敤鍥炶皟鍑芥暟 + // HdlThreadLogic.Current.RunMain(() => + // { + // finishEvent?.Invoke(listText1[select], fileName); + // }); + // } + // }); + //} + //else + { + //璋冪敤鍥炶皟鍑芥暟 + finishEvent?.Invoke(listText1[select], listLocal[select].FileName); + } + }; + } + + #endregion + } +} -- Gitblit v1.8.0