Ejemplo n.º 1
0
 /// <summary>
 /// Rend dépendant ce widget d'un autre
 /// </summary>
 /// <param name="widget">CritereSelect parent</param>
 public void addParent(CritereSelect widget)
 {
     widget.NewParentValue += (parentValue) => this.maj(parentValue);
     widget.NoParentValue += (parentValue) => this.raz();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Rend dépendant ce widget d'un autre
 /// </summary>
 /// <param name="widget">CritereSelect parent</param>
 public void addParent(CritereSelect widget)
 {
     widget.NewParentValue += (parentValue) => this.maj(parentValue);
     widget.NoParentValue  += (parentValue) => this.raz();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Changement de DB dans le tab 'Filtre manuel'
        /// </summary>
        private void manuelDBcombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            //TODO: il faut annuler le changement de base si elle n'est plus dispo.
            // http://stackoverflow.com/questions/314503/how-to-prevent-cancel-a-comboboxs-value-change-in-c?answertab=votes#tab-top

            DB db = manuelDBcombo.Items[manuelDBcombo.SelectedIndex] as DB;

            // Création des CritereSelect
            CritereSelect widget;
            this.selectPanel.SuspendLayout();
            this.selectPanel.Controls.Clear();
            foreach (DBentity entity in db.listEntities)
            {
                widget = new CritereSelect(entity);
                if (entity.parentID > 0)
                    widget.addParent(this.selectPanel.Controls[db.entities[entity.parentID].nom] as CritereSelect);
                this.selectPanel.Controls.Add(widget);
            }
            this.selectPanel.ResumeLayout();
            this.selectPanel.SuspendLayout(); // Etrange mais çà accélère l'affichage
            foreach (Control control in this.selectPanel.Controls)
                this.selectPanel.SetFlowBreak(control, true);
            this.selectPanel.ResumeLayout();

            // Remplissage
            foreach (CritereSelect cs in this.selectPanel.Controls)
                cs.changeDB(db);
        }
Ejemplo n.º 4
0
        /// <summary>Chargement des différents composants au lancement de la toolbox</summary>
        private void Toolbox_Load(object sender, EventArgs e)
        {
            // Création des CritereSelect
            CritereSelect widget;

            this.selectPanel.SuspendLayout();
            foreach (DBentity entity in DB.entities)
            {
                widget = new CritereSelect(entity);
                if (entity.parent != null)
                {
                    widget.addParent(this.selectPanel.Controls[entity.parent.nom] as CritereSelect);
                }
                this.selectPanel.Controls.Add(widget);
            }
            this.selectPanel.ResumeLayout();
            this.selectPanel.SuspendLayout(); // Etrange mais çà accélère l'affichage
            foreach (Control control in this.selectPanel.Controls)
            {
                this.selectPanel.SetFlowBreak(control, true);
            }
            this.selectPanel.ResumeLayout();

            // Remplissage de la liste des bases d'action disponibles
            foreach (DB db in TrayIcon.dbs.Values)
            {
                if (TrayIcon.activeDBs.Contains(db.name)) // Si la base est active
                {
                    this.addDB(db);
                }

                // Menu admin
                ToolStripMenuItem activeItem = new ToolStripMenuItem("Active");
                activeItem.Checked         = TrayIcon.activeDBs.Contains(db.name);
                activeItem.CheckOnClick    = true;
                activeItem.CheckedChanged += new EventHandler(this.changeActiveDBs);

                this.adminItem.DropDownItems.Add(new ToolStripMenuItem(db.name, TaskLeader.Properties.Resources.database, new ToolStripMenuItem[] {
                    activeItem,
                    new ToolStripMenuItem("Valeurs par défaut", TaskLeader.Properties.Resources.bullets, this.defaultValuesToolStripMenuItem_Click),
                }));
            }

            this.manuelDBcombo.Text = TrayIcon.defaultDB.name; // ATTENTION: déclenche la mise à jour de toutes les CritereSelect!!
            TrayIcon.activeDBs.CollectionChanged += new NotifyCollectionChangedEventHandler(activeDBs_CollectionChanged);

            // -------------------
            // Tab 'recherche'
            // -------------------
            this.searchPanel.Controls.Add(this.dbSelect);

            // -------
            // Grille
            // -------
            this.data.Dock = DockStyle.Fill;
            this.mainTableLayout.Controls.Add(this.data, 0, 2);
            this.mainTableLayout.SetColumnSpan(this.data, 4);

            // ---------
            // TagsPanel
            // ---------
            TrayIcon.displayedFilters.CollectionChanged += new NotifyCollectionChangedEventHandler(displayedFilters_CollectionChanged);

            this.tagsPanel.Controls.AddRange(
                TrayIcon.displayedFilters.
                Select <Filtre, Etiquette>(f => new Etiquette(f)).
                ToArray <Etiquette>()
                );
        }
Ejemplo n.º 5
0
        /// <summary>Chargement des différents composants au lancement de la toolbox</summary>
        private void Toolbox_Load(object sender, EventArgs e)
        {
            // Création des CritereSelect
            CritereSelect widget;
            this.selectPanel.SuspendLayout();
            foreach (DBentity entity in DB.entities)
            {
                widget = new CritereSelect(entity);
                if (entity.parent != null)
                    widget.addParent(this.selectPanel.Controls[entity.parent.nom] as CritereSelect);
                this.selectPanel.Controls.Add(widget);
            }
            this.selectPanel.ResumeLayout();
            this.selectPanel.SuspendLayout(); // Etrange mais çà accélère l'affichage
            foreach (Control control in this.selectPanel.Controls)
                this.selectPanel.SetFlowBreak(control, true);
            this.selectPanel.ResumeLayout();

            // Remplissage de la liste des bases d'action disponibles
            foreach (DB db in TrayIcon.dbs.Values)
            {
                if (TrayIcon.activeDBs.Contains(db.name)) // Si la base est active
                    this.addDB(db);

                // Menu admin
                ToolStripMenuItem activeItem = new ToolStripMenuItem("Active");
                activeItem.Checked = TrayIcon.activeDBs.Contains(db.name);
                activeItem.CheckOnClick = true;
                activeItem.CheckedChanged += new EventHandler(this.changeActiveDBs);

                this.adminItem.DropDownItems.Add(new ToolStripMenuItem(db.name, TaskLeader.Properties.Resources.database, new ToolStripMenuItem[]{
                    activeItem,
                    new ToolStripMenuItem("Valeurs par défaut",TaskLeader.Properties.Resources.bullets,this.defaultValuesToolStripMenuItem_Click),
                }));
            }

            this.manuelDBcombo.Text = TrayIcon.defaultDB.name; // ATTENTION: déclenche la mise à jour de toutes les CritereSelect!!
            TrayIcon.activeDBs.CollectionChanged += new NotifyCollectionChangedEventHandler(activeDBs_CollectionChanged);

            // -------------------
            // Tab 'recherche'
            // -------------------
            this.searchPanel.Controls.Add(this.dbSelect);

            // -------
            // Grille
            // -------
            this.data.Dock = DockStyle.Fill;
            this.mainTableLayout.Controls.Add(this.data, 0, 2);
            this.mainTableLayout.SetColumnSpan(this.data, 4);

            // ---------
            // TagsPanel
            // ---------
            TrayIcon.displayedFilters.CollectionChanged += new NotifyCollectionChangedEventHandler(displayedFilters_CollectionChanged);

            this.tagsPanel.Controls.AddRange(
                TrayIcon.displayedFilters.
                Select<Filtre, Etiquette>(f => new Etiquette(f)).
                ToArray<Etiquette>()
            );
        }