Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XAttributeValuePropertyDescriptor.cs
Go to the documentation of this file.
1using System;
3
5
6internal sealed class XAttributeValuePropertyDescriptor : XPropertyDescriptor<XAttribute, string>
7{
9
10 public override bool IsReadOnly => false;
11
13 : base("Value")
14 {
15 }
16
17 public override object GetValue(object component)
18 {
19 _attribute = component as XAttribute;
20 if (_attribute == null)
21 {
22 return string.Empty;
23 }
24 return _attribute.Value;
25 }
26
27 public override void SetValue(object component, object value)
28 {
29 _attribute = component as XAttribute;
30 if (_attribute != null)
31 {
32 _attribute.Value = value as string;
33 }
34 }
35
36 protected override void OnChanged(object sender, XObjectChangeEventArgs args)
37 {
38 if (_attribute != null && args.ObjectChange == XObjectChange.Value)
39 {
40 OnValueChanged(_attribute, EventArgs.Empty);
41 }
42 }
43}
static readonly EventArgs Empty
Definition EventArgs.cs:9