| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraLayout.Utils; |
| | | using HStation.WinFrmUI.Xhs.Core.Properties; |
| | | 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 |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | private void CustomerStepItem(string caption) |
| | | private readonly CreateXhsSchemeViewModel _vm = new(); |
| | | private CreateXhsSchemeManager _wizard; |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public CreateXhsSchemeViewModel ViewModel |
| | | { |
| | | var item = new StepProgressBarItem(); |
| | | item.ContentBlock2.Caption = caption; |
| | | item.Options.Indicator.ActiveStateDrawMode = IndicatorDrawMode.Full; |
| | | //item.Options.Indicator.ActiveStateImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("stepPbSelectModelFile.Options.Indicator.ActiveStateImageOptions.SvgImage"); |
| | | //item.Options.Indicator.InactiveStateImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("stepPbSelectModelFile.Options.Indicator.InactiveStateImageOptions.SvgImage"); |
| | | item.State = StepProgressBarItemState.Active; |
| | | get { return _vm; } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public async void SetBindingData |
| | | ( |
| | | HStation.Vmo.XhsProjectVmo project, |
| | | HStation.Vmo.XhsProjectSiteVmo project_site, |
| | | Yw.Model.HydroModelInfo hydro_info |
| | | ) |
| | | { |
| | | if (project == null) |
| | | { |
| | | return; |
| | | } |
| | | _vm.Project = project; |
| | | _vm.ProjectSite = project_site; |
| | | _vm.HydroInfo = hydro_info; |
| | | _vm.ProjectSite ??= await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_vm.Project.ID); |
| | | if (_vm.HydroInfo == null) |
| | | { |
| | | var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _vm.ProjectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | _vm.HydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); |
| | | } |
| | | _vm.AllSchemeList = await BLLFactory < HStation.BLL.XhsScheme>.Instance.GetBySiteID(_vm.ProjectSite.ID); |
| | | |
| | | _wizard = new CreateXhsSchemeManager(_vm); |
| | | _wizard.SelectedPageChangedEvent += _wizard_SelectedPageChangedEvent; |
| | | _wizard.SelectedPageStateChangedEvent += _wizard_SelectedPageStateChangedEvent; ; |
| | | _wizard.InitialManager(new IWizardPage<CreateXhsSchemeViewModel>[] { |
| | | this.createXhsSchemeInfoPage1, |
| | | this.createXhsSchemePumpChangePage1, |
| | | }); |
| | | |
| | | this.createXhsSchemeInfoPage1.ChangeTypeChangedEvent += CreateXhsSchemeInfoPage1_ChangeTypeChangedEvent; |
| | | |
| | | } |
| | | |
| | | |
| | | //变更类型变换 |
| | | private void CreateXhsSchemeInfoPage1_ChangeTypeChangedEvent(List<string> change_type_list) |
| | | { |
| | | for (int i = this.stepProgressBar1.Items.Count; i > 0; i--) |
| | | { |
| | | if (this.stepProgressBar1.Items.Count < 2) |
| | | break; |
| | | this.stepProgressBar1.Items.RemoveAt(1); |
| | | } |
| | | if (change_type_list == null || !change_type_list.Any()) |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | foreach (var change_type in change_type_list) |
| | | { |
| | | var name = HydroParterCatalogHelper.GetName(change_type); |
| | | Add(name); |
| | | } |
| | | Add("变更记录"); |
| | | } |
| | | // |
| | | |
| | | } |
| | | |
| | | private void Add(string caption) |
| | | { |
| | | var step_pb_item = new StepProgressBarItem(); |
| | | step_pb_item.ContentBlock2.Caption = caption; |
| | | //step_pb_item.Name = "stepPbBasicInfo"; |
| | | step_pb_item.Options.Indicator.ActiveStateDrawMode = IndicatorDrawMode.Full; |
| | | step_pb_item.Options.Indicator.ActiveStateImageOptions.SvgImage = null; |
| | | step_pb_item.Options.Indicator.InactiveStateImageOptions.SvgImage = null; |
| | | step_pb_item.State = StepProgressBarItemState.Inactive; |
| | | this.stepProgressBar1.Items.Add(step_pb_item); |
| | | } |
| | | |
| | | |
| | | //选择页面改变 |
| | | private void _wizard_SelectedPageChangedEvent(IWizardPage<CreateXhsSchemeViewModel> 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<CreateXhsSchemeViewModel> 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 btnPrev_Click(object sender, EventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | _wizard.Prev(); |
| | | } |
| | | } |
| | | |
| | | //下一步 |
| | | private void btnNext_Click(object sender, EventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | _wizard.Next(); |
| | | } |
| | | } |
| | | |
| | | //取消 |
| | | private void btnCancel_Click(object sender, EventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | var bol = _wizard.Cancel(); |
| | | if (bol) |
| | | { |
| | | this.DialogResult = DialogResult.Cancel; |
| | | this.Close(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //完成 |
| | | private void btnComplete_Click(object sender, EventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | var bol = _wizard.Complete(); |
| | | if (bol) |
| | | { |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //正在关闭 |
| | | private void CreateXhsSchemeDlg_FormClosing(object sender, FormClosingEventArgs e) |
| | | { |
| | | if (_wizard != null) |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |