public IEnumerable<INeTreeBuilder> GetNetreeBuilders(NeLevel level, NeTreeBuilderGroupFlags flag, int cityId, string vendor) { var lstBuld = new List<INeTreeBuilder>(); var assembly = Assembly.GetExecutingAssembly(); var buldTypes = assembly.GetExportedTypes() .Where(e => { var attr = e.GetAttribute<NeTreeBuilderGroupAttribute>(); return attr != null && attr.Flag == flag && (attr.Level & level) == level; }); foreach (var type in buldTypes) { try { var contructInfo = type.GetConstructor(new[] { typeof(NeLevel), typeof(int), typeof(string) }); lstBuld.Add((INeTreeBuilder)contructInfo.Invoke(new object[] { level, cityId, vendor })); } catch (Exception ex) { new Logger().Logging(LogLevel.Error, ex, string.Empty); continue; } } return lstBuld; }
public NeTreeViewModel(CityViewModel city, NeLevel level, NeTreeBuilderGroupFlags flag) : base() { NeTreeBuilders = new ObservableCollection<NeTreeBuilderViewModel>(); RootNodes = new ObservableCollection<NeNodeViewModel>(); Level = level; City = city; }