Esempio n. 1
0
        private void RemoveSearch(string searchText)
        {
            var existingSearch = Searches.FirstOrDefault(s => s.SearchText == searchText);

            if (existingSearch != null)
            {
                existingSearch.SearchObservable.Dispose();
                Searches.Remove(existingSearch);
                if (Searches.Count == 0)
                {
                    Tweets.Clear();
                }
            }
        }
Esempio n. 2
0
        private void AddToExistingSearchesOrCreateNew(ISearch searchToBeAdded)
        {
            if (searchToBeAdded == null)
            {
                throw new ArgumentNullException("searchToBeAdded");
            }

            lock (thisLock)
            {
                var matchingSearch = Searches.FirstOrDefault((existingSearch) => existingSearch.Owner == searchToBeAdded.Owner &&
                                                             existingSearch.DescriptionKey == searchToBeAdded.DescriptionKey);

                if (matchingSearch != null)
                {
                    matchingSearch.Criteria.AddRange(searchToBeAdded.Criteria);
                }
                else
                {
                    Searches.Add(searchToBeAdded);
                }
            }
        }