Esempio n. 1
0
        public VsSearchTask(uint dwCookie, IVsSearchQuery pSearchQuery, IVsSearchCallback pSearchCallback, ISearchHandler handler, CancellationTokenSource cts) {
            if (pSearchQuery == null) {
                throw new ArgumentNullException(nameof(pSearchQuery));
            }

            if (pSearchCallback == null) {
                throw new ArgumentNullException(nameof(pSearchCallback));
            }

            if (dwCookie == VSConstants.VSCOOKIE_NIL) {
                throw new ArgumentException(nameof(dwCookie));
            }

            if (string.IsNullOrEmpty(pSearchQuery.SearchString)) {
                throw new ArgumentException(nameof(pSearchQuery));
            }

            Id = dwCookie;
            SearchQuery = pSearchQuery;
            ErrorCode = 0;

            _searchCallback = pSearchCallback;
            _handler = handler;
            _cts = cts;
            _taskStatus = (long)Created;
        }
Esempio n. 2
0
        public async Task SearchEmptyString_Returns_Null()
        {
            _fakeSearchHandler = new SearchHandler(new QueryParserFactory(), null);
            var result = await _fakeSearchHandler.ProcessSearch("");

            Assert.Equal(result, null);
        }
Esempio n. 3
0
        async Task MainAsync()
        {
            try
            {
                using (var services = ConfigureServices())
                {
                    // Get injected services
                    Settings          = services.GetRequiredService <AppSettings>();
                    DiscordConnection = services.GetRequiredService <DiscordSocketClient>();
                    GithubHandler     = services.GetRequiredService <IGithubHandler>();
                    SearchHandler     = services.GetRequiredService <ISearchHandler>();

                    // Add function handlers to connection
                    DiscordConnection.Log             += OnLogAsync;
                    DiscordConnection.Ready           += OnConnectionReady;
                    DiscordConnection.Connected       += OnConnectedAsync;
                    DiscordConnection.MessageReceived += OnMessageReceived;

                    await DiscordConnection.LoginAsync(Discord.TokenType.Bot, Settings.AccessToken);

                    await DiscordConnection.StartAsync();

                    await Task.Delay(-1);
                }
            }
            catch (System.Exception ex)
            {
                LogError(ex);
            }
        }
Esempio n. 4
0
 public VsSearchControl(IVsWindowSearchHost vsWindowSearchHost, ISearchHandler handler, SearchControlSettings settings) {
     Category = settings.SearchCategory;
     _settings = settings;
     _handler = handler;
     _vsWindowSearchHost = vsWindowSearchHost;
     _vsWindowSearchHost.SetupSearch(this);
 }
Esempio n. 5
0
        public VsSearchTask(uint dwCookie, IVsSearchQuery pSearchQuery, IVsSearchCallback pSearchCallback, ISearchHandler handler, CancellationTokenSource cts)
        {
            if (pSearchQuery == null)
            {
                throw new ArgumentNullException(nameof(pSearchQuery));
            }

            if (pSearchCallback == null)
            {
                throw new ArgumentNullException(nameof(pSearchCallback));
            }

            if (dwCookie == VSConstants.VSCOOKIE_NIL)
            {
                throw new ArgumentException(nameof(dwCookie));
            }

            if (string.IsNullOrEmpty(pSearchQuery.SearchString))
            {
                throw new ArgumentException(nameof(pSearchQuery));
            }

            Id          = dwCookie;
            SearchQuery = pSearchQuery;
            ErrorCode   = 0;

            _searchCallback = pSearchCallback;
            _handler        = handler;
            _cts            = cts;
            _taskStatus     = (long)Created;
        }
Esempio n. 6
0
        public async Task Search1Provider_1KeyWord_Returns_1Result()
        {
            _fakeSearchHandler = new SearchHandler(new QueryParserFactory(), new Fake1Resolver());
            var result = await _fakeSearchHandler.ProcessSearch("something");

            Assert.Equal(result.First().EngineResults.Count(), 1);
        }
Esempio n. 7
0
            protected override void VisitCollection <TContainer, TCollection, TElement>(Property <TContainer, TCollection> property, ref TContainer container, ref TCollection value)
            {
                if (RuntimeTypeInfoCache <TCollection> .CanBeNull && null == value)
                {
                    throw new InvalidBindingException($"SearchElement has invalid data bindings. SourceDataPath=[{SourceDataPath}] is null.");
                }

                var handler = new SearchHandler <TElement>(SearchElement);

                var root = PropertyElement;
                var path = SourceDataPath;

                handler.SetSearchDataProvider(() =>
                {
                    var filtered = root.GetValue <TCollection>(path);

                    if (RuntimeTypeInfoCache <TCollection> .CanBeNull && null == filtered)
                    {
                        throw new InvalidBindingException($"SearchElement has invalid data bindings. SourceDataPath=[{path}] is null.");
                    }

                    return(filtered);
                });

                SearchHandler = handler;
            }
 public MainWindow(ISearchHandler searchHandler, IStatisticsHandler statisticsHandler,
                   IServiceProvider serviceProvider)
 {
     InitializeComponent();
     _searchHandler     = searchHandler;
     _statisticsHandler = statisticsHandler;
     _serviceProvider   = serviceProvider;
 }
 public SearchEngineController(ILogger <SearchEngineController> logger,
                               ISearchHandler searchHandler,
                               IResultCalculator resultCalculator)
 {
     _logger           = logger;
     _searchHandler    = searchHandler;
     _resultCalculator = resultCalculator;
 }
Esempio n. 10
0
        public ISearchControl Create(FrameworkElement host, ISearchHandler handler, SearchControlSettings settings)
        {
            VsAppShell.Current.AssertIsOnMainThread();

            var vsWindowSearchHost = _factoryLazy.Value.CreateWindowSearchHost(host);

            return(new VsSearchControl(vsWindowSearchHost, handler, settings));
        }
Esempio n. 11
0
 public VsSearchControl(IVsWindowSearchHost vsWindowSearchHost, ISearchHandler handler, SearchControlSettings settings)
 {
     Category            = settings.SearchCategory;
     _settings           = settings;
     _handler            = handler;
     _vsWindowSearchHost = vsWindowSearchHost;
     _vsWindowSearchHost.SetupSearch(this);
 }
Esempio n. 12
0
 public FileExplorer(ITypeCache cache, string defaultLanguage, Action<string, int, int> action, Action cancelAction)
 {
     InitializeComponent();
     Refresh();
     _cache = cache;
     _defaultLanguage = defaultLanguage;
     _action = action;
     _cancelAction = cancelAction;
     _handler = new CacheSearchHandler(_cache, _defaultLanguage, treeViewFiles);
 }
Esempio n. 13
0
 public FileExplorer(ITypeCache cache, string defaultLanguage, Action <string, int, int> action, Action cancelAction)
 {
     InitializeComponent();
     Refresh();
     _cache           = cache;
     _defaultLanguage = defaultLanguage;
     _action          = action;
     _cancelAction    = cancelAction;
     _handler         = new CacheSearchHandler(_cache, _defaultLanguage, treeViewFiles);
 }
Esempio n. 14
0
        public SearchController(IHostingEnvironment hostEnvironment, IOptions <ServiceSettings> settingsOptions)
        //, ISearchHandler searchHandler)
        {
            this.searchHandler = new SearchHandler(
                ServiceHttpClient,
                settingsOptions.Value.ServiceUrl,
                Path.Combine(hostEnvironment.ContentRootPath, settingsOptions.Value.SearchTemplatePath),
                Path.Combine(hostEnvironment.ContentRootPath, settingsOptions.Value.SearchTransformFilePath));

            //this.searchHandler = searchHandler;
        }
Esempio n. 15
0
        public VsSearchTask(uint dwCookie, IVsSearchQuery pSearchQuery, IVsSearchCallback pSearchCallback, ISearchHandler handler, CancellationTokenSource cts)
        {
            Check.ArgumentNull(nameof(pSearchQuery), pSearchQuery);
            Check.ArgumentNull(nameof(pSearchCallback), pSearchCallback);
            Check.Argument(nameof(dwCookie), () => dwCookie != VSConstants.VSCOOKIE_NIL);
            Check.ArgumentStringNullOrEmpty(nameof(pSearchQuery), pSearchQuery.SearchString);

            Id          = dwCookie;
            SearchQuery = pSearchQuery;
            ErrorCode   = 0;

            _searchCallback = pSearchCallback;
            _handler        = handler;
            _cts            = cts;
            _taskStatus     = (long)Created;
        }
 /// <summary>
 /// Construtor
 /// </summary>
 public StateFindFromCache(ISearchHandler <StateFindAllNoPageMsg, List <State> > searchStateParam)
 {
     searchState = searchStateParam;
 }
Esempio n. 17
0
 public AddressCreatorHandler(IAddressCreator _creator,
                              ISearchHandler <StateFindFromCacheMsg, List <State> > searchStateParam)
 {
     creator     = _creator;
     searchState = searchStateParam;
 }
Esempio n. 18
0
 public TestSearchControl(ISearchHandler handler, SearchControlSettings settings)
 {
     Category  = settings.SearchCategory;
     _settings = settings;
     _handler  = handler;
 }
Esempio n. 19
0
        public ISearchControl Create(FrameworkElement host, ISearchHandler handler, SearchControlSettings settings) {
            VsAppShell.Current.AssertIsOnMainThread();

            var vsWindowSearchHost = _factoryLazy.Value.CreateWindowSearchHost(host);
            return new VsSearchControl(vsWindowSearchHost, handler, settings);
        }
Esempio n. 20
0
 public ISearchControl Create(FrameworkElement host, ISearchHandler handler, SearchControlSettings settings)
 {
     return(new TestSearchControl(handler, settings));
 }
Esempio n. 21
0
 public TestSearchControl(ISearchHandler handler, SearchControlSettings settings) {
     Category = settings.SearchCategory;
     _settings = settings;
     _handler = handler;
 }
Esempio n. 22
0
 /// <summary>
 ///
 /// </summary>
 public StateSearchController(ISearchHandler <StateFindAllMsgToApi, List <StateResponse> > searchStateParam) : base()
 {
     searchState = searchStateParam;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TeamsInvokeActivityHandler"/> class.
 /// </summary>
 /// <param name="searchHandler">The search handler.</param>
 public TeamsInvokeActivityHandler(ISearchHandler searchHandler)
 {
     this.searchHandler = searchHandler;
 }
 public StateFindAllToApi(ISearchHandler <StateFindAllNoPageMsg, List <State> > searchStateParam)
 {
     searchState = searchStateParam;
 }
 public ParallelSearchingRegFiles(ISearchHandler handler)
 {
     SearchHandler = handler;
 }
Esempio n. 26
0
 public ISearchControl Create(FrameworkElement host, ISearchHandler handler, SearchControlSettings settings) {
     return new TestSearchControl(handler, settings);
 }