private void LoadSchedules() { Logger.Log(EntryType.Application, "Looking for schedules assembly"); var schedulerType = typeof (IScheduler); foreach (var types in from file in Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll") select Assembly.LoadFrom(file) into assembly where assembly != null select assembly.GetExportedTypes()) { foreach (var type in types.Where(type => schedulerType.IsAssignableFrom(type))) { Logger.Log(EntryType.Application, "Found schedules assembly {0}", type.FullName); Scheduler = Activator.CreateInstance(type) as IScheduler; break; } if (Scheduler != null) { break; } } if (Scheduler == null) { Logger.Log(EntryType.Error, "_scheduler was not loaded and is null"); return; } Logger.Log(EntryType.Application, "Loading schedules"); Scheduler.LoadSchedules(); Scheduler.StartAll(); ScheduledProcesses = Scheduler.GetSchedules().ToList(); }