Beispiel #1
0
        public void RemovePtypes(IEnumerable <string> ptypesremoved)
        {
            foreach (string ptype in ptypesremoved)
            {
                ViewablePrototypeItem prev         = PrototypeItems.FirstOrDefault((i) => i.Guid == ptype);
                ViewablePrototypeItem selectedPrev = SelectedPrototypes.FirstOrDefault((i) => i.Guid == ptype);

                if (prev != null)
                {
                    PrototypeItems.Remove(prev);
                }

                if (selectedPrev != null)
                {
                    SelectedPrototypes.Remove(selectedPrev);
                }
            }
        }
Beispiel #2
0
        public void AddPtypes(string library, IEnumerable <Ptype> ptypesadded)
        {
            PrototypeItems.RaiseListChangedEvents = false;
            foreach (Ptype ptype in ptypesadded)
            {
                ViewablePrototypeItem prev = PrototypeItems.FirstOrDefault((i) => i.Guid.Equals(ptype.Id));

                var examples = PtypeSerializationUtility.GetTrainingExamples(library, ptype.Id);

                if (prev == null)
                {
                    PrototypeItems.Insert(0, new ViewablePrototypeItem(ptype, library, examples.Positives, examples.Negatives));
                }
                else
                {
                    int index = PrototypeItems.IndexOf(prev);
                    PrototypeItems.Remove(prev);
                    PrototypeItems.Insert(index, new ViewablePrototypeItem(ptype, library, examples.Positives, examples.Negatives));
                }
            }

            PrototypeItems.RaiseListChangedEvents = true;
            PrototypeItems.ResetBindings();
        }
 public LevelPrototype Clone()
 {
     return(new LevelPrototype(_context, PrototypeItems.ToList()));
 }
Beispiel #4
0
 public void SetPtypes(string library, IEnumerable <Ptype> ptypes)
 {
     PrototypeItems.Clear();
     AddPtypes(library, ptypes);
 }