Пример #1
0
        /// <summary>
        /// Gets all results for this project from Boinc.
        /// </summary>
        /// <returns>All results for this project.</returns>
        public IEnumerable <Result> GetResults(bool onlyActive = true)
        {
            List <Result> results = new List <Result>();

            foreach (Result result in client.GetResults())
            {
                if (result.ProjectUrl.Equals(this.MasterUrl))
                {
                    results.Add(result);
                }
            }

            return(results);
        }
Пример #2
0
        /// <summary>
        /// Queries new information from Boinc and raises events if applicatble.
        /// <remarks>
        /// No events are raised on the first call of this method or when ClearState() was called before.
        /// </remarks>
        /// </summary>
        public void RefreshState()
        {
            //Gather new information.
            Project[] projects = client.GetProjects();
            Result[]  results  = client.GetResults();

            Project[] lastProjects = this.lastProjects;
            Result[]  lastResults  = this.lastResults;

            //Save the new information as state.
            this.lastProjects = projects;
            this.lastResults  = results;

            //If we have a known state, compare.
            if (lastProjects != null)
            {
                CompareArrays(lastProjects, projects, ProjectRemoved, ProjectAdded, CompareProject);
            }
            if (lastResults != null)
            {
                CompareArrays(lastResults, results, TaskRemoved, TaskAdded, CompareResult);
                CompareResults(lastResults, results);
            }
        }