Exemplo n.º 1
0
        public static Frame CallSpecies(object sender, MouseEventArgs e, ListBox l, List <String> lastUrl)
        {
            Species     s           = (Species)l.SelectedItem;
            SpeciesPage speciesPage = new SpeciesPage(s.url, lastUrl);
            TabItem     tabItem     = new TabItem();
            Frame       tabFrame    = new Frame();

            tabFrame.Content = speciesPage;
            return(tabFrame);
        }
Exemplo n.º 2
0
        public static Frame GoBack(List <String> backUrl)
        {
            Frame  frame   = new Frame();
            string lastUrl = backUrl.Last();

            backUrl.Remove(lastUrl);
            switch (parseUrl(lastUrl))
            {
            case "planets":
                PlanetPage planetPage  = new PlanetPage(lastUrl, backUrl);
                Frame      planetFrame = new Frame();
                frame.Content = planetPage;
                break;

            case "species":
                SpeciesPage speciesPage  = new SpeciesPage(lastUrl, backUrl);
                Frame       speciesFrame = new Frame();
                frame.Content = speciesPage;
                break;

            case "vehicles":
                VehiclePage vehiclePage = new VehiclePage(lastUrl, backUrl);
                frame.Content = vehiclePage;
                break;

            case "starships":
                StarshipPage starshipPage = new StarshipPage(lastUrl, backUrl);
                frame.Content = starshipPage;
                break;

            case "people":
                PeoplePage peoplePage = new PeoplePage(lastUrl, backUrl);
                frame.Content = peoplePage;
                break;

            case "films":
                FilmPage filmPage = new FilmPage(lastUrl, backUrl);
                frame.Content = filmPage;
                break;
            }
            return(frame);
        }
Exemplo n.º 3
0
        private void CallPage(object sender, MouseEventArgs e)
        {
            List <String> backUrl = new List <String>();

            backUrl.Add("");
            switch (ListElements.SelectedItem.GetType().ToString())
            {
            case "OpenFood_C_Sharp.Modele.People":
                b         = new Button();
                b.Content = " X ";
                People     p               = (People)ListElements.SelectedItem;
                PeoplePage peoplePage      = new PeoplePage(p.url, backUrl);
                Frame      peoplePageFrame = new Frame();
                peoplePageFrame.Content = peoplePage;
                tabItem   = new TabItem();
                stack     = new StackPanel();
                l         = new Label();
                l.Content = p.ToString();
                stack.Children.Add(l);
                stack.Children.Add(b);
                stack.Orientation = Orientation.Horizontal;
                tabItem.Header    = stack;
                tabItem.Content   = peoplePageFrame;
                mainTab.Items.Add(tabItem);
                b.Click += removePanel;
                b.Tag    = tabItem;
                mainTab.SelectedItem = tabItem;
                mainTab.Visibility   = Visibility.Visible;
                break;

            case "OpenFood_C_Sharp.Modele.Film":
                b         = new Button();
                b.Content = " X ";
                Film     f             = (Film)ListElements.SelectedItem;
                FilmPage filmPage      = new FilmPage(f.url, backUrl);
                Frame    filmPageFrame = new Frame();
                filmPageFrame.Content = filmPage;
                tabItem   = new TabItem();
                stack     = new StackPanel();
                l         = new Label();
                l.Content = f.ToString();
                stack.Children.Add(l);
                stack.Children.Add(b);
                stack.Orientation = Orientation.Horizontal;
                tabItem.Header    = stack;
                tabItem.Content   = filmPageFrame;
                mainTab.Items.Add(tabItem);
                b.Tag    = tabItem;
                b.Click += removePanel;
                mainTab.SelectedItem = tabItem;
                mainTab.Visibility   = Visibility.Visible;
                break;

            case "OpenFood_C_Sharp.Modele.Starship":
                b         = new Button();
                b.Content = " X ";
                Starship     star           = (Starship)ListElements.SelectedItem;
                StarshipPage starshipPage   = new StarshipPage(star.url, backUrl);
                Frame        starsShipFrame = new Frame();
                starsShipFrame.Content = starshipPage;
                tabItem = new TabItem();
                stack   = new StackPanel();

                l         = new Label();
                l.Content = star.ToString();
                stack.Children.Add(l);
                stack.Children.Add(b);
                stack.Orientation = Orientation.Horizontal;
                tabItem.Header    = stack;
                tabItem.Content   = starsShipFrame;
                mainTab.Items.Add(tabItem);
                b.Tag    = tabItem;
                b.Click += removePanel;
                mainTab.SelectedItem = tabItem;
                mainTab.Visibility   = Visibility.Visible;
                break;

            case "OpenFood_C_Sharp.Modele.Vehicle":
                b         = new Button();
                b.Content = " X ";
                Vehicle     v             = (Vehicle)ListElements.SelectedItem;
                VehiclePage vehiclePage   = new VehiclePage(v.url, backUrl);
                Frame       vehiculeFrame = new Frame();
                vehiculeFrame.Content = vehiclePage;
                tabItem   = new TabItem();
                stack     = new StackPanel();
                l         = new Label();
                l.Content = v.ToString();
                stack.Children.Add(l);
                stack.Children.Add(b);
                stack.Orientation = Orientation.Horizontal;
                tabItem.Header    = stack;
                tabItem.Content   = vehiculeFrame;
                mainTab.Items.Add(tabItem);
                b.Tag    = tabItem;
                b.Click += removePanel;
                mainTab.SelectedItem = tabItem;
                mainTab.Visibility   = Visibility.Visible;
                break;

            case "OpenFood_C_Sharp.Modele.Species":
                b         = new Button();
                b.Content = " X ";
                Species     s            = (Species)ListElements.SelectedItem;
                SpeciesPage speciesPage  = new SpeciesPage(s.url, backUrl);
                Frame       speciesFrame = new Frame();
                speciesFrame.Content = speciesPage;
                tabItem   = new TabItem();
                stack     = new StackPanel();
                l         = new Label();
                l.Content = s.ToString();
                stack.Children.Add(l);
                stack.Children.Add(b);
                stack.Orientation = Orientation.Horizontal;
                tabItem.Header    = stack;
                tabItem.Content   = speciesFrame;
                mainTab.Items.Add(tabItem);
                b.Tag    = tabItem;
                b.Click += removePanel;
                mainTab.SelectedItem = tabItem;
                mainTab.Visibility   = Visibility.Visible;
                break;

            case "OpenFood_C_Sharp.Modele.Planet":
                b         = new Button();
                b.Content = " X ";
                Planet     pla         = (Planet)ListElements.SelectedItem;
                PlanetPage planetPage  = new PlanetPage(pla.url, backUrl);
                Frame      planetFrame = new Frame();
                planetFrame.Content = planetPage;
                tabItem             = new TabItem();
                stack     = new StackPanel();
                l         = new Label();
                l.Content = pla.ToString();
                stack.Children.Add(l);
                stack.Children.Add(b);
                stack.Orientation = Orientation.Horizontal;
                tabItem.Header    = stack;
                tabItem.Content   = planetFrame;
                mainTab.Items.Add(tabItem);
                b.Click += removePanel;
                mainTab.SelectedItem = tabItem;
                mainTab.Visibility   = Visibility.Visible;
                break;
            }
        }