Beispiel #1
0
        //----------------------------------------------------------------------------------------
        private void m_lnkSubTypes_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            m_menuSousTypes.Items.Clear();
            CTypeProjet           typeProjet        = m_selectTypeProjet.ElementSelectionne as CTypeProjet;
            HashSet <CTypeProjet> typeProjetsInMenu = new HashSet <CTypeProjet>();

            if (typeProjet != null)
            {
                if (m_gestionnaireModeEdition.ModeEdition)
                {
                    foreach (CRelationTypeProjet_SousTypeProjet rel in typeProjet.RelationsSousTypesProjetsPossibles)
                    {
                        ToolStripMenuItem itemSousType = new ToolStripMenuItem(rel.SousTypeProjet.Libelle);
                        itemSousType.Tag     = rel.SousTypeProjet;
                        itemSousType.Click  += new EventHandler(itemSousType_Click);
                        itemSousType.Checked = Projet.IsDefiniPar(rel.SousTypeProjet);
                        m_menuSousTypes.Items.Add(itemSousType);
                        typeProjetsInMenu.Add(rel.SousTypeProjet);
                    }
                }
                foreach (CProjet_SousType st in Projet.RelationsSousTypes)
                {
                    if (!typeProjetsInMenu.Contains(st.SousType))
                    {
                        ToolStripMenuItem itemSousType = new ToolStripMenuItem(st.SousType.Libelle);
                        itemSousType.Tag     = st.SousType;
                        itemSousType.Click  += new EventHandler(itemSousType_Click);
                        itemSousType.Checked = Projet.IsDefiniPar(st.SousType);
                        m_menuSousTypes.Items.Add(itemSousType);
                        typeProjetsInMenu.Add(st.SousType);
                        if (m_gestionnaireModeEdition.ModeEdition)
                        {
                            itemSousType.BackColor = Color.Red;
                        }
                        itemSousType.Enabled = m_gestionnaireModeEdition.ModeEdition;
                    }
                }
            }
            if (m_menuSousTypes.Items.Count > 0)
            {
                m_menuSousTypes.Show(m_lnkSubTypes, new Point(0, m_lnkSubTypes.Height));
            }
        }