Beispiel #1
0
        /// <summary>
        /// Obter todos as projetos e camadas disponíveis para o usuário.
        /// </summary>
        /// <param name="user">Usario registro no COMOS.</param>
        /// <returns>Todos projetos e Camadas.</returns>
        public List <IBRServiceContracts.CProject> GetProjectsAndLayers(string user)
        {
            try
            {
                if (m_ComosSession == null)
                {
                    return(null);
                }

                m_ComosSession.SetCurrentUser(user);
                List <IBRServiceContracts.CProject> cProjects = new List <IBRServiceContracts.CProject>();
                foreach (var project in m_ComosSession.GetProjects())
                {
                    if (project.Name.StartsWith("@"))
                    {
                        continue;
                    }

                    IBRServiceContracts.CProject cProject = new IBRServiceContracts.CProject()
                    {
                        Description = project.Description, Name = project.Name
                    };
                    List <IBRServiceContracts.CLayer> layers = new List <IBRServiceContracts.CLayer>();
                    foreach (var layer in m_ComosSession.GetWorkingOverlays(project))
                    {
                        IBRServiceContracts.CLayer cLayer = new IBRServiceContracts.CLayer()
                        {
                            Description = layer.Description, ID = layer.ID(), Name = layer.Name,
                        };
                        cLayer.WorkingLayers = GetWorkingLayers(layer);
                        layers.Add(cLayer);
                    }
                    cProject.WorkingLayers = layers;
                    cProjects.Add(cProject);
                }
                return(cProjects);
            }
            catch (Exception ex)
            {
                Log.WriteLog(ex.Message + ":GetProjectsAndLayers", System.Diagnostics.EventLogEntryType.Warning);
                System.Diagnostics.Debug.Assert(false);
            }
            return(null);
        }