public IActionResult Index([FromServices] AutomationService automationService) { return(View(new HomeIndexViewModel { DeviceById = automationService.DeviceById, })); }
public MainViewModel(IEventAggregator eventAggregator) { _eventAggregator = eventAggregator; _eventAggregator.GetEvent <ScriptInfoAddedEvent>().Subscribe(OnScriptInfoAdded); _eventAggregator.GetEvent <ScriptInfoChangedEvent>().Subscribe((scriptInfo) => ScriptInfo = scriptInfo); _eventAggregator.GetEvent <SettingsChangedEvent>().Subscribe((settings) => LoadSettings(settings)); // Disable global hotkeys while user is changing hotkey _eventAggregator.GetEvent <SettingsWindowOpenEvent>().Subscribe( () => _winService.GlobalKeyDown -= OnGlobalHotkeyDown); _eventAggregator.GetEvent <SettingsWindowClosedEvent>().Subscribe( () => _winService.GlobalKeyDown += OnGlobalHotkeyDown); _settingsAccess = new SettingsAccess(); _scriptAccess = new ScriptAccess(); _dialogService = new DialogService(); _scriptService = new ScriptService(); _winService = new WinService(); _winService.GlobalKeyDown += OnGlobalHotkeyDown; _winService.GlobalKeyUp += OnGlobalHotkeyUp; _automationService = new AutomationService(); _automationService.RemoveFileModificationDetectedDialogOnCreated(); _settings = _settingsAccess.LoadSettings(); FormViewModel = new ScriptInfoViewModel(eventAggregator, SaveScriptInfoAction); LoadCommands(); LoadSettings(_settings, firstTime: true); ScriptNames = _scriptAccess.GetScriptNames(); }
private void StartFlowRegister(Guid flowId) { if (!Flows.ContainsKey(flowId)) { return; } AutomationService.StartTimer(); _flowRegisterService.StartFlowRegister(Flows[flowId]); }
//[Test] //Finding dialog doesn't work on build servers when running from bamboo public void ModifyMasterDocumentExternally() { string scriptPath = Path.Combine(GetScriptsDirectoryPath(), "EditSaveCloseAndReopen" + ".py"); //Do the normal test stuff, but don't close the application SetupAppSettings(); int port; LaunchTestApplication(GetAppExePath(), out port); Connect(port); SetupScript(scriptPath); ProcessScript(scriptPath); //A timeline named "EditAndSave.timeline" should now be opened string markerName = ExecuteStatementSafe("docNew.Timeline.Markers[0].Name"); string docPath = ExecuteStatementSafe("docNew.Uri.AbsolutePath"); //Trim the quotes that are automatically inserted to surround the path docPath = docPath.TrimStart(new char[] { '\'', '\"' }); docPath = docPath.TrimEnd(new char[] { '\'', '\"' }); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(docPath); XmlNodeList nodes = xmlDoc.GetElementsByTagName("marker"); Assert.GreaterOrEqual(nodes.Count, 1, "Could not find marker node"); nodes[0].Attributes["name"].Value = "renamed externally"; //This will cause a popup to reload the document xmlDoc.Save(docPath); //No guaranteed way to make sure the file watcher event has triggered and the reference file has been reloaded. //May need to increase this delay for other/slower computers Thread.Sleep(1500); Assert.True(AutomationService.ClickButton(Consts.ReloadFileWindowTitle), "Verify reload file dialog found"); //The docNew reference is old now that the doc is reloaded, so don't use that variable string markerNameNew = ExecuteStatementSafe("editor.ActiveDocument.Timeline.Markers[0].Name"); markerNameNew = markerNameNew.TrimStart(new char[] { '\'', '\"' }); markerNameNew = markerNameNew.TrimEnd(new char[] { '\'', '\"' }); Assert.AreEqual("renamed externally", markerNameNew, "Verify marker name was reloaded automatically"); //Do the normal cleanup CloseApplication(); VerifyApplicationClosed(); }
protected override void CloseApplication() { //Before closing app, close all documents, discarding any unsaved changes AutomationService.ExecuteStatement("atfFile.DiscardAll()"); //Not all apps have documents, so an error from the DiscardAll command is okay (consider checking this on a per app basis) //Assert.True(string.IsNullOrEmpty(result), "Verify no error after discarding documents: " + result); //This will check for error dialogs and if an uncaught exception occurred. //Do this as late as possible, but must be done before closing the app. Assert.False(AutomationService.CheckUnexpectedErrors(), "Verify no unexpected errors have occurred"); try { //The ATF2 command for closing the application string result = AutomationService.ExecuteStatement("atfAppHostService.DoCommand(Command.FileExit)"); Assert.True(string.IsNullOrEmpty(result), "Verify no error when closing application: " + result); } catch (SocketException e) { Console.WriteLine("Socket exception when closing the application: {0}", e.Message); //Might need to kill the process here? } }
public TestController() { Log.Instance = new TestLogger(); // Create root services first. var systemInformationService = new SystemInformationService(); var apiService = new ApiService(); ApiService = new ApiService(); BackupService = new BackupService(); StorageService = new StorageService(); TimerService = new TestTimerService(); DaylightService = new TestDaylightService(); DateTimeService = new TestDateTimeService(); SettingsService = new SettingsService(BackupService, StorageService); ResourceService = new ResourceService(BackupService, StorageService, SettingsService); SchedulerService = new SchedulerService(TimerService, DateTimeService); NotificationService = new NotificationService(DateTimeService, ApiService, SchedulerService, SettingsService, StorageService, ResourceService); SystemEventsService = new SystemEventsService(this, NotificationService, ResourceService); AutomationService = new AutomationService(SystemEventsService, systemInformationService, apiService); ComponentService = new ComponentService(SystemEventsService, systemInformationService, apiService, SettingsService); AreaService = new AreaService(ComponentService, AutomationService, SystemEventsService, systemInformationService, apiService, SettingsService); }
public Resync(IOptions <BeatriceSecurityConfiguration> securityConfiguration, AutomationService automationService) { _apiKey = securityConfiguration.Value.SyncRequestApiKey; _agentUserId = automationService.AgentUserId; // TODO: }
public AutomationController(AutomationService automationService) { _service = automationService; }