public override void Init(GenericDataDictionary template, GenericDataObject parentModel) { template.GetValue("label", out string label); _label.Text = label; template.GetValue("keyPrefix", out _keyPrefix); _prefixLabel.Text = _keyPrefix; template.GetValue("slotType", out _linkType); parentModel.TryGetValue(_label.Text, out GenericDataObject <string> model); if (model != null) { _model = model; _field.Text = _model.value.Substring(_keyPrefix.Length, _model.value.Length - _keyPrefix.Length); OnChanged(_field.Text); } else { template.GetValue("key", out string defaultKey); _field.Text = defaultKey; _model = parentModel.TryAddValue(_label.Text, string.Empty) as GenericDataObject <string>; OnChanged(_field.Text); } }
public override void Init(GenericDataDictionary template, GenericDataObject parentModel) { template.GetValue("label", out string label); _label.Text = label; template.GetValue("keyPrefix", out _keyPrefix); template.GetValue("keySize", out _keySize); template.GetValue("slotType", out _linkType); parentModel.TryGetValue(_label.Text, out GenericDataObject <string> model); if (model != null) { _model = model; SetKey(_model.value); _model.value = GetKey; } else { SetKey(); _model = parentModel.TryAddValue(_label.Text, GetKey) as GenericDataObject <string>; } }