public Engines(string connectionStringPrimary, string connectionStringSecondary) { ConnectionStringPrimary = connectionStringPrimary; ConnectionStringSecondary = connectionStringSecondary; _db = DatabaseProviderLoader.LoadDatabaseProvider(); _db.Open(connectionStringPrimary, connectionStringSecondary); ArchiveDirectories = new ArchiveDirectories(_db); try { _db.Open(); EngineList = _db.DbLoadEngines <Engine>(); Servers = _db.DbLoadServers <CasparServer>(); Servers.ForEach(s => { s.Channels.ForEach(c => c.Owner = s); s.Recorders.ForEach(r => r.Owner = s); }); EngineList.ForEach(e => { e.IsNew = false; e.Servers = Servers; e.ArchiveDirectories = ArchiveDirectories; }); } finally { _db.Close(); } }
public Engines(string connectionStringPrimary, string connectionStringSecondary) { ConnectionStringPrimary = connectionStringPrimary; ConnectionStringSecondary = connectionStringSecondary; ArchiveDirectories = new ArchiveDirectories(connectionStringPrimary, connectionStringSecondary); try { Database.Open(); _engines = Database.DbLoadEngines <Engine>(); Servers = Database.DbLoadServers <CasparServer>(); Servers.ForEach(s => { s.Channels.ForEach(c => c.Owner = s); s.Recorders.ForEach(r => r.Owner = s); }); _engines.ForEach(e => { e.IsNew = false; e.Servers = this.Servers; e.ArchiveDirectories = this.ArchiveDirectories; }); } finally { Database.Close(); } }
public Engines(DatabaseType databaseType, ConnectionStringSettingsCollection connectionStringSettingsCollection) { _db = DatabaseLoader.LoadDatabaseProviders().FirstOrDefault(db => db.DatabaseType == databaseType); _db.Open(connectionStringSettingsCollection); ArchiveDirectories = new ArchiveDirectories(_db); EngineList = _db.LoadEngines <Engine>().ToList(); Servers = _db.LoadServers <CasparServer>(); foreach (var s in Servers) { s.Channels.ForEach(c => c.Owner = s); s.Recorders.ForEach(r => r.Owner = s); } foreach (var e in EngineList) { e.IsNew = false; e.Servers = Servers; e.ArchiveDirectories = ArchiveDirectories; } }
public ArchiveDirectoriesViewmodel(Model.ArchiveDirectories directories) : base(directories, new ArchiveDirectoriesView(), "Archive directories") { _directories = new ObservableCollection <ArchiveDirectory>(Model.Directories); _createCommands(); }