/// <summary>
        /// Updates the all projects cached query results when a project is added
        /// </summary>
        void AllProjectsOnProjectAdded(object sender, ProjectAddedEventArgs e)
        {
            QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.AllProjectsCacheItem);

            if (cachedQuery != null)
            {
                // add the added item to the cached query results
                List <Data.Project> allProjects  = (List <Data.Project>)cachedQuery.Value;
                Data.Project        addedProject = _appInfo.GcContext.Projects.FirstOrDefault(p => p.ProjectID == e.NewProject.ProjectId);
                if (addedProject != null)
                {
                    allProjects.Add(addedProject);
                    // sort the query results according to the sort column
                    allProjects = SortList(allProjects);
                    _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.AllProjectsCacheItem, allProjects);
                }
            }
        }
Beispiel #2
0
 void OnProjectAdded(object sender, ProjectAddedEventArgs e)
 {
     RefreshProjectsAfterModification();
 }
        void OnProjectAdded(object sender, ProjectAddedEventArgs e)
        {
            var viewModel = new ProjectViewModel(e.NewProject, _projectData, _taskData);

            this.ChildProjects.Add(viewModel);
        }