Esempio n. 1
0
        public static async Task Main(string[] args)
        {
            try
            {
                var cancellationTokenSource = new CancellationTokenSource();
                var cancellationToken       = cancellationTokenSource.Token;
                var dbManager       = new DBManager();
                var googleApiHelper = new GoogleApiHelper();
                var crawlerManager  = new CrawlerManager(dbManager, cancellationToken);

                using (WebApp.Start(
                           new StartOptions("http://*:80"),
                           app =>
                {
                    app.
                    DisableCache().
                    UseExceptionHandler().
                    UseWebApi(
                        new Dictionary <Type, Func <object> >
                    {
                        [typeof(SearchManager)] = () => new SearchManager(dbManager, googleApiHelper),
                        [typeof(UserProfileManager)] = () => new UserProfileManager(dbManager, googleApiHelper)
                    }).
                    ServeStaticFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "frontEnd"));
                }))
                {
                    Console.WriteLine("WebServer Started. Press Any Key To Close The Program...");
                    Console.ReadKey();
                }

                cancellationTokenSource.Cancel();
            }
            catch (Exception e)
            {
                ExceptionHandler.Handle(e);
                Environment.Exit(1);
            }
        }
Esempio n. 2
0
 public UserProfileManager(DBManager dbManager, GoogleApiHelper googleApiHelper)
 {
     _dbManager     = dbManager;
     _searchManager = new SearchManager(_dbManager, googleApiHelper);
 }
Esempio n. 3
0
 public SearchManager(DBManager dbManager, GoogleApiHelper googleApiHelper)
 {
     _dbManager       = dbManager;
     _googleApiHelper = googleApiHelper;
 }