| | |
| | | using DevExpress.XtraLayout.Utils; |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraLayout.Utils; |
| | | using HStation.WinFrmUI.Xhs; |
| | | using HStation.WinFrmUI.Xhs.Core.Properties; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | private readonly ImportXhsProjectViewModel _vm = new(); |
| | | private ImportXhsProjectManager _wizard; |
| | | |
| | | private static bool IsAddItem = true; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// |
| | | /// </summary> |
| | | public ImportXhsProjectViewModel ViewModel |
| | | { |
| | | get { return _vm; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public void SetBindingData() |
| | | { |
| | | _wizard = new ImportXhsProjectManager(); |
| | | _wizard = new ImportXhsProjectManager(_vm); |
| | | _wizard.SelectedPageChangedEvent += _wizard_SelectedPageChangedEvent; |
| | | _wizard.SelectedPageStateChangedEvent += _wizard_SelectedPageStateChangedEvent; ; |
| | | // InputXhsProjectInfoWizardPage.AutoAddItem += AutoAddItem; |
| | | // InputXhsProjectInfoWizardPage.DeleteItem += DeleteItem; |
| | | _wizard.InitialManager(new IWizardPage<ImportXhsProjectViewModel>[] { |
| | | this.selectXhsProjectModelFileWizardPage, |
| | | this.inputXhsProjectInfoWizardPage, |
| | | this.setXhsProjectMapLocationWizardPage, |
| | | this.generateXhsProjectWizardPage, |
| | | this.importXhsProjectCompletedWizardPage |
| | | this.importXhsProjectCompletedCtrl1 |
| | | }); |
| | | AutoAddItem(); |
| | | } |
| | | |
| | | //增加导航条item |
| | | private void AutoAddItem() |
| | | { |
| | | if (stepProgressBar1.Items.Count >= 5) |
| | | { |
| | | for (int i = 0; i < 3; i++) |
| | | { |
| | | stepProgressBar1.Items.RemoveAt(2); |
| | | } |
| | | } |
| | | StepProgressBarItem stepPbInputProjectInfo = new StepProgressBarItem(); |
| | | stepPbInputProjectInfo.ContentBlock1.ActiveStateImageOptions.SvgImage = DevExpress.Images.ImageResourceCache.Default.GetSvgImageById("productquickshippments"); |
| | | stepPbInputProjectInfo.ContentBlock1.InactiveStateImageOptions.SvgImage = DevExpress.Images.ImageResourceCache.Default.GetSvgImageById("productquickshippments"); |
| | | stepPbInputProjectInfo.ContentBlock2.Caption = "自动生成项目"; |
| | | /* StepProgressBarItem stepPbImportComleted = new StepProgressBarItem(); |
| | | stepPbImportComleted.ContentBlock2.Caption = "项目导入完成"; |
| | | stepPbImportComleted.ContentBlock1.ActiveStateImageOptions.SvgImage = DevExpress.Images.ImageResourceCache.Default.GetSvgImageById("check"); |
| | | stepPbImportComleted.ContentBlock1.InactiveStateImageOptions.SvgImage = DevExpress.Images.ImageResourceCache.Default.GetSvgImageById("check"); |
| | | */ |
| | | StepProgressBarItem stepGenerateProject = new StepProgressBarItem(); |
| | | stepGenerateProject.ContentBlock1.ActiveStateImageOptions.SvgImage = DevExpress.Images.ImageResourceCache.Default.GetSvgImageById("showallfieldresults"); |
| | | stepGenerateProject.ContentBlock1.InactiveStateImageOptions.SvgImage = DevExpress.Images.ImageResourceCache.Default.GetSvgImageById("showallfieldresults"); |
| | | stepGenerateProject.ContentBlock2.Caption = "项目展示结果"; |
| | | this.stepProgressBar1.Items.Add(stepPbInputProjectInfo); |
| | | this.stepProgressBar1.Items.Add(stepGenerateProject); |
| | | } |
| | | |
| | | //删除导航条item |
| | | private void DeleteItem() |
| | | { |
| | | if (stepProgressBar1.Items.Count >= 5) |
| | | { |
| | | for (int i = 0; i < 3; i++) |
| | | { |
| | | stepProgressBar1.Items.RemoveAt(2); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //选择页面改变 |
| | |
| | | this.itemForComplete.Visibility = page.AllowComplete ? LayoutVisibility.Always : LayoutVisibility.Never; |
| | | this.navigationFrame1.SelectedPageIndex = index; |
| | | this.stepProgressBar1.SelectedItemIndex = index; |
| | | } |
| | | |
| | | //选择页面状态改变 |
| | | private void _wizard_SelectedPageStateChangedEvent(IWizardPage<ImportXhsProjectViewModel> page, int index) |
| | | { |
| | | this.itemForPrev.Visibility = page.AllowPrev ? LayoutVisibility.Always : LayoutVisibility.Never; |
| | | this.itemForNext.Visibility = page.AllowNext ? LayoutVisibility.Always : LayoutVisibility.Never; |
| | | this.itemForCancel.Visibility = page.AllowCancel ? LayoutVisibility.Always : LayoutVisibility.Never; |
| | | this.itemForComplete.Visibility = page.AllowComplete ? LayoutVisibility.Always : LayoutVisibility.Never; |
| | | } |
| | | |
| | | //上一步 |
| | |
| | | } |
| | | } |
| | | |
| | | //正在关闭 |
| | | private void ImportXhsProjectDlg_FormClosing(object sender, FormClosingEventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | if (!_wizard.Cancel()) |
| | | if (this.DialogResult == DialogResult.OK) |
| | | { |
| | | /* if (!_wizard.Complete()) |
| | | { |
| | | e.Cancel = true; |
| | | }*/ |
| | | } |
| | | else if (this.DialogResult == DialogResult.Cancel) |
| | | { |
| | | if (!_wizard.Cancel()) |
| | | { |
| | | e.Cancel = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | e.Cancel = true; |
| | | } |