duheng
2024-08-23 5d25f26f883f547aff8a8246c1127d63d851dafe
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/03-MapLocation/SetXhsProjectMapLocationWizardPage.cs
@@ -1,4 +1,6 @@
namespace HStation.WinFrmUI
using NPOI.HSSF.Record;
namespace HStation.WinFrmUI
{
    public partial class SetXhsProjectMapLocationWizardPage : DevExpress.XtraEditors.XtraUserControl, Yw.WinFrmUI.IWizardPage<ImportXhsProjectViewModel>
    {
@@ -112,11 +114,12 @@
        /// </summary>
        public bool CanComplete()
        {
            Task.Run(() => InsertProject());
            Task<bool> task = Task.Run(async () => await InsertProject());
            var bol = task.GetAwaiter();
            return true;
        }
        private async void InsertProject()
        private async Task<bool> InsertProject()
        {
            var bllXhsProjectExtensions = new BLL.XhsProjectExtensions();
            var project = new Vmo.Xhs.XhsProjectExtensions();
@@ -149,38 +152,16 @@
                    var mapInfoId = await new Yw.BLL.MapInfo().Insert(mapInfo);
                    if (mapInfoId < 1)
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke(new Action(() =>
                            {
                                // 更新UI控件
                                MessageBoxHelper.ShowError("导入错误!");
                            }));
                        }
                        else
                        {
                            // 直接更新UI控件
                            MessageBoxHelper.ShowError("导入错误!");
                        }
                        return false;
                    }
                    else
                    {
                        if (this.InvokeRequired)
                        {
                            this.Invoke(new Action(() =>
                            {
                                // 更新UI控件
                                MessageBoxHelper.ShowSuccess("导入成功!");
                            }));
                        }
                        else
                        {
                            // 直接更新UI控件
                            MessageBoxHelper.ShowSuccess("导入成功!");
                        }
                        _vm.ProjectID = projectId;
                        return true;
                    }
                }
            }
            return true;
        }
        //地图加载完成