Example #1
0
        public void UpdateLineupAssociations()
        {
            // First locate the imported lineup to associate.
            Lineup importedLineup = FindMXFImportedLineup();

            foreach (var scannedLineupConfig in config_.scanned_lineups)
            {
                // Skip if no SDLineup has been assigned.
                if (string.IsNullOrEmpty(scannedLineupConfig.sd_lineup_id))
                {
                    continue;
                }
                // If no checkboxes selected, nothing to do.
                if (!scannedLineupConfig.addAssociation && !scannedLineupConfig.removeOtherAssociations)
                {
                    continue;
                }
                // Find WMC scanned lineup.
                Lineup scannedLineup = LineupUtil.FindLineupById(scannedLineupConfig.id);
                // Loop through tuners in the scanned linup, applying the selected settings to each tuner.
                foreach (Device tuner in scannedLineup.ScanDevices)
                {
                    if (scannedLineupConfig.addAssociation)
                    {
                        if (!LineupUtil.IsLineupInLineups(tuner.WmisLineups, importedLineup))
                        {
                            tuner.WmisLineups.Add(importedLineup);
                        }
                    }
                    if (scannedLineupConfig.removeOtherAssociations)
                    {
                        List <Lineup> lineupsToRemove = new List <Lineup>();
                        foreach (Lineup l in tuner.WmisLineups)
                        {
                            if (!LineupUtil.AreSameLineup(l, importedLineup))
                            {
                                lineupsToRemove.Add(l);
                            }
                        }
                        foreach (Lineup l in lineupsToRemove)
                        {
                            tuner.WmisLineups.RemoveAllMatching(l);
                        }
                    }
                }
            }
        }
Example #2
0
 private Lineup FindMXFImportedLineup()
 {
     return(LineupUtil.FindLineupByUID(ConfigManager.MXFLineup.GetLineupIdSuffix()));
 }