using DevExpress.XtraEditors;
using System;
using System.Windows.Forms;
namespace HStation.WinFrmUI.Assets
{
///
/// 设置使用状态
///
public partial class SetDefaultStatusDlg : XtraForm
{
public SetDefaultStatusDlg()
{
InitializeComponent();
this.layoutControl1.SetupLayoutControl();
}
///
/// 回调函数
///
public event Func> ReloadDataEvent;
///
/// 绑定数据
///
public void SetBindingData(bool IsDefault)
{
switch (IsDefault)
{
case true: this.radioGroup1.SelectedIndex = 1; break;
case false: this.radioGroup1.SelectedIndex = 0; break;
}
}
//确定
private async void btnOk_Click(object sender, EventArgs e)
{
bool status = false;
if (this.radioGroup1.SelectedIndex == 0)
status = false;
else if (this.radioGroup1.SelectedIndex == 1)
status = true;
if (this.ReloadDataEvent != null)
{
var result = await this.ReloadDataEvent.Invoke(status);
if (result)
{
XtraMessageBox.Show("更新成功!");
}
else
{
XtraMessageBox.Show("更新失败!");
return;
}
}
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}