namespace HStation.WinFrmUI
|
{
|
public partial class GenerateXhsProjectWizardPage : DevExpress.XtraEditors.XtraUserControl, IWizardPage<ImportXhsProjectViewModel>
|
{
|
public GenerateXhsProjectWizardPage()
|
{
|
InitializeComponent();
|
this.layoutControl1.SetupLayoutControl();
|
}
|
|
/// <summary>
|
/// 状态改变事件
|
/// </summary>
|
public event Action PageStateChangedEvent;
|
private bool _isInitialize = false;//是否初始化
|
private bool _importResult = false;//导入结果
|
private ImportXhsProjectViewModel _vm = null;//操作对象
|
|
|
/// <summary>
|
///
|
/// </summary>
|
public async void InitialPage(ImportXhsProjectViewModel vm)
|
{
|
_vm = vm;
|
_isInitialize = false;
|
_importResult = false;
|
_importResult = await ImportXhsProjectHelper.Import(vm, (msg) =>
|
{
|
this.listBoxControl1.Items.Add(msg);
|
}, (max, current) =>
|
{
|
this.progressBarControl1.Properties.Maximum = max;
|
this.progressBarControl1.Position = current;
|
//替代方案
|
// this.progressBarControl1.Properties.Step = current;
|
// this.progressBarControl1.PerformStep();
|
});
|
_isInitialize = true;
|
this.PageStateChangedEvent?.Invoke();
|
}
|
|
/// <summary>
|
/// 允许上一步
|
/// </summary>
|
public bool AllowPrev
|
{
|
get
|
{
|
if (_isInitialize)
|
{
|
if (!_importResult)
|
{
|
return true;
|
}
|
}
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// 允许下一步
|
/// </summary>
|
public bool AllowNext
|
{
|
get
|
{
|
if (_isInitialize)
|
{
|
if (_importResult)
|
{
|
return true;
|
}
|
}
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// 允许取消
|
/// </summary>
|
public bool AllowCancel
|
{
|
get
|
{
|
if (_isInitialize)
|
{
|
if (!_importResult)
|
{
|
return true;
|
}
|
}
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// 允许完成
|
/// </summary>
|
public bool AllowComplete
|
{
|
get { return false; }
|
}
|
|
/// <summary>
|
/// 能否上一步
|
/// </summary>
|
/// <returns></returns>
|
public bool CanPrev()
|
{
|
return this.AllowPrev;
|
}
|
|
/// <summary>
|
/// 能否下一步
|
/// </summary>
|
public bool CanNext()
|
{
|
return this.AllowNext;
|
}
|
|
/// <summary>
|
/// 能否取消
|
/// </summary>
|
public bool CanCancel()
|
{
|
return this.AllowCancel;
|
}
|
|
/// <summary>
|
/// 能否完成
|
/// </summary>
|
public bool CanComplete()
|
{
|
return false;
|
}
|
|
|
|
|
|
|
}
|
}
|