JD2022-TU1/main/tools/modules/JD.Guinness.WPF.Module/View/SubmitDescriptionBox.xaml.cs

36 lines
967 B
C#

namespace JD.Guinness.WPF.Module.View
{
public sealed partial class SubmitDescriptionBox
{
public DelegateCommand OkCommand { get; }
public DelegateCommand CancelCommand { get; }
private SubmitDescriptionBox()
{
OkCommand = new DelegateCommand(OnOk, () => !string.IsNullOrEmpty(Description?.Text));
CancelCommand = new DelegateCommand(OnCancel);
DataContext = this;
InitializeComponent();
}
private void OnOk() => DialogResult = true;
private void OnCancel() => DialogResult = false;
public static bool Show(out string description)
{
SubmitDescriptionBox box = new SubmitDescriptionBox();
if (box.ShowDialog() is true)
{
description = box.Description.Text;
return true;
}
description = null;
return false;
}
}
}