Exemplo n.º 1
0
 public void AddItem(string term, string screenName, bool exclusive)
 {
     var newTerm = new GroupTerm { Term = term, Name = screenName, Exclusive = exclusive };
     if (Terms != null && Terms.Length > 0)
     {
         var items = new List<GroupTerm>(Terms);
         if (!items.Contains(newTerm))
         {
             items.Add(newTerm);
         }
         Terms = items.ToArray();
     }
     else
     {
         Terms = new[] { newTerm };
     }
 }
Exemplo n.º 2
0
 public void RemoveItem(string term)
 {
     var items = new List<GroupTerm>(Terms);
     var toRemove = new GroupTerm();
     foreach (var t in items)
     {
         if (t.Term == term)
         {
             toRemove = t;
         }
     }
     if (items.Contains(toRemove))
     {
         items.Remove(toRemove);
     }
     Terms = items.ToArray();
     if(Terms.Length==0)
     {
         SpecialTimeLinesRepository.Remove(this);
     }
     SpecialTimeLinesRepository.Save();
 }