Example #1
0
        IFilterScope CreateScope(List <KeyValuePair <ScopeItem, bool> > items, IFiltersFactory filtersFactory)
        {
            if (!scopeSupported)
            {
                return(filtersFactory.CreateScope());
            }

            List <ILogSource> sources = new List <ILogSource>();
            List <IThread>    threads = new List <IThread>();

            for (int i = 0; i < items.Count;)
            {
                ScopeItem item      = items[i].Key;
                bool      isChecked = items[i].Value;

                if (item is AllSources)
                {
                    if (isChecked)
                    {
                        return(filtersFactory.CreateScope());
                    }
                    ++i;
                    continue;
                }

                if (item is SourceNode)
                {
                    if (isChecked)
                    {
                        sources.Add(((SourceNode)item).Source);
                        ++i;
                        while (i < items.Count && items[i].Key is ThreadNode)
                        {
                            ++i;
                        }
                    }
                    else
                    {
                        ++i;
                    }
                    continue;
                }

                if (item is ThreadNode)
                {
                    if (isChecked)
                    {
                        threads.Add(((ThreadNode)item).Thread);
                    }
                    ++i;
                    continue;
                }

                throw new InvalidOperationException("Unknown node type");
            }

            return(filtersFactory.CreateScope(sources, threads));
        }
Example #2
0
 void IViewEvents.OnScopeItemChecked(ScopeItem item, bool checkedValue)
 {
     if (!scopeSupported)
     {
         return;
     }
     if (clickLock)
     {
         return;
     }
     clickLock = true;
     ((Node)item).Click(checkedValue);
     clickLock = false;
 }