/// <summary>
 /// Constructore that takes in the dependency for the SearchCriteriaFactory at runtime.
 /// </summary>
 /// <param name="searchCriteriaFactory">Instance of the SearchCriteriaFactory</param>
 public MapSearchViewModelToSearchCriteria(SearchCriteriaFactory searchCriteriaFactory)
 {
     if (searchCriteriaFactory == null)
     {
         throw new ArgumentNullException("SearchCriteriaFactory", "No valid SearchCriteriaFactory supplied");
     }
     _factory = searchCriteriaFactory;
 }
Example #2
0
 /// <summary>
 /// Ctor: to inject dependencies.
 /// </summary>
 /// <param name="SearchFactory">Search Factory dependency</param>
 /// <remarks>
 /// The SearchFactory is required to create the searchCriteria class.
 /// </remarks>
 public SearchData(SearchCriteriaFactory SearchFactory)
 {
     if (SearchFactory == null)
     {
         throw new ArgumentNullException("SearchFactory", "No Search Factory supplied to SearchesData");
     }
     _searchFactory = SearchFactory;
     //  Now load the Searches
     loadData();
 }
Example #3
0
        /// <summary>
        /// Runs this instance.
        /// </summary>
        /// <returns></returns>
        public int Run()
        {
            var cancelAfterMs = 600000;

            var names          = Import.FromTxt(_namesFilePath);
            var searchCriteria = SearchCriteriaFactory.Get(_maxRuns, _city, _state, _zip);
            var searches       = SearchesFactory.Get(searchCriteria, names);

            using (var cancellationTokenSource = new CancellationTokenSource(cancelAfterMs))
            {
                var token = cancellationTokenSource.Token;
                Task.Run(() => PeopleSearchTask(searches, token));
            }

            return(0);
        }