using DevExpress.XtraEditors;
|
using IStation.Untity;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Windows.Forms;
|
|
namespace IStation.WinFrmUI.Monitor
|
{
|
public partial class SetDoubleDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public SetDoubleDlg()
|
{
|
InitializeComponent();
|
this.IconOptions.Icon = WinFrmUI.Properties.Resources.App;
|
this.dataLayoutControl1.SetupLayoutControl();
|
}
|
|
/// <summary>
|
/// 回调事件
|
/// </summary>
|
public event Func<double, bool> ReloadDataEvent;
|
|
|
/// <summary>
|
/// 绑定
|
/// </summary>
|
public void SetBindingData(double value)
|
{
|
this.DoubleTextEdit.EditValue = value;
|
}
|
|
//验证
|
private bool Valid()
|
{
|
this.dxErrorProvider1.ClearErrors();
|
|
|
var hzs = this.DoubleTextEdit.Text.Trim();
|
if (string.IsNullOrEmpty(hzs))
|
{
|
this.dxErrorProvider1.SetError(this.DoubleTextEdit, "必填项");
|
return false;
|
}
|
|
return true;
|
}
|
|
//确定
|
private void btnOk_Click(object sender, EventArgs e)
|
{
|
if (!Valid())
|
return;
|
var value = Convert.ToDouble(this.DoubleTextEdit.Text.Trim());
|
if (this.ReloadDataEvent == null)
|
return;
|
if (!this.ReloadDataEvent(value))
|
{
|
XtraMessageBox.Show("更新失败!");
|
return;
|
}
|
XtraMessageBox.Show("更新成功!");
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
|
}
|
}
|