private void xAgentStatusBtn_Click(object sender, RoutedEventArgs e) { if (SelectedAgent == null) { return; } switch (SelectedAgent.Status) { case Agent.eStatus.FailedToStart: case Agent.eStatus.NotStarted: Reporter.ToStatus(eStatusMsgKey.StartAgent, null, SelectedAgent.Name, ""); if (SelectedAgent.Status == Agent.eStatus.Running) { SelectedAgent.Close(); } SelectedAgent.SolutionFolder = WorkSpace.UserProfile.Solution.Folder; SelectedAgent.ProjEnvironment = null; // App.AutomateTabEnvironment; SelectedAgent.BusinessFlow = null; //App.BusinessFlow; ; SelectedAgent.DSList = null; //WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems<DataSourceBase>(); SelectedAgent.StartDriver(); Reporter.HideStatusMessage(); //If there is errorMessageFromDriver is populated then do not wait. if (SelectedAgent.Driver != null && String.IsNullOrEmpty(SelectedAgent.Driver.ErrorMessageFromDriver)) { SelectedAgent.WaitForAgentToBeReady(); } Agent.eStatus Status = SelectedAgent.Status; if (Status != Agent.eStatus.Running && Status != Agent.eStatus.Starting) { string errorMessage = SelectedAgent.Driver.ErrorMessageFromDriver; if (String.IsNullOrEmpty(errorMessage)) { errorMessage = "Failed to Connect the agent"; } Reporter.ToStatus(eStatusMsgKey.StartAgentFailed, null, errorMessage); } SelectedAgent.Tag = "Started with Agent Control"; AgentStartedEvent(); break; case Agent.eStatus.Starting: SelectedAgent.Driver.cancelAgentLoading = true; break; case Agent.eStatus.Completed: case Agent.eStatus.Ready: case Agent.eStatus.Running: SelectedAgent.Close(); break; } //SelectedAgent = SelectedAgent; //OnPropertyChanged(nameof(SelectedAgent)); UpdateBinding(); OnPropertyChanged(nameof(AgentIsRunning)); }
// player controls private void MapPlayer(SelectedAgent agent, PlayerController controller) { controller.InitControls(agent.right, agent.left, agent.up, agent.down, agent.dash); }