| | |
| | | /// <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)
|
| | | //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));
|
| | |
| | | //已经存在了的模板名字
|
| | | 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);
|
| | | }
|
| | | //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.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
|
| | | //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);
|