Пример #1
0
        static async Task <int> Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Exactly 2 parameters are required (KEYWORDS and URL)");
                Console.WriteLine("Example: ConsoleApp \"e-settlements\" www.sympli.com");
                return(-1);
            }

            var descriptors = new SearchEngineFactory(new Cache.Factory(), new Client()).Engines;

            Console.WriteLine("Found Search Engines:");
            foreach (var d in descriptors)
            {
                Console.WriteLine(d);
            }

            var descriptor = descriptors.First(engine => engine.Available);

            Console.WriteLine($"Using First Available ({descriptor.Name})");
            var engine = descriptor.Get();
            var result = await engine.SearchAsync(args[0], args[1]);

            Console.WriteLine($"The URL {args[1]} has been found in the following results:");
            Console.WriteLine(result);
            return(0);
        }
Пример #2
0
        private void Init()
        {
            var descriptors = new SearchEngineFactory(new Cache.Factory(), new Client()).Engines;

            EngineCombo.Items.AddRange(descriptors);
            var descriptor = descriptors.First(engine => engine.Available);

            EngineCombo.SelectedItem = descriptor;
        }