Beispiel #1
0
 public void ResetAgentStatus(Agent.eStatus status)
 {
     if (status == Agent.eStatus.FailedToStart)
     {
         IsFailedToStart = false;
     }
 }
Beispiel #2
0
        private void StartAgentButton_Click(object sender, RoutedEventArgs e)
        {
            ApplicationAgent AG = (ApplicationAgent)((Button)sender).DataContext;

            try
            {
                StartAppAgent(AG);

                //If there is errorMessageFromDriver is populated then do not wait.
                if (((Agent)AG.Agent).Driver != null && String.IsNullOrEmpty(((Agent)AG.Agent).Driver.ErrorMessageFromDriver))
                {
                    ((Agent)AG.Agent).WaitForAgentToBeReady();
                }
                Agent.eStatus Status = ((Agent)AG.Agent).Status;
                if (Status != Agent.eStatus.Running && Status != Agent.eStatus.Starting)
                {
                    string errorMessage = ((Agent)AG.Agent).Driver.ErrorMessageFromDriver;
                    if (String.IsNullOrEmpty(errorMessage))
                    {
                        errorMessage = "Failed to Connect the agent";
                    }

                    Reporter.ToStatus(eStatusMsgKey.StartAgentFailed, null, errorMessage);
                }
            }
            catch (Exception ex)
            {
                Reporter.ToStatus(eStatusMsgKey.StartAgentFailed, null, ex.Message);
            }
        }
        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));
        }