using DevExpress.XtraBars.Customization;
|
|
namespace HStation.WinFrmUI
|
{
|
public partial class InputXhsProjectInfoWizardPage : DevExpress.XtraEditors.XtraUserControl, Yw.WinFrmUI.IWizardPage<ImportXhsProjectViewModel>
|
{
|
public InputXhsProjectInfoWizardPage()
|
{
|
InitializeComponent();
|
}
|
|
/// <summary>
|
/// 页面状态改变事件
|
/// </summary>
|
public event Action PageStateChangedEvent;
|
|
private ImportXhsProjectViewModel _vm = null;//操作对象
|
private bool _isInitialize = false;//是否初始化
|
private Lazy<HStation.BLL.XhsProject> _bllProject = new(() => new HStation.BLL.XhsProject());//项目bll
|
private Lazy<Yw.BLL.SysFlagStd> _bllFlag = new(() => new Yw.BLL.SysFlagStd());//标签bll
|
public static Action AutoAddItem;
|
public static Action DeleteItem;
|
public static bool AllowImport = false;
|
|
/// <summary>
|
/// 初始化
|
/// </summary>
|
public async void InitialPage(ImportXhsProjectViewModel t)
|
{
|
if (_isInitialize)
|
{
|
return;
|
}
|
_vm = t;
|
_isInitialize = true;
|
var allFlagList = await _bllFlag.Value.GetFlagListBySysType(HStation.Xhs.DataType.XhsProject);
|
this.setFlagsEditCtrl1.SetBindingData(allFlagList, null);
|
}
|
|
/// <summary>
|
/// 允许上一步
|
/// </summary>
|
public bool AllowPrev
|
{
|
get
|
{
|
return false;
|
}
|
}
|
|
/// <summary>
|
/// 允许下一步
|
/// </summary>
|
public bool AllowNext
|
{
|
get
|
{
|
_vm.ZipFile = this.btnEditSelectModelFile.Text.Trim();
|
/* if (_vm.ZipFile != string.Empty)
|
{
|
AllowImport = true;
|
AutoAddItem.Invoke();
|
}
|
else
|
{
|
AllowImport = false;
|
DeleteItem.Invoke();
|
}*/
|
return _isInitialize;
|
}
|
}
|
|
/// <summary>
|
/// 允许取消
|
/// </summary>
|
public bool AllowCancel
|
{
|
get { return true; }
|
}
|
|
/// <summary>
|
/// 允许完成
|
/// </summary>
|
public bool AllowComplete
|
{
|
get { return false; }
|
}
|
|
/// <summary>
|
/// 能否上一步
|
/// </summary>
|
public bool CanPrev()
|
{
|
return true;
|
}
|
|
/// <summary>
|
/// 能否下一步
|
/// </summary>
|
public bool CanNext()
|
{
|
if (!_isInitialize)
|
{
|
return false;
|
}
|
this.dxErrorProvider1.ClearErrors();
|
if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
|
{
|
this.dxErrorProvider1.SetError(this.txtName, "必填项");
|
return false;
|
}
|
var tagName = this.txtTagNme.Text.Trim();
|
if (!string.IsNullOrEmpty(tagName))
|
{
|
if (_bllProject.Value.IsExistTagName(tagName).Result)
|
{
|
this.dxErrorProvider1.SetError(this.txtTagNme, "标记已存在");
|
return false;
|
}
|
}
|
_vm.Name = this.txtName.Text.Trim();
|
_vm.Customer = this.txtCustomer.Text.Trim();
|
// _vm.Address = this.txtAddress.Text.Trim();
|
_vm.Flags = null;
|
_vm.TagName = tagName;
|
_vm.Description = this.txtDescription.Text.Trim();
|
return true;
|
}
|
|
/// <summary>
|
/// 能否关闭
|
/// </summary>
|
public bool CanCancel()
|
{
|
return true;
|
}
|
|
/// <summary>
|
/// 能否完成
|
/// </summary>
|
public bool CanComplete()
|
{
|
return false;
|
}
|
|
private void btnEditSelectModelFile_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
{
|
var suffix = Settings.XhsParasHelper.Xhs.File.Suffix;
|
var dlg = new OpenFileDialog();
|
dlg.Filter = $"模型文件(*{suffix})|*{suffix}";
|
dlg.FilterIndex = 1;
|
if (dlg.ShowDialog() == DialogResult.OK)
|
{
|
var fileName = dlg.FileName;
|
this.btnEditSelectModelFile.EditValue = fileName;
|
}
|
}
|
}
|
}
|