Beispiel #1
0
        static void Main(string[] args)
        {
            var constants     = new AppConstants();
            var historyWorker = new HistoryWorker();
            var logger        = new Logger();

            using (var br = new Browser(constants))
            {
                var count      = 0;
                var kinoManiac = new KinoManiac(constants, br);

                var queueWorker = new QueueWorker(historyWorker, constants, br, logger, kinoManiac);
                while (true)
                {
                    count++;
                    queueWorker.ProccessNextItem();
                    if (constants.LimitCount != 0 && count == constants.LimitCount)
                    {
                        Console.WriteLine("Все, план на сегодня выполнен!");
                        Console.ReadLine();
                        break;
                    }
                }
            }
        }
Beispiel #2
0
 public QueueWorker(HistoryWorker historyWorker, AppConstants appConstants, Browser browser, Logger logger, KinoManiac kinoManiac)
 {
     _historyWorker = historyWorker;
     _appConstants  = appConstants;
     _browser       = browser;
     _logger        = logger;
     _kinoManiac    = kinoManiac;
 }
Beispiel #3
0
        public Browser(AppConstants appConstants)
        {
            _appConstants = appConstants;
            var option = new ChromeOptions();

            option.AddArgument(string.Format("load-extension={0}\\AdBlock", AppDomain.CurrentDomain.BaseDirectory));
            _chrome = new ChromeDriver(option);
            _chrome.Manage().Window.Maximize();
            if (_chrome.WindowHandles.Count > 1)
            {
                var newTabInstance = _chrome.WindowHandles[_chrome.WindowHandles.Count - 1];
                // switch our WebDriver to the new tab's window handle
                _chrome.SwitchTo().Window(newTabInstance);
                var t = _chrome.ExecuteJavaScript <object>("window.close();", null);
                _chrome.SwitchTo().Window(_chrome.WindowHandles[0]);
            }
        }
Beispiel #4
0
 public KinoManiac(AppConstants appConstants, Browser browser)
 {
     _appConstants = appConstants;
     _browser      = browser;
 }