Example #1
0
        private void KillAllOutgoingSearchesAndReset()
        {
            // Kill any collectors
            lock (this)
            {
                if (_mCurrentSubCollector != null)
                {
                    _mCurrentSubCollector.OnCollectionUpdated    -= CurrentSubCollector_OnCollectionUpdated;
                    _mCurrentSubCollector.OnCollectorStateChange -= CurrentSubCollector_OnCollectorStateChange;
                    _mCurrentSubCollector = null;
                }
                if (_mCurrentPostCollector != null)
                {
                    _mCurrentPostCollector.OnCollectionUpdated    -= CurrentPostCollector_OnCollectionUpdated;
                    _mCurrentPostCollector.OnCollectorStateChange -= CurrentPostCollector_OnCollectorStateChange;
                    _mCurrentPostCollector = null;
                }
            }

            // Clear the results
            lock (_mSearchResultsList)
            {
                // Clear them each one by one, this will make them animate out
                while (_mSearchResultsList.Count > 0)
                {
                    _mSearchResultsList.RemoveAt(_mSearchResultsList.Count - 1);
                }
            }

            // Hide progress
            HideProgressBar(SearchResultTypes.Subreddit);
            HideProgressBar(SearchResultTypes.User);
            HideProgressBar(SearchResultTypes.Post);
        }
Example #2
0
        /// <summary>
        /// Creates a new collector and starts a search.
        /// </summary>
        /// <param name="searchTerm"></param>
        private void DoPostSearch(string searchTerm)
        {
            // Get all of the filters.
            var sort            = GetCurrentPostSort();
            var times           = GetCurrentPostTime();
            var subredditFilter = ui_postSubreddit.Text;
            var authorFilter    = ui_postUserName.Text;
            var websiteFilter   = ui_postWebsite.Text;
            var selftextFilter  = ui_postSelfText.Text;
            var isSelfPost      = ui_postIsSelf.SelectedIndex == 0 ? string.Empty : (ui_postIsSelf.SelectedIndex == 1 ? "yes" : "no");
            var isNsfw          = ui_postIsNsfw.SelectedIndex == 0 ? string.Empty : (ui_postIsNsfw.SelectedIndex == 1 ? "yes" : "no");

            lock (this)
            {
                _mCurrentPostCollector = new SearchPostCollector(App.BaconMan, searchTerm, sort, times, subredditFilter, authorFilter, websiteFilter, selftextFilter, isSelfPost, isNsfw);
                _mCurrentPostCollector.OnCollectionUpdated    += CurrentPostCollector_OnCollectionUpdated;
                _mCurrentPostCollector.OnCollectorStateChange += CurrentPostCollector_OnCollectorStateChange;
                _mCurrentPostCollector.Update(true);
            }
        }
Example #3
0
        private void KillAllOutgoingSearchesAndReset()
        {
            // Kill any collectors
            lock(this)
            {
                if(m_currentSubCollector != null)
                {
                    m_currentSubCollector.OnCollectionUpdated -= CurrentSubCollector_OnCollectionUpdated;
                    m_currentSubCollector.OnCollectorStateChange -= CurrentSubCollector_OnCollectorStateChange;
                    m_currentSubCollector = null;
                }
                if(m_currentPostCollector != null)
                {
                    m_currentPostCollector.OnCollectionUpdated -= CurrentPostCollector_OnCollectionUpdated;
                    m_currentPostCollector.OnCollectorStateChange -= CurrentPostCollector_OnCollectorStateChange;
                    m_currentPostCollector = null;
                }
            }

            // Clear the results
            lock(m_searchResultsList)
            {
                // Clear them each one by one, this will make them animate out
                while(m_searchResultsList.Count > 0)
                {
                    m_searchResultsList.RemoveAt(m_searchResultsList.Count - 1);
                }
            }

            // Hide progress
            HideProgressBar(SearchResultTypes.Subreddit);
            HideProgressBar(SearchResultTypes.User);
            HideProgressBar(SearchResultTypes.Post);
        }
Example #4
0
        /// <summary>
        /// Creates a new collector and starts a search.
        /// </summary>
        /// <param name="searchTerm"></param>
        private void DoPostSearch(string searchTerm)
        {
            // Get all of the filters.
            PostSearchSorts sort = GetCurrentPostSort();
            PostSearchTimes times = GetCurrentPostTime();
            string subredditFilter = ui_postSubreddit.Text;
            string authorFilter = ui_postUserName.Text;
            string websiteFilter = ui_postWebsite.Text;
            string selftextFilter = ui_postSelfText.Text;
            string isSelfPost = ui_postIsSelf.SelectedIndex == 0 ? String.Empty : (ui_postIsSelf.SelectedIndex == 1 ? "yes" : "no");
            string isNsfw = ui_postIsNsfw.SelectedIndex == 0 ? String.Empty : (ui_postIsNsfw.SelectedIndex == 1 ? "yes" : "no");

            lock (this)
            {
                m_currentPostCollector = new SearchPostCollector(App.BaconMan, searchTerm, sort, times, subredditFilter, authorFilter, websiteFilter, selftextFilter, isSelfPost, isNsfw);
                m_currentPostCollector.OnCollectionUpdated += CurrentPostCollector_OnCollectionUpdated;
                m_currentPostCollector.OnCollectorStateChange += CurrentPostCollector_OnCollectorStateChange;
                m_currentPostCollector.Update(true);
            }
        }