using DevExpress.XtraLayout.Utils;
|
|
namespace HStation.WinFrmUI.Xhs
|
{
|
public partial class ChoicePumpMainDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public ChoicePumpMainDlg()
|
{
|
InitializeComponent();
|
}
|
|
private readonly PumpMainChoiceViewModel _vm = new();
|
|
private PumpMainChoiceManager _wizard;
|
|
public void SetBindingData()
|
{
|
_wizard = new PumpMainChoiceManager(_vm);
|
_wizard.SelectedPageChangedEvent += _wizard_SelectedPageChangedEvent;
|
_wizard.SelectedPageStateChangedEvent += _wizard_SelectedPageStateChangedEvent; ;
|
_wizard.InitialManager(new IWizardPage<PumpMainChoiceViewModel>[] {
|
this.pumpMainChoicePage,
|
this.valveChoicePage1
|
});
|
}
|
|
//选择页面改变
|
private void _wizard_SelectedPageChangedEvent(IWizardPage<PumpMainChoiceViewModel> page, int index)
|
{
|
this.navigationFrame1.SelectedPageIndex = index;
|
this.stepProgressBar1.SelectedItemIndex = index;
|
}
|
|
//选择页面状态改变
|
private void _wizard_SelectedPageStateChangedEvent(IWizardPage<PumpMainChoiceViewModel> 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();
|
}
|
}
|
}
|
}
|
}
|