Exemple #1
0
        //-----------------------------------------------
        private void ShowLayers()
        {
            int nZOrder = 0;

            foreach (CRuntimeConfigMapView runtime in GetRuntimesOrdered())
            {
                CMapLayer layer = m_mapDatabase.GetLayer(runtime.Generator.LayerId);
                if (runtime.IsVisible)
                {
                    if (!runtime.IsCalculated)
                    {
                        if (layer != null)
                        {
                            layer.ClearItems();
                        }
                        using (sc2i.win32.common.CWaitCursor waiter = new sc2i.win32.common.CWaitCursor())
                        {
                            runtime.Generator.ElementEdite = m_objetSource;
                            runtime.Generator.FillMapDatabase(m_objetSource, m_mapDatabase, runtime.Generator.ContexteDonnee);
                            runtime.IsCalculated = true;
                            if (runtime.Generator.ExecuteurAction != m_executeActionDelegate)
                            {
                                runtime.Generator.ExecuteurAction = m_executeActionDelegate;
                            }
                        }
                    }
                    if (layer != null)
                    {
                        layer.IsVisible = true;
                    }
                }
                else if (layer != null)
                {
                    layer.IsVisible = false;
                }
                if (layer != null)
                {
                    layer.ZOrder = nZOrder++;
                }
            }
            foreach (CGPSCarte carte in m_listeCartes)
            {
                carte.GenereItems(m_mapDatabase);
            }
            SetMapDatabase(m_mapDatabase);
        }
        //-----------------------------------------
        private void FillArbre()
        {
            using (CWaitCursor curseur = new CWaitCursor())
            {
                m_arbre.BeginUpdate();
                m_arbre.Nodes.Clear();

                System.ComponentModel.Design.ITypeDiscoveryService service =
                    (System.ComponentModel.Design.ITypeDiscoveryService)
                    m_provider.GetService(
                        typeof(System.ComponentModel.Design.ITypeDiscoveryService)
                        );

                if (service != null)
                {
                    System.Collections.ICollection coll             = service.GetTypes(typeof(object), true);
                    Dictionary <string, TreeNode>  namespacesToNode = new Dictionary <string, TreeNode>();
                    List <Type> lstTypes = new List <Type>();
                    foreach (Type tp in service.GetTypes(typeof(object), true))
                    {
                        lstTypes.Add(tp);
                    }
                    lstTypes.Sort((x, y) => x.FullName.CompareTo(y.FullName));
                    string strSearch = m_txtSearch.Text.Trim().ToUpper();
                    foreach (Type tp in lstTypes)
                    {
                        if (tp.Namespace != null)
                        {
                            if (strSearch.Length == 0 || tp.FullName.ToUpper().Contains(strSearch))
                            {
                                TreeNode nodeParent = GetNodeNamespace(null, tp.Namespace, namespacesToNode);
                                if (nodeParent != null)
                                {
                                    TreeNode nodeType = new TreeNode(tp.Name);
                                    nodeType.Tag = tp;
                                    nodeParent.Nodes.Add(nodeType);
                                }
                            }
                        }
                    }
                    m_arbre.EndUpdate();
                    return;
                }

                List <Assembly> lstAss = new List <Assembly>();
                foreach (Assembly ass in CGestionnaireAssemblies.GetAssemblies())
                {
                    lstAss.Add(ass);
                }
                lstAss.Sort((x, y) => x.FullName.CompareTo(y.FullName));
                HashSet <string> lstFaits = new HashSet <string>();
                foreach (Assembly ass in CGestionnaireAssemblies.GetAssemblies())
                {
                    if (!lstFaits.Contains(ass.FullName))
                    {
                        string[] strParts = ass.FullName.Split(',');
                        TreeNode node     = new TreeNode(strParts[0]);
                        node.Tag = ass;
                        node.Nodes.Add(new TreeNode(""));
                        m_arbre.Nodes.Add(node);
                        lstFaits.Add(ass.FullName);
                    }
                }
                m_arbre.EndUpdate();
            }
        }