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 | 100 +++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 82 insertions(+), 18 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 325cb00..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 @@ -12,31 +12,52 @@ /// 鐘舵�佹敼鍙樹簨浠� /// </summary> public event Action PageStateChangedEvent; + private bool _isInitialize = false;//鏄惁鍒濆鍖� + private bool _importResult = false;//瀵煎叆缁撴灉 private ImportXhsProjectViewModel _vm = null;//鎿嶄綔瀵硅薄 + private class ListItemWithColor + { + public string Text { get; set; } + public Color Color { get; set; } + + public override string ToString() + { + return null; + } + } /// <summary> - /// + /// /// </summary> public async void InitialPage(ImportXhsProjectViewModel vm) { - if (_isInitialize) - { - return; - } _vm = vm; - _isInitialize = await ImportXhsProjectHelper.Import(vm, (msg) => + _isInitialize = false; + _importResult = false; + _importResult = await ImportXhsProjectHelper.Import(vm, (msg, color) => { - this.listBoxControl1.Items.Add(msg); + 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(); } @@ -45,7 +66,17 @@ /// </summary> public bool AllowPrev { - get { return false; } + get + { + if (_isInitialize) + { + if (!_importResult) + { + return true; + } + } + return false; + } } /// <summary> @@ -53,7 +84,17 @@ /// </summary> public bool AllowNext { - get { return _isInitialize; } + get + { + if (_isInitialize) + { + if (_importResult) + { + return true; + } + } + return false; + } } /// <summary> @@ -61,7 +102,17 @@ /// </summary> public bool AllowCancel { - get { return false; } + get + { + if (_isInitialize) + { + if (!_importResult) + { + return true; + } + } + return false; + } } /// <summary> @@ -78,7 +129,7 @@ /// <returns></returns> public bool CanPrev() { - return false; + return this.AllowPrev; } /// <summary> @@ -86,7 +137,7 @@ /// </summary> public bool CanNext() { - return _isInitialize; + return this.AllowNext; } /// <summary> @@ -94,7 +145,7 @@ /// </summary> public bool CanCancel() { - return false; + return this.AllowCancel; } /// <summary> @@ -105,10 +156,23 @@ 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