Example #1
0
        public void ChangeCurrentGroup(QuotesGroup group)
        {
            lock (_locker)
            {
                container.SetCurrentGroup(group);
            }

            StartRotationThread();
        }
        public QuotesGroup GetOrCreateGroup(string line)
        {
            var existingGroup = Groups.FirstOrDefault(g => g.Name == line);

            if (existingGroup == null)
            {
                existingGroup = new QuotesGroup {
                    Name = line
                };
                Groups.Add(existingGroup);
            }

            if (Groups.Count == 1)
            {
                SetCurrentGroup(existingGroup);
            }

            return(existingGroup);
        }
Example #3
0
        public QuotesContainer GetQuotesList()
        {
            QuotesContainer container = new QuotesContainer();
            QuotesGroup     current   = null;

            foreach (string line in contentProvider.Lines.Where(QuoteItemLineHelper.IsLogicalItem).ToList())
            {
                if (QuoteItemLineHelper.IsGroupItem(line))
                {
                    current = container.GetOrCreateGroup(QuoteItemLineHelper.StripCommandPrefixFromItem(line));
                    continue;
                }

                if (current == null)
                {
                    current            = container.GetOrCreateGroup(DefaultGroupName);
                    current.IsSelected = true;
                }

                current.AddQuote(line);
            }

            return(container);
        }
Example #4
0
        public void Execute(object parameter)
        {
            QuotesGroup group = parameter as QuotesGroup;

            engine.ChangeCurrentGroup(group);
        }
 public void SetCurrentGroup(QuotesGroup group)
 {
     Groups.ForEach(g => g.IsSelected = false);
     CurrentGroup            = Groups.Find(g => g == group);
     CurrentGroup.IsSelected = true;
 }