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 static PaneQueryable getIngredientPane()
        {
            List <ImageNode> images = new List <ImageNode>();

            images.Add(new InsertNode((a, b) =>
            {
                MainPaneGestor.getInstance().setPanel(InsertPaneFactory.getInsertIngrediente());
                MainPaneGestor.getInstance().disableShowingSearch();
            }));
            return(new SimplePaneImage(images, nodeFactory.createNodeFilter(), (x => { return new List <Control>(); })));
        }
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));
        }