Example #1
0
        private void m_menuDeleteAndMoveToTop_Click(object sender, EventArgs e)
        {
            TreeNode node = m_arbre.SelectedNode;

            if (node == null)
            {
                return;
            }
            TreeNode nodeParent = node.Parent;

            if (nodeParent == null)
            {
                return;
            }
            IPeriodeActivationMultiple periodeParente  = nodeParent.Tag as IPeriodeActivationMultiple;
            IPeriodeActivationMultiple periodeToDelete = node.Tag as IPeriodeActivationMultiple;

            foreach (IPeriodeActivation periode in periodeToDelete.Periodes)
            {
                periodeParente.AddPeriode(periode);
                TreeNode newNode = CreateNodeAndChilds(periode);
                nodeParent.Nodes.Add(newNode);
            }
            nodeParent.Nodes.Remove(node);
        }
Example #2
0
        //--------------------------------------------------------
        private TreeNode CreateNodeAndChilds(IPeriodeActivation periode)
        {
            TreeNode node = new TreeNode();

            FillNode(node, periode);
            IPeriodeActivationMultiple pm = periode as IPeriodeActivationMultiple;

            if (pm != null)
            {
                foreach (IPeriodeActivation child in pm.Periodes)
                {
                    TreeNode newNode = CreateNodeAndChilds(child);
                    node.Nodes.Add(newNode);
                }
            }
            return(node);
        }
Example #3
0
        //--------------------------------------------------------
        void  menuInsert_Click(object sender, EventArgs e)
        {
            CMenuPeriode menu = sender as CMenuPeriode;

            if (menu == null)
            {
                return;
            }

            TreeNode node = m_arbre.SelectedNode;

            if (node == null)
            {
                return;
            }
            IPeriodeActivation         periodeSel = node.Tag as IPeriodeActivation;
            IPeriodeActivationMultiple periode    = Activator.CreateInstance(menu.TypePeriode, new object[0]) as IPeriodeActivationMultiple;

            if (node.Parent == null)
            {
                m_periodeRacine = periode;
                periode.AddPeriode(periodeSel);
                m_arbre.Nodes.Clear();
                TreeNode newNode = CreateNodeAndChilds(periode);
                m_arbre.Nodes.Add(newNode);
                newNode.Expand();
                newNode.EnsureVisible();
                m_arbre.SelectedNode = newNode;
            }
            else
            {
                TreeNode nodeParent = node.Parent;
                IPeriodeActivationMultiple periodeParente = nodeParent.Tag as IPeriodeActivationMultiple;
                nodeParent.Nodes.Remove(node);
                periodeParente.RemovePeriode(periodeSel);
                periode.AddPeriode(periodeSel);
                TreeNode newNode = CreateNodeAndChilds(periode);
                nodeParent.Nodes.Add(newNode);
                newNode.EnsureVisible();
                m_arbre.SelectedNode = newNode;
            }
        }
Example #4
0
        private void m_menuDeleteElement_Click(object sender, EventArgs e)
        {
            TreeNode node = m_arbre.SelectedNode;

            if (node == null)
            {
                return;
            }
            if (node.Parent == null)
            {
                m_arbre.Nodes.Remove(node);
                m_periodeRacine = null;
            }
            else
            {
                IPeriodeActivation         periode        = node.Tag as IPeriodeActivation;
                IPeriodeActivationMultiple periodeParente = node.Parent.Tag as IPeriodeActivationMultiple;
                periodeParente.RemovePeriode(periode);
                node.Parent.Nodes.Remove(node);
            }
        }