-// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2021 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
}
#endregion
- public bool HasTemplate {
- get { return typeof (TemplatedControl).IsAssignableFrom (CrowType);}
- }
- public bool IsTemplatedGroup {
- get { return typeof (TemplatedGroup).IsAssignableFrom (CrowType);}
- }
- public bool HasDataSourceType {
- get { return DataSourceType != null; }
- }
+ public bool HasTemplate => typeof (TemplatedControl).IsAssignableFrom (CrowType);
+ public bool IsTemplatedGroup => typeof (TemplatedGroup).IsAssignableFrom (CrowType);
+ public bool HasDataSourceType => DataSourceType != null;
- public static implicit operator string (Node sn)
- {
- return sn.ToString ();
- }
- public override string ToString ()
- {
- return string.Format ("{0}.{1}", CrowType.FullName, Index);
- }
+ public static implicit operator string (Node sn) => sn.ToString ();
+ public override string ToString () => string.Format ("{0}.{1}", CrowType.FullName, Index);
}
}
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+using System.Reflection;
+// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
public void RaiseEditAt (int index) {
ListEdit.Raise (this, new ListChangedEventArg (index, this[index]));
}
+
+
+ public static ObservableList<T> Parse (string str) {
+ ObservableList<T> tmp = new ObservableList<T>();
+ Type t = typeof(T);
+ MethodInfo miParse = t.GetMethod ("Parse", BindingFlags.Static | BindingFlags.Public,
+ Type.DefaultBinder, new Type [] {typeof (string)}, null);
+ if (miParse == null)
+ throw new Exception ("no Parse method found for: " + t.FullName);
+ if (!string.IsNullOrEmpty (str)) {
+ foreach (string s in str.Split(';'))
+ tmp.Add((T)miParse.Invoke (null, new object[] {s}));
+ }
+ return tmp;
+ }
}
}