From 502ed6f01f605098d46a1fe9f55f416d5c5c3e13 Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期四, 26 九月 2024 17:33:12 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/01-import/04-GeneralProject/GenerateXhsProjectWizardPage.cs | 184 ++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 152 insertions(+), 32 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 a241bb1..28ee611 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,58 +1,178 @@ -锘縰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(); - - public bool AllowNext => throw new NotImplementedException(); - - public bool AllowCancel => throw new NotImplementedException(); - - public bool AllowComplete => throw new NotImplementedException(); - - public bool IsInitialize => throw new NotImplementedException(); - + /// <summary> + /// 鐘舵�佹敼鍙樹簨浠� + /// </summary> public event Action PageStateChangedEvent; - public bool CanCancel() + private bool _isInitialize = false;//鏄惁鍒濆鍖� + private bool _importResult = false;//瀵煎叆缁撴灉 + private ImportXhsProjectViewModel _vm = null;//鎿嶄綔瀵硅薄 + + private class ListItemWithColor { - throw new NotImplementedException(); + public string Text { get; set; } + public Color Color { get; set; } + + public override string ToString() + { + return null; + } } - public bool CanComplete() + /// <summary> + /// + /// </summary> + public async void InitialPage(ImportXhsProjectViewModel vm) { - throw new NotImplementedException(); + _vm = vm; + _isInitialize = false; + _importResult = false; + _importResult = await ImportXhsProjectHelper.Import(vm, (msg, color) => + { + ListItemWithColor itemWithColor = new ListItemWithColor + { + Text = msg, + Color = color + }; + this.listBoxControl1.Items.Add(itemWithColor); + }, (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 CanNext() + /// <summary> + /// 鍏佽涓婁竴姝� + /// </summary> + public bool AllowPrev { - throw new NotImplementedException(); + get + { + if (_isInitialize) + { + if (!_importResult) + { + return true; + } + } + return false; + } } + /// <summary> + /// 鍏佽涓嬩竴姝� + /// </summary> + public bool AllowNext + { + 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; + } + + private void listBoxControl1_DrawItem(object sender, DevExpress.XtraEditors.ListBoxDrawItemEventArgs e) + { + // 鑾峰彇褰撳墠椤圭洰鐨勭储寮� + int index = e.Index; + + // 妫�鏌ユ槸鍚︽槸鏈夋晥鐨勯」鐩储寮� + if (index >= 0) + { + // 鑾峰彇褰撳墠椤圭洰 + ListItemWithColor item = (ListItemWithColor)listBoxControl1.Items[index]; + + // 璁剧疆瀛椾綋鍜岄鑹� + Font font = new Font("Arial", 15); + Brush brush = new SolidBrush(item.Color); + // 缁樺埗鏂囨湰 + e.Graphics.DrawString(item.Text, font, brush, e.Bounds); + } } } -} +} \ No newline at end of file -- Gitblit v1.9.3