| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraLayout.Utils; |
| | | using HStation.WinFrmUI.Xhs; |
| | | using HStation.WinFrmUI.Xhs.Core.Properties; |
| | | using DevExpress.XtraLayout.Utils; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | public ImportXhsProjectDlg() |
| | | { |
| | | InitializeComponent(); |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | | } |
| | | |
| | | private readonly ImportXhsProjectViewModel _vm = new(); |
| | | private ImportXhsProjectManager _wizard; |
| | | |
| | | private static bool IsAddItem = true; |
| | | private ImportXhsProjectViewModel _vm = null;//操作对象 |
| | | private ImportXhsProjectManager _wizard;//步骤 |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData() |
| | | { |
| | | _vm = new ImportXhsProjectViewModel(); |
| | | _wizard = new ImportXhsProjectManager(_vm); |
| | | _wizard.SelectedPageChangedEvent += _wizard_SelectedPageChangedEvent; |
| | | _wizard.SelectedPageStateChangedEvent += _wizard_SelectedPageStateChangedEvent; ; |
| | | InputXhsProjectInfoWizardPage.AutoAddItem += AutoAddItem; |
| | | InputXhsProjectInfoWizardPage.DeleteItem += DeleteItem; |
| | | _wizard.InitialManager(new IWizardPage<ImportXhsProjectViewModel>[] { |
| | | _wizard.InitialManager(new IWizardPageAsync<ImportXhsProjectViewModel>[] { |
| | | this.inputXhsProjectInfoWizardPage, |
| | | this.setXhsProjectMapLocationWizardPage, |
| | | this.generateXhsProjectWizardPage, |
| | | this.importXhsProjectCompletedCtrl1 |
| | | this.projectResultShowPanel1 |
| | | }); |
| | | } |
| | | |
| | | //增加导航条item |
| | | private void AutoAddItem() |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData(XhsProjectExtensionsVmo project, Yw.Vmo.MapInfoVmo mapInfo) |
| | | { |
| | | 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); |
| | | } |
| | | } |
| | | _vm = new ImportXhsProjectViewModel(project, mapInfo); |
| | | _wizard = new ImportXhsProjectManager(_vm); |
| | | _wizard.SelectedPageChangedEvent += _wizard_SelectedPageChangedEvent; |
| | | _wizard.SelectedPageStateChangedEvent += _wizard_SelectedPageStateChangedEvent; ; |
| | | _wizard.InitialManager(new IWizardPageAsync<ImportXhsProjectViewModel>[] { |
| | | this.inputXhsProjectInfoWizardPage, |
| | | this.setXhsProjectMapLocationWizardPage, |
| | | this.generateXhsProjectWizardPage, |
| | | this.projectResultShowPanel1 |
| | | }); |
| | | } |
| | | |
| | | //选择页面改变 |
| | | private void _wizard_SelectedPageChangedEvent(IWizardPage<ImportXhsProjectViewModel> page, int index) |
| | | private void _wizard_SelectedPageChangedEvent(IWizardPageAsync<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; |
| | | |
| | | this.navigationFrame1.SelectedPageIndex = index; |
| | | this.stepProgressBar1.SelectedItemIndex = index; |
| | | } |
| | | |
| | | //选择页面状态改变 |
| | | private void _wizard_SelectedPageStateChangedEvent(IWizardPage<ImportXhsProjectViewModel> page, int index) |
| | | private void _wizard_SelectedPageStateChangedEvent(IWizardPageAsync<ImportXhsProjectViewModel> page, int index) |
| | | { |
| | | this.itemForPrev.Visibility = page.AllowPrev ? LayoutVisibility.Always : LayoutVisibility.Never; |
| | | this.itemForNext.Visibility = page.AllowNext ? LayoutVisibility.Always : LayoutVisibility.Never; |
| | |
| | | } |
| | | |
| | | //上一步 |
| | | private void btnPrev_Click(object sender, EventArgs e) |
| | | private async void btnPrev_Click(object sender, EventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | _wizard.Prev(); |
| | | await _wizard.Prev(); |
| | | } |
| | | } |
| | | |
| | | //下一步 |
| | | private void btnNext_Click(object sender, EventArgs e) |
| | | private async void btnNext_Click(object sender, EventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | _wizard.Next(); |
| | | await _wizard.Next(); |
| | | } |
| | | } |
| | | |
| | | //取消 |
| | | private void btnCancel_Click(object sender, EventArgs e) |
| | | private async void btnCancel_Click(object sender, EventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | var bol = _wizard.Cancel(); |
| | | var bol = await _wizard.Cancel(); |
| | | if (bol) |
| | | { |
| | | this.DialogResult = DialogResult.Cancel; |
| | |
| | | } |
| | | |
| | | //完成 |
| | | private void btnComplete_Click(object sender, EventArgs e) |
| | | private async void btnComplete_Click(object sender, EventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | var bol = _wizard.Complete(); |
| | | var bol = await _wizard.Complete(); |
| | | if (bol) |
| | | { |
| | | this.DialogResult = DialogResult.OK; |
| | |
| | | } |
| | | |
| | | //正在关闭 |
| | | private void ImportXhsProjectDlg_FormClosing(object sender, FormClosingEventArgs e) |
| | | private async void ImportXhsProjectDlg_FormClosing(object sender, FormClosingEventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | |
| | | } |
| | | else if (this.DialogResult == DialogResult.Cancel) |
| | | { |
| | | if (!_wizard.Cancel()) |
| | | if (!await _wizard.Cancel()) |
| | | { |
| | | e.Cancel = true; |
| | | } |