From e2f996ecf706e0870744ae25886b8443c1a59132 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期三, 14 八月 2024 17:17:41 +0800 Subject: [PATCH] 修改导入逻辑 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/04-GeneralProject/GenerateXhsProjectWizardPage.cs | 147 +++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 117 insertions(+), 30 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/04-GeneralProject/GenerateXhsProjectWizardPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/04-GeneralProject/GenerateXhsProjectWizardPage.cs index df7cfe9..8f0d40a 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/04-GeneralProject/GenerateXhsProjectWizardPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/04-GeneralProject/GenerateXhsProjectWizardPage.cs @@ -1,56 +1,143 @@ -锘縰sing DevExpress.XtraEditors; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace HStation.WinFrmUI +锘縩amespace HStation.WinFrmUI { public partial class GenerateXhsProjectWizardPage : DevExpress.XtraEditors.XtraUserControl, IWizardPage<ImportXhsProjectViewModel> { public GenerateXhsProjectWizardPage() { InitializeComponent(); + this.layoutControl1.SetupLayoutControl(); } - public bool AllowPrev => throw new NotImplementedException(); + /// <summary> + /// 鐘舵�佹敼鍙樹簨浠� + /// </summary> + public event Action PageStateChangedEvent; - public bool AllowNext => throw new NotImplementedException(); + private bool _isInitialize = false;//鏄惁鍒濆鍖� + private bool _importResult = false;//瀵煎叆缁撴灉 + private ImportXhsProjectViewModel _vm = null;//鎿嶄綔瀵硅薄 - public bool AllowCancel => throw new NotImplementedException(); - - public bool AllowComplete => throw new NotImplementedException(); - - public bool IsInitialize => throw new NotImplementedException(); - - public bool CanCancel() + /// <summary> + /// + /// </summary> + public async void InitialPage(ImportXhsProjectViewModel vm) { - throw new NotImplementedException(); + _vm = vm; + _isInitialize = false; + _importResult = false; + _importResult = await ImportXhsProjectHelper.Import(vm, (msg) => + { + this.listBoxControl1.Items.Add(msg); + }, (max, current) => + { + this.progressBarControl1.Properties.Maximum = max; + this.progressBarControl1.Position = current; + //鏇夸唬鏂规 + // this.progressBarControl1.Properties.Step = current; + // this.progressBarControl1.PerformStep(); + }); + if (!_importResult) + { + this.progressBarControl1.Position = 0; + this.itemForProgress.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; + } + _isInitialize = true; + this.PageStateChangedEvent?.Invoke(); } - public bool CanComplete() + /// <summary> + /// 鍏佽涓婁竴姝� + /// </summary> + public bool AllowPrev { - throw new NotImplementedException(); + get + { + if (_isInitialize) + { + if (!_importResult) + { + return true; + } + } + return false; + } } - public bool CanNext() + /// <summary> + /// 鍏佽涓嬩竴姝� + /// </summary> + public bool AllowNext { - throw new NotImplementedException(); + get + { + if (_isInitialize) + { + if (_importResult) + { + return true; + } + } + return false; + } } + /// <summary> + /// 鍏佽鍙栨秷 + /// </summary> + public bool AllowCancel + { + get + { + if (_isInitialize) + { + if (!_importResult) + { + return true; + } + } + return false; + } + } + + /// <summary> + /// 鍏佽瀹屾垚 + /// </summary> + public bool AllowComplete + { + get { return false; } + } + + /// <summary> + /// 鑳藉惁涓婁竴姝� + /// </summary> + /// <returns></returns> public bool CanPrev() { - throw new NotImplementedException(); + return this.AllowPrev; } - public void InitialPage(ImportXhsProjectViewModel t) + /// <summary> + /// 鑳藉惁涓嬩竴姝� + /// </summary> + public bool CanNext() { - throw new NotImplementedException(); + return this.AllowNext; + } + + /// <summary> + /// 鑳藉惁鍙栨秷 + /// </summary> + public bool CanCancel() + { + return this.AllowCancel; + } + + /// <summary> + /// 鑳藉惁瀹屾垚 + /// </summary> + public bool CanComplete() + { + return false; } } -} +} \ No newline at end of file -- Gitblit v1.9.3