Exemple #1
0
        public void Initialize(
            StringCollection searches,
            SearchManager.SearchManagerOperationCompletedHandler completedHandler,
            SearchManager.SearchManagerOperationErrorHandler errorHandler)
        {
            SearchManager manager;

            foreach (string search in searches)
            {
                manager = CreateSearch(search, completedHandler, errorHandler);
                manager.SearchAsync();
            }
        }
Exemple #2
0
        public SearchManager CreateSearch(
            string keyword,
            SearchManager.SearchManagerOperationCompletedHandler completedHandler,
            SearchManager.SearchManagerOperationErrorHandler errorHandler)
        {
            // create an instance of search manager for this keyword
            SearchManager search = new SearchManager(_username, _password);

            search.Keyword = keyword;

            // attach event handlers
            if (null != completedHandler)
            {
                search.SearchManagerOperationCompleted += completedHandler;
            }
            if (null != errorHandler)
            {
                search.SearchManagerOperationError += errorHandler;
            }

            // keep a list of all keyword searches
            _searchManagers.Add(keyword, search);
            return(search);
        }