public bool Add(Subject s)
 {
     bool success = false;
     if(!subjects.Keys.Contains(s.Name))
     {
         subjects.Add(s.Name, s);
         success = true;
     }
     return success;
 }
Exemple #2
0
        public void LoadImageSet(string path, string[] fileNames, BatchType batchType)
        {
            //Get a list of images from source
            List<BitmapImage>  imageBatch = il.Load(path, fileNames);

            //Create a dictionary of subjects from the list of images
            if( imageBatch != null )
            {
                SubjectBatch subjects = new SubjectBatch();
                subjects.Name = DEFAULT_BATCH_PREFIX + assignBatchNum++;

                for (int i = 0; i < imageBatch.Count; i++)
                {
                    Subject subject = new Subject();
                    subject.BaseImage = imageBatch.ElementAt(i);
                    subject.Path = path;
                    subject.Name = fileNames[i];
                    subject.Gender = GenderType.UNKNOWN;
                    subjects.Add(subject);
                }

                //Add the collection of new subjects to the batch list
                subjectBatches.Add(subjects.Name, subjects);
                focusBatchName = subjects.Name;
                if(!FocusSubjects.Keys.Contains(subjects.Name))
                {
                    focusSubjects.Add(focusBatchName, subjects.Subjects.Values.Last());
                }
                else
                {
                    focusSubjects[focusBatchName] = subjects.Subjects.Values.Last();
                }

            }
        }