示例#1
0
 public bool ContainsRecursive(ITextOrGroupViewModel item)
 {
     if (_items.Contains(item))
     {
         return(true);
     }
     foreach (ITextOrGroupModel model in _items)
     {
         if (model is IGroupModel)
         {
             if (((IGroupModel)model).ContainsRecursive(item))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#2
0
        //private void RefreshActiveItems()
        //{
        //    for (int i = 0; i < _activeItems.Count; i++)
        //    {
        //        ITextOrGroupViewModel model = _activeItems[i];
        //        if (model is ITextViewModel)
        //        {
        //            _activeItems[i] = _textController.GetTextByName(model.GetName());
        //        }
        //        else
        //        {
        //            _activeItems[i] = _groupController.GetGroupByName(model.GetName());
        //        }
        //    }
        //}

        private List <ITextOrGroupViewModel> GetActiveItems()
        {
            List <ITextOrGroupViewModel> result = new List <ITextOrGroupViewModel>();

            for (int i = 0; i < _activeItemNames.Count; i++)
            {
                string name = _activeItemNames[i];
                ITextOrGroupViewModel model = _textController.GetTextByName(name);
                if (model == null)
                {
                    model = _groupController.GetGroupByName(name);
                }
                if (model == null)
                {
                    throw new InvalidOperationException("The active items list contains a nonexistant item.");
                }
                result.Add(model);
            }
            return(result);
        }