Exemplo n.º 1
0
        /// <summary>
        /// check and fix null values using as camera index a value in the range that is not used
        /// </summary>
        /// <param name="cconfig">CameraConfig ObservableCollection to be checked and fixed if needed</param>
        protected void ValidateCameras(RangeObservableCollection <CameraConfig> cconfig)
        {
            if (cconfig == null)
            {
                return;
            }
            if (cconfig.All(c => c != null))
            {
                return;
            }
            List <CameraConfig> cc = cconfig.Where(c => c != null).ToList();
            int k = 0;

            for (int i = 0; i < cconfig.Count; i++)
            {
                if (cconfig [i] == null)
                {
                    while (cc.Any(c => c.Index == k))
                    {
                        k++;
                    }
                    cconfig [i] = new CameraConfig(k);
                    k++;
                }
            }
        }