Ejemplo n.º 1
0
        private void Initialize(IRegistrationService registrationService, IWebDriverProviderService webDriverProviderService)
        {
            if (!registrationService.IsCurrentMachineRegistrated())
            {
                MessageBox.Show("Your machine has not been registered.", "Registration Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Environment.Exit(0);
            }

            _plemionaToolLocalData = _plemionaToolLocalDataService.Load();

            _webDriver = webDriverProviderService.CreateWebDriver();

            _windowsPositionService.SetMainFormWindow(this);

            var browserWindow = _webDriver.Manage().Window;

            _windowsPositionService.SetBrowserWindow(browserWindow);

            GridTroopsTemplates.LostFocus += (s, e) => GridTroopsTemplates.ClearSelection();
            GridTroopsOrders.LostFocus    += (s, e) => GridTroopsOrders.ClearSelection();

            _plemionaFeaturesDiagnosticsService       = new PlemionaFeaturesDiagnosticsService(TbxDiagnostics);
            _plemionaFeaturesDiagnostics.OnStepDelay += _plemionaFeaturesDiagnosticsService.LogStepDelay;
            //_plemionaFeaturesDiagnostics.OnStepStart += _plemionaFeaturesDiagnosticsService.LogStepStart;
            _plemionaFeaturesDiagnostics.OnStepEnd      += _plemionaFeaturesDiagnosticsService.LogStepEnd;
            _plemionaFeaturesDiagnostics.OnFeatureStart += _plemionaFeaturesDiagnosticsService.LogFeatureStart;
            _plemionaFeaturesDiagnostics.OnFeatureEnd   += _plemionaFeaturesDiagnosticsService.LogFeatureEnd;

            //BackColor = Color.FromArgb(205, 189, 155);
            //TabTroopsTemplates.BackColor = Color.FromArgb(205, 189, 155);
            //TabTroopsOrders.BackColor = Color.FromArgb(205, 189, 155);
        }
Ejemplo n.º 2
0
 public WebDriverBaseMethodsService(
     IWebDriverProviderService webDriverProviderService,
     ITypingDelayService typingDelayService)
 {
     _webDriverProviderService = webDriverProviderService;
     _typingDelayService       = typingDelayService;
 }
Ejemplo n.º 3
0
 public ComplexStepBase(
     IWebDriverProviderService webDriverProviderService,
     IPlemionaMetadataProviderService plemionaMetadataProviderService,
     IWebDriverBaseMethodsService webDriverBaseMethodsService,
     IStepDelayService stepDelayService,
     IBotCheckDetectService botCheckDetectService)
     : base(webDriverBaseMethodsService, stepDelayService, botCheckDetectService)
 {
     _webDriverProviderService        = webDriverProviderService;
     _plemionaMetadataProviderService = plemionaMetadataProviderService;
 }
Ejemplo n.º 4
0
 public ClickWorldButtonStep(
     IWebDriverProviderService webDriverProviderService,
     IPlemionaMetadataProviderService plemionaMetadataProviderService,
     IWebDriverBaseMethodsService webDriverBaseMethodsService,
     IStepDelayService stepDelayService,
     IBotCheckDetectService botCheckDetectService
     ) : base(
         webDriverProviderService,
         plemionaMetadataProviderService,
         webDriverBaseMethodsService,
         stepDelayService,
         botCheckDetectService)
 {
 }
Ejemplo n.º 5
0
 public StepProviderService(
     IWebDriverProviderService webDriverProviderService,
     IPlemionaMetadataProviderService plemionaMetadataProviderService,
     IWebDriverBaseMethodsService webDriverBaseMethodsService,
     IStepDelayService stepDelayService,
     IBotCheckDetectService botCheckDetectService)
 {
     LoadSteps(
         webDriverProviderService,
         plemionaMetadataProviderService,
         webDriverBaseMethodsService,
         stepDelayService,
         botCheckDetectService);
 }
 public LoadPlemionaWebsiteStep(
     IWebDriverProviderService webDriverProviderService,
     IPlemionaMetadataProviderService plemionaMetadataProviderService,
     IWebDriverBaseMethodsService webDriverBaseMethodsService,
     IStepDelayService stepDelayService,
     IBotCheckDetectService botCheckDetectService
     ) : base(
         webDriverProviderService,
         plemionaMetadataProviderService,
         webDriverBaseMethodsService,
         stepDelayService,
         botCheckDetectService)
 {
 }
Ejemplo n.º 7
0
 public GetBuildingLevelStep(
     IWebDriverProviderService webDriverProviderService,
     IPlemionaMetadataProviderService plemionaMetadataProviderService,
     IWebDriverBaseMethodsService webDriverBaseMethodsService,
     IStepDelayService stepDelayService,
     IBotCheckDetectService botCheckDetectService
     ) : base(
         webDriverProviderService,
         plemionaMetadataProviderService,
         webDriverBaseMethodsService,
         stepDelayService,
         botCheckDetectService)
 {
 }
Ejemplo n.º 8
0
        public FrmMain(
            IPlemionaFeaturesDiagnostics plemionaFeaturesDiagnostics,
            IWebDriverProviderService webDriverProviderService,
            IStepDelayService stepDelayService,
            IWindowsPositionService windowsPositionService,
            IPlemionaSettingsInitializationService plemionaSettingsInitializationService,
            IRegistrationService registrationService,
            PlemionaSettings plemionaSettings
            )
        {
            InitializeComponent();

            _plemionaSettings                      = plemionaSettings;
            _plemionaFeaturesDiagnostics           = plemionaFeaturesDiagnostics;
            _webDriverProviderService              = webDriverProviderService;
            _stepDelayService                      = stepDelayService;
            _windowsPositionService                = windowsPositionService;
            _plemionaSettingsInitializationService = plemionaSettingsInitializationService;

            Initialize(registrationService, webDriverProviderService);
        }
Ejemplo n.º 9
0
        private void LoadSteps(
            IWebDriverProviderService webDriverProviderService,
            IPlemionaMetadataProviderService plemionaMetadataProviderService,
            IWebDriverBaseMethodsService webDriverBaseMethodsService,
            IStepDelayService stepDelayService,
            IBotCheckDetectService botCheckDetectService)
        {
            var executingAssembly = Assembly.GetExecutingAssembly();

            var types = executingAssembly.GetTypes();

            var stepTypes = types.Where(t => t.GetInterfaces().Contains(typeof(IStep)));

            var nonAbstractStepTypes = stepTypes.Where(st => !st.IsAbstract);

            foreach (var stepType in nonAbstractStepTypes)
            {
                object[] stepArguments = null;

                if (stepType.IsSubclassOf(typeof(ComplexStepBase)))
                {
                    stepArguments = new object[] { webDriverProviderService, plemionaMetadataProviderService, webDriverBaseMethodsService, stepDelayService, botCheckDetectService };
                }
                else if (stepType.IsSubclassOf(typeof(StandardStepBase)))
                {
                    stepArguments = new object[] { webDriverBaseMethodsService, stepDelayService, botCheckDetectService };
                }
                else
                {
                    throw new Exception($"Step \"{stepType.Name}\" does not inherit any of known step base classes.");
                }

                var stepInstance = (IStep)Activator.CreateInstance(stepType, stepArguments);

                string stepName = GetStepName(stepType);

                _steps.Add(stepName, stepInstance);
            }
        }
 public PlemionaMetadataProviderService(IWebDriverProviderService webDriverProviderService)
 {
     _webDriverProviderService = webDriverProviderService;
 }