From 45387d3faa2d5b4c3c0f737098f7c30bf1ba2ab6 Mon Sep 17 00:00:00 2001 From: syneffort Date: Wed, 21 Feb 2024 13:41:05 +0900 Subject: [PATCH] flyout, tab, routes-gotoasync --- MyFirstMauiApp/FlyoutTabSearch/AppShell.xaml | 30 ++++++++++-- .../FlyoutTabSearch/AppShell.xaml.cs | 6 ++- .../FlyoutTabSearch/Data/AstronomicalBody.cs | 17 +++++++ .../FlyoutTabSearch/Data/SolarSystemData.cs | 47 ++++++++++++++++++ .../FlyoutTabSearch/FlyoutTabSearch.csproj | 6 +++ .../Pages/AstronomicalBodiesPage.xaml | 38 +++++++++++++++ .../Pages/AstronomicalBodiesPage.xaml.cs | 14 ++++++ .../Pages/AstronomicalBodyPage.xaml | 47 ++++++++++++++++++ .../Pages/AstronomicalBodyPage.xaml.cs | 48 +++++++++++++++++++ 9 files changed, 248 insertions(+), 5 deletions(-) create mode 100644 MyFirstMauiApp/FlyoutTabSearch/Data/AstronomicalBody.cs create mode 100644 MyFirstMauiApp/FlyoutTabSearch/Data/SolarSystemData.cs create mode 100644 MyFirstMauiApp/FlyoutTabSearch/Pages/AstronomicalBodiesPage.xaml create mode 100644 MyFirstMauiApp/FlyoutTabSearch/Pages/AstronomicalBodiesPage.xaml.cs create mode 100644 MyFirstMauiApp/FlyoutTabSearch/Pages/AstronomicalBodyPage.xaml create mode 100644 MyFirstMauiApp/FlyoutTabSearch/Pages/AstronomicalBodyPage.xaml.cs diff --git a/MyFirstMauiApp/FlyoutTabSearch/AppShell.xaml b/MyFirstMauiApp/FlyoutTabSearch/AppShell.xaml index bb1c393..45a137a 100644 --- a/MyFirstMauiApp/FlyoutTabSearch/AppShell.xaml +++ b/MyFirstMauiApp/FlyoutTabSearch/AppShell.xaml @@ -3,12 +3,34 @@ x:Class="FlyoutTabSearch.AppShell" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" - xmlns:local="clr-namespace:FlyoutTabSearch.Pages"> - + xmlns:local="clr-namespace:FlyoutTabSearch.Pages" + FlyoutIcon="moon.png"> + + + + + + + + + + + + - moon.png + diff --git a/MyFirstMauiApp/FlyoutTabSearch/AppShell.xaml.cs b/MyFirstMauiApp/FlyoutTabSearch/AppShell.xaml.cs index 2c8195c..5f910b8 100644 --- a/MyFirstMauiApp/FlyoutTabSearch/AppShell.xaml.cs +++ b/MyFirstMauiApp/FlyoutTabSearch/AppShell.xaml.cs @@ -1,10 +1,14 @@ -namespace FlyoutTabSearch +using FlyoutTabSearch.Pages; + +namespace FlyoutTabSearch { public partial class AppShell : Shell { public AppShell() { InitializeComponent(); + + Routing.RegisterRoute("astronomicalbodydetails", typeof(AstronomicalBodyPage)); } } } diff --git a/MyFirstMauiApp/FlyoutTabSearch/Data/AstronomicalBody.cs b/MyFirstMauiApp/FlyoutTabSearch/Data/AstronomicalBody.cs new file mode 100644 index 0000000..87bcda1 --- /dev/null +++ b/MyFirstMauiApp/FlyoutTabSearch/Data/AstronomicalBody.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlyoutTabSearch.Data +{ + internal class AstronomicalBody + { + public string Name { get; set; } + public string Mass { get; set; } + public string Circumference { get; set; } + public string Age { get; set; } + public string EmojiIcon { get; set; } + } +} diff --git a/MyFirstMauiApp/FlyoutTabSearch/Data/SolarSystemData.cs b/MyFirstMauiApp/FlyoutTabSearch/Data/SolarSystemData.cs new file mode 100644 index 0000000..390a98a --- /dev/null +++ b/MyFirstMauiApp/FlyoutTabSearch/Data/SolarSystemData.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FlyoutTabSearch.Data +{ + internal class SolarSystemData + { + public static AstronomicalBody Sun = new AstronomicalBody() + { + Name = "The Sun (Sol)", + Mass = "1.9855*10^30 kg", + Circumference = "4,379,000 km", + Age = "4.57 billion years", + EmojiIcon = "☀️", + }; + + public static AstronomicalBody Earth = new AstronomicalBody() + { + Name = "Earth", + Mass = "5.97237*10^24 kg", + Circumference = "40,075 km", + Age = "4.54 billion years", + EmojiIcon = "🌎", + }; + + public static AstronomicalBody Moon = new AstronomicalBody() + { + Name = "Moon", + Mass = "7.342*10^22 kg", + Circumference = "10,921 km", + Age = "4.53 billion years", + EmojiIcon = "🌕", + }; + + public static AstronomicalBody HalleysComet = new AstronomicalBody() + { + Name = "Halley's Comet", + Mass = "22 * 10^14 kg", + Circumference = "11 km", + Age = "4.6 billion years", + EmojiIcon = "☄", + }; + } +} diff --git a/MyFirstMauiApp/FlyoutTabSearch/FlyoutTabSearch.csproj b/MyFirstMauiApp/FlyoutTabSearch/FlyoutTabSearch.csproj index 5b2bff4..a7a7061 100644 --- a/MyFirstMauiApp/FlyoutTabSearch/FlyoutTabSearch.csproj +++ b/MyFirstMauiApp/FlyoutTabSearch/FlyoutTabSearch.csproj @@ -64,6 +64,12 @@ MSBuild:Compile + + MSBuild:Compile + + + MSBuild:Compile + MSBuild:Compile diff --git a/MyFirstMauiApp/FlyoutTabSearch/Pages/AstronomicalBodiesPage.xaml b/MyFirstMauiApp/FlyoutTabSearch/Pages/AstronomicalBodiesPage.xaml new file mode 100644 index 0000000..d8cac6c --- /dev/null +++ b/MyFirstMauiApp/FlyoutTabSearch/Pages/AstronomicalBodiesPage.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + +