Beispiel #1
0
        //In this method we create a new project object and call the search method to look for projects
        private void Search()
        {
            //At first, we hide the main grid and enable the projectPanel, where the found projects will display
            MainPanel.Visibility     = Visibility.Hidden;
            projectsPanel.IsEnabled  = true;
            projectsPanel.Visibility = Visibility.Visible;
            //Calling this function, we clean the projects panel, so each time a new search is made, the panel will not have
            //the results from the previous searches
            ManagePanels.ClearPanel(projectsPanel);

            //And here, we create a projects object to manage the methods and a buttons list to record all the found proects
            ProjectsController PC   = new ProjectsController();
            List <Button>      btns = PC.SearchProjects(txtSearch.Text);

            //Create the go back button from the project class
            Button btnGoBack = PC.CreateButton("Go Back", "Images/icons8-go-back-96.png");

            btnGoBack.Click += new RoutedEventHandler(Go_Back);
            projectsPanel.Children.Add(btnGoBack);

            if (btns != null)
            {
                //Once the search is performed, now we add an event to each founded button
                foreach (Button btn in btns)
                {
                    projectsPanel.Children.Add(btn);
                    btn.Click += new RoutedEventHandler(Move);
                }
            }
            else
            {
                var home = new HomeView();
                Content = home;
            }
        }