📄 abstractrecord.cs
字号:
{ PropertyInfo pi = this.GetType().GetProperty(Name); if (pi == null) { return null; } return pi.GetValue(this, null); } set { PropertyInfo pi = this.GetType().GetProperty(Name); if (pi == null) { return; } pi.SetValue(this, PropertyConverter.Convert(value, pi.PropertyType), null); if (NotifyPropertyChangedHandlers.ContainsKey(Name)) { NotifyPropertyChangedHandlers[Name](); } FireChangeEvents(); } } protected void FireChangeEvents() { if (OnChange != null) OnChange(this); if (changedRecordListeners.ContainsKey(this.GetType())) changedRecordListeners[this.GetType()](this); } public virtual int ComputeRecordWeight() { return 1; } virtual public ColumnInfo[] Fields { get { if (!ColumnInfoManager.TypeIsRegistered(this.GetType())) { List<PropertyInfo> props = DiscoverDerivedProperties(this.GetType()); List<ColumnInfo> fs = new List<ColumnInfo>(); foreach (PropertyInfo pi in props) { ColumnInfo fi = new ColumnInfo(); fi.Name = pi.Name; fi.Type = pi.PropertyType; PropertyTypeAttribute pta = getPropertyTypeAttribute(pi); if (pta != null) fi.DataType = pta.Type; else { fi.DataType = DataType.None; if (TypeIsRecordList(fi.Type)) fi.DataType = DataType.RecordList; else fi.DataType = DataType.None; } fs.Add(fi); } ColumnInfoManager.RegisterColumns(this.GetType(), fs.ToArray()); } return ColumnInfoManager.RequestColumns(this.GetType()); } set { throw new System.NotImplementedException("That feature is not implemented."); } } public virtual Type GetFieldTypeFromName(string name) { return GetFieldInfoFromName(name).Type; } public ColumnInfo GetFieldInfoFromName(string name) { foreach (ColumnInfo fi in Fields) if (fi.Name == name) return fi; return null; } virtual public string toJSON(JSON.Type transportType, List<DataGridColumn> columns) { string open = "[", close = "]"; if (transportType == JSON.Type.Object) { open = "{"; close = "}"; } List<string> props = new List<string>(); foreach (DataGridColumn col in columns) { string val; if (this[col.Name] != null) { val = JSON.PrepareValueForJSON(this[col.Name]); } else { val = "null"; } switch (transportType) { case JSON.Type.Object:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -