Ejemplo n.º 1
0
        public static PaneQueryable getRicettaPane()
        {
            List <ImageNode> images = new List <ImageNode>();

            images.Add(new InsertNode((a, b) =>
            {
                MainPaneGestor.getInstance().setPanel(InsertPaneFactory.getInsertRicetta());
                MainPaneGestor.getInstance().disableShowingSearch();
            }));
            ToolTip ricettaTip = TooltipFactory.createBasicTooltip("Ricetta");

            (from c in RicettarioDB.getInstance().Ricetta
             select c).ToList().ForEach(x =>
            {
                images.Add(getImageNode(x, new Bitmap(x.Immagine), ricettaTip));
            });
            searchElement action = x =>
            {
                List <Ricetta> list = (from c in RicettarioDB.getInstance().Ricetta
                                       where SqlMethods.Like(c.Nome, "%" + x + "%")
                                       select c).ToList();
                List <Control> result = new List <Control>();

                list.ForEach(z =>
                {
                    result.Add((getImageNode(z, new Bitmap(z.Immagine), ricettaTip)).getImage());
                });
                return(result);
            };

            return(new SimplePaneImage(images, nodeFactory.createNodeFilter(), action));
        }
Ejemplo n.º 2
0
            public SimplePaneControl(List <ImageNode> images, FilterNode filter, ListBox menu, searchElement action) : base(images, filter)
            {
                this.images = images;
                menu.Size   = new Size(250, 200);
                this.menu   = menu;
                TableLayoutPanel main = this.getMainPanel();

                controlsPane = new FlowLayoutPanel();
                textMenu     = labelFactory.createAdvanceLabel("Scegli un menu da visualizzare", labelFactory.getGeneralFont(),
                                                               new Size(300, 20), Color.Black, ContentAlignment.TopLeft);

                controlsPane.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
                controlsPane.Controls.Add(textMenu);
                controlsPane.Controls.Add(menu);
                main.Controls.Add(controlsPane, 1, 1);
                this.action = action;
            }
Ejemplo n.º 3
0
        public static PaneQueryable getMenuPane()
        {
            bool             isClicked = false;
            List <ImageNode> images    = new List <ImageNode>();

            images.Add(new InsertNode((a, b) =>
            {
                isClicked = true;
                MainPaneGestor.getInstance().setPanel(InsertPaneFactory.getInsertMenu());
                MainPaneGestor.getInstance().disableShowingSearch();
            }));
            ListBox     list  = new ListBox();
            List <Menù> menus = (from c in RicettarioDB.getInstance().Menù
                                 select c).ToList();

            menus.ForEach(x => list.Items.Add(x.Nome));
            list.Click += (obj, args) =>
            {
                if (list.SelectedItem != null)
                {
                    new MenuSelection(menus[list.SelectedIndex].idMenù).ShowDialog();
                }
            };
            searchElement action = x =>
            {
                ListBox        filterList = new ListBox();
                List <Control> result     = new List <Control>();
                result.Add(filterList);
                List <Menù> filterMenus = (from c in RicettarioDB.getInstance().Menù
                                           where SqlMethods.Like(c.Nome, "%" + x + "%")
                                           select c).ToList();
                filterMenus.ForEach(z => filterList.Items.Add(z.Nome));
                filterList.SelectedIndexChanged += (obj, arg) => {
                    if (filterList.SelectedItem != null)
                    {
                        new MenuSelection(filterMenus[filterList.SelectedIndex].idMenù).ShowDialog();
                    }
                };
                return(result);
            };

            return(new SimplePaneControl(images, nodeFactory.createNodeFilter(), list, action));
        }
Ejemplo n.º 4
0
 public SimplePaneImage(List <ImageNode> images, FilterNode node, searchElement search) : base(images, node)
 {
     this.images = new List <Button>();
     images.ForEach(x => this.images.Add(x.getImage()));
     this.action = search;
 }