38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
namespace Content.Client._Sunrise.Dice
|
|
{
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class ChangeDiceWindow : DefaultWindow
|
|
{
|
|
public ChangeDiceWindow()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
AmountStartLineEdit.OnTextChanged += OnValueChanged;
|
|
AmountEndLineEdit.OnTextChanged += OnValueChanged;
|
|
}
|
|
|
|
private void OnValueChanged(LineEdit.LineEditEventArgs args)
|
|
{
|
|
if (int.TryParse(AmountStartLineEdit.Text, out var startAmount) &&
|
|
int.TryParse(AmountEndLineEdit.Text, out var endAmount))
|
|
{
|
|
if (startAmount < 1 || endAmount > 1000000 || endAmount < startAmount)
|
|
{
|
|
ApplyButton.Disabled = true;
|
|
}
|
|
else
|
|
{
|
|
ApplyButton.Disabled = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ApplyButton.Disabled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|