/// <summary>
        /// Attempt to retrieve a snapshot from the remote server.
        /// </summary>
        private void RetrieveSnapshot()
        {
            // Retrieve the snapshot
            ServerUpdateArgs args;

            try
            {
                CruiseServerSnapshot snapshot = null;
                try
                {
                    snapshot = client.GetCruiseServerSnapshot();
                }
                catch (NotImplementedException)
                {
                    // This is an older style server, try fudging the snapshot
                    snapshot = new CruiseServerSnapshot
                    {
                        ProjectStatuses = client.GetProjectStatus()
                    };
                }
                args = new ServerUpdateArgs(snapshot);
            }
            catch (Exception error)
            {
                args = new ServerUpdateArgs(error);
            }

            // Fire the update
            if (Update != null)
            {
                Update(this, args);
            }
        }
        /// <summary>
        /// Gets the list of projects.
        /// </summary>
        /// <returns>The available projects on the server.</returns>
        public CCTrayProject[] GetProjectList()
        {
            ProjectStatus[] statuses = manager.GetProjectStatus();
            CCTrayProject[] projects = new CCTrayProject[statuses.Length];

            for (int i = 0; i < statuses.Length; i++)
            {
                ProjectStatus status = statuses[i];
                projects[i] = new CCTrayProject(this.configuration, status.Name);
            }

            return(projects);
        }
예제 #3
0
        /// <summary>
        /// Caches the project names.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="client">The client.</param>
        private void CacheProjectNames(ILogger logger, CruiseServerClientBase client)
        {
            logger.Info("Retrieving projects from server");
            this.cachedProjects.Clear();
            var serverProjects = client.GetProjectStatus();

            foreach (var serverProject in serverProjects)
            {
                this.cachedProjects.Add(serverProject.Name);
            }

            logger.Debug(this.cachedProjects.Count + " project(s) retrieved");
        }
        /// <summary>
        /// Caches the project names.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="client">The client.</param>
        private void CacheProjectNames(ILogger logger, CruiseServerClientBase client)
        {
            logger.Info("Retrieving projects from server");
            this.cachedProjects.Clear();
            var serverProjects = client.GetProjectStatus();
            foreach (var serverProject in serverProjects)
            {
                this.cachedProjects.Add(serverProject.Name);
            }

            logger.Debug(this.cachedProjects.Count + " project(s) retrieved");
        }
예제 #5
0
 public IEnumerable <ProjectStatus> GetProjectsStatus()
 {
     return(_client.GetProjectStatus());
     //var ps = _farmsvc.GetProjectStatusListAndCaptureExceptions(_location, null);
     //return ps.StatusAndServerList.Select(sos => sos.ProjectStatus);
 }