duheng
2024-08-26 c17dd77e798b3b94da8ee93ba3577d0bd540a125
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>
    {
@@ -28,13 +30,13 @@
            {
                AllowNext = false;
                AllowComplete = true;
                PageStateChangedEvent.Invoke();
            }
            else
            {
                AllowNext = true;
                AllowComplete = false;
            }
            PageStateChangedEvent.Invoke();
        }
        /// <summary>
@@ -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();
@@ -136,6 +139,7 @@
            var projectId = await bllXhsProjectExtensions.Insert(project);
            if (projectId > 1)
            {
                _vm.ProjectID = projectId;
                if (_vm.Location != null)
                {
                    var mapInfo = new Yw.Vmo.Map.MapInfo();
@@ -149,38 +153,15 @@
                    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.ShowError("导入错误!");
                            }));
                        }
                        else
                        {
                            // 直接更新UI控件
                            MessageBoxHelper.ShowError("导入错误!");
                        }
                        return true;
                    }
                }
            }
            return true;
        }
        //地图加载完成