Stack Size Grid

- added good, warning and bad icons to the stack size grid.
This commit is contained in:
Brett Hewitson 2022-06-15 23:33:49 +10:00
parent ca9c053f08
commit b24904d13c
5 changed files with 63 additions and 6 deletions

View file

@ -27,6 +27,8 @@ namespace ServerManagerTool.Lib
}
}
Update();
return errors;
}
@ -45,6 +47,14 @@ namespace ServerManagerTool.Lib
public void UpdateForLocalization()
{
}
public void Update()
{
IsEnabled = this.Count > 0;
foreach (var stackSize in this)
stackSize.Update();
}
}
[DataContract]
@ -99,7 +109,10 @@ namespace ServerManagerTool.Lib
public override void InitializeFromINIValue(string value)
{
if (string.IsNullOrWhiteSpace(value))
{
Update();
return;
}
var kvPair = value.Split(new[] { '=' }, 2);
var kvValue = kvPair[1].Trim(' ');
@ -136,6 +149,19 @@ namespace ServerManagerTool.Lib
{
return IsValid;
}
public static readonly DependencyProperty ValidStatusProperty = DependencyProperty.Register(nameof(ValidStatus), typeof(string), typeof(StackSizeOverride), new PropertyMetadata("N"));
public string ValidStatus
{
get { return (string)GetValue(ValidStatusProperty); }
set { SetValue(ValidStatusProperty, value); }
}
public void Update()
{
ValidStatus = IsValid ? (GameData.HasItemForClass(ItemClassString) ? "Y" : "W") : "N";
}
}
[DataContract]