From 6ac6c731d0588141efae0a2fbf1436846bd04649 Mon Sep 17 00:00:00 2001 From: "maxime.BATISTA@etu.uca.fr" Date: Tue, 9 May 2023 22:14:59 +0200 Subject: [PATCH] split AppShell in MainAppShell and ConnectAppShell --- App.xaml.cs | 20 +- ConnectAppShell.xaml | 31 ++ AppShell.xaml.cs => ConnectAppShell.xaml.cs | 8 +- LocalEndpoint/Class1.cs | 7 + LocalEndpoint/LocalEndpoint.csproj | 13 + AppShell.xaml => MainAppShell.xaml | 49 +-- MainAppShell.xaml.cs | 11 + MauiProgram.cs | 1 - Models/Account.cs | 2 +- Models/{API => Endpoint}/IAccountManager.cs | 30 +- Models/{API => Endpoint}/IEndpoint.cs | 32 +- Models/{API => Endpoint}/ISearchEngine.cs | 26 +- Models/Ingredient.cs | 6 +- Models/Models.csproj | 9 + Models/PreparationStep.cs | 7 +- Models/Quantity.cs | 3 +- Models/Recipe.cs | 3 +- Models/RecipeInfo.cs | 3 +- Models/User.cs | 7 +- ShoopNCook.csproj | 369 +++++++++++--------- ShoopNCook.sln | 14 +- Views/LoginPage.xaml.cs | 2 +- Views/RegisterPage.xaml | 2 - Views/Splash.xaml.cs | 2 - 24 files changed, 355 insertions(+), 302 deletions(-) create mode 100644 ConnectAppShell.xaml rename AppShell.xaml.cs => ConnectAppShell.xaml.cs (51%) create mode 100644 LocalEndpoint/Class1.cs create mode 100644 LocalEndpoint/LocalEndpoint.csproj rename AppShell.xaml => MainAppShell.xaml (55%) create mode 100644 MainAppShell.xaml.cs rename Models/{API => Endpoint}/IAccountManager.cs (83%) rename Models/{API => Endpoint}/IEndpoint.cs (85%) rename Models/{API => Endpoint}/ISearchEngine.cs (82%) create mode 100644 Models/Models.csproj diff --git a/App.xaml.cs b/App.xaml.cs index 3fa94c2..e77a22c 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -1,23 +1,17 @@ -namespace ShoopNCook; -using ShoopNCook.Pages; -using ShoopNCook.Models; -using ShoopNCook.Models.API; +namespace ShoopNCook; +using ShoopNCook.Pages; +using Models; public partial class App : Application { + public App() { InitializeComponent(); - Account account = getUserAccount(); - - var appShell = new AppShell(); - MainPage = appShell; - appShell.GoToAsync("//Splash"); + Shell main = new ConnectAppShell(); + main.GoToAsync("//Splash"); + MainPage = main; } - private Account getUserAccount() - { - return new Account(new User(new Uri("https://www.pngkey.com/png/full/115-1150152_default-profile-picture-avatar-png-green.png"), "Stub Account"), "test@example.com"); - } } \ No newline at end of file diff --git a/ConnectAppShell.xaml b/ConnectAppShell.xaml new file mode 100644 index 0000000..5a68f99 --- /dev/null +++ b/ConnectAppShell.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + \ No newline at end of file diff --git a/AppShell.xaml.cs b/ConnectAppShell.xaml.cs similarity index 51% rename from AppShell.xaml.cs rename to ConnectAppShell.xaml.cs index 373ef48..d3568ea 100644 --- a/AppShell.xaml.cs +++ b/ConnectAppShell.xaml.cs @@ -1,13 +1,11 @@ namespace ShoopNCook; -using ShoopNCook.Pages; using Microsoft.Maui.Controls; +using Models; - -public partial class AppShell : Shell +public partial class ConnectAppShell : Shell { - public AppShell() + public ConnectAppShell() { InitializeComponent(); - } } diff --git a/LocalEndpoint/Class1.cs b/LocalEndpoint/Class1.cs new file mode 100644 index 0000000..29fb9ea --- /dev/null +++ b/LocalEndpoint/Class1.cs @@ -0,0 +1,7 @@ +namespace LocalEndpoint +{ + public class Class1 + { + + } +} \ No newline at end of file diff --git a/LocalEndpoint/LocalEndpoint.csproj b/LocalEndpoint/LocalEndpoint.csproj new file mode 100644 index 0000000..e45d1d7 --- /dev/null +++ b/LocalEndpoint/LocalEndpoint.csproj @@ -0,0 +1,13 @@ + + + + net7.0 + enable + enable + + + + + + + diff --git a/AppShell.xaml b/MainAppShell.xaml similarity index 55% rename from AppShell.xaml rename to MainAppShell.xaml index ea876cf..549c9f7 100644 --- a/AppShell.xaml +++ b/MainAppShell.xaml @@ -1,9 +1,8 @@ + + - - + - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/MainAppShell.xaml.cs b/MainAppShell.xaml.cs new file mode 100644 index 0000000..4bc1297 --- /dev/null +++ b/MainAppShell.xaml.cs @@ -0,0 +1,11 @@ +namespace ShoopNCook; +using Microsoft.Maui.Controls; +using Models; + +public partial class MainAppShell : Shell +{ + public MainAppShell() + { + InitializeComponent(); + } +} diff --git a/MauiProgram.cs b/MauiProgram.cs index c09f521..7dc9f23 100644 --- a/MauiProgram.cs +++ b/MauiProgram.cs @@ -16,7 +16,6 @@ public static class MauiProgram fonts.AddFont("Poppins-Bold.ttf", "PoppinsBold"); fonts.AddFont("Poppins-Regular.ttf", "Poppins"); fonts.AddFont("Poppins-Medium.ttf", "PoppinsMedium"); - fonts.AddFont("Poppins-Regular.ttf", "Poppins"); }); #if DEBUG builder.Logging.AddDebug(); diff --git a/Models/Account.cs b/Models/Account.cs index 75aac63..6d5a31c 100644 --- a/Models/Account.cs +++ b/Models/Account.cs @@ -1,4 +1,4 @@ -namespace ShoopNCook.Models +namespace Models { public class Account { diff --git a/Models/API/IAccountManager.cs b/Models/Endpoint/IAccountManager.cs similarity index 83% rename from Models/API/IAccountManager.cs rename to Models/Endpoint/IAccountManager.cs index 107270f..d3adc77 100644 --- a/Models/API/IAccountManager.cs +++ b/Models/Endpoint/IAccountManager.cs @@ -1,15 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ShoopNCook.Models.API -{ - public interface IAccountManager - { - public Account login(string email, string password); - - - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Models.Endpoint +{ + public interface IAccountManager + { + public Account login(string email, string password); + + + } +} diff --git a/Models/API/IEndpoint.cs b/Models/Endpoint/IEndpoint.cs similarity index 85% rename from Models/API/IEndpoint.cs rename to Models/Endpoint/IEndpoint.cs index d569f21..397ac9b 100644 --- a/Models/API/IEndpoint.cs +++ b/Models/Endpoint/IEndpoint.cs @@ -1,16 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ShoopNCook.Models.API -{ - public interface IEndpoint - { - public IAccountManager AccountManager { get; } - public ISearchEngine SearchEngine { get; } - - } -} - +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Models.Endpoint +{ + public interface IEndpoint + { + public IAccountManager AccountManager { get; } + public ISearchEngine SearchEngine { get; } + + } +} + diff --git a/Models/API/ISearchEngine.cs b/Models/Endpoint/ISearchEngine.cs similarity index 82% rename from Models/API/ISearchEngine.cs rename to Models/Endpoint/ISearchEngine.cs index 130951d..5f4e533 100644 --- a/Models/API/ISearchEngine.cs +++ b/Models/Endpoint/ISearchEngine.cs @@ -1,13 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ShoopNCook.Models.API -{ - public interface ISearchEngine - { - //TODO define methods to search recipes - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Models.Endpoint +{ + public interface ISearchEngine + { + //TODO define methods to search recipes + } +} diff --git a/Models/Ingredient.cs b/Models/Ingredient.cs index 26e90d5..48f1f21 100644 --- a/Models/Ingredient.cs +++ b/Models/Ingredient.cs @@ -1,10 +1,10 @@ - -namespace ShoopNCook.Models +namespace Models { public class Ingredient { - public Ingredient(string name, float amount, Quantity quantity) { + public Ingredient(string name, float amount, Quantity quantity) + { Name = name; Amount = amount; Quantity = quantity; diff --git a/Models/Models.csproj b/Models/Models.csproj new file mode 100644 index 0000000..cfadb03 --- /dev/null +++ b/Models/Models.csproj @@ -0,0 +1,9 @@ + + + + net7.0 + enable + enable + + + diff --git a/Models/PreparationStep.cs b/Models/PreparationStep.cs index ffb3ae7..d85cf91 100644 --- a/Models/PreparationStep.cs +++ b/Models/PreparationStep.cs @@ -1,13 +1,12 @@ - -namespace ShoopNCook.Models +namespace Models { public class PreparationStep { public PreparationStep(string name, string description) { - this.Name = name; - this.Description = description; + Name = name; + Description = description; } public string Name { get; init; } diff --git a/Models/Quantity.cs b/Models/Quantity.cs index e7516ff..51433d5 100644 --- a/Models/Quantity.cs +++ b/Models/Quantity.cs @@ -1,5 +1,4 @@ - -namespace ShoopNCook.Models +namespace Models { public class Quantity { diff --git a/Models/Recipe.cs b/Models/Recipe.cs index c5963d8..15d09ae 100644 --- a/Models/Recipe.cs +++ b/Models/Recipe.cs @@ -1,5 +1,4 @@ - -namespace ShoopNCook.Models +namespace Models { public class Recipe { diff --git a/Models/RecipeInfo.cs b/Models/RecipeInfo.cs index ba37ea1..4640626 100644 --- a/Models/RecipeInfo.cs +++ b/Models/RecipeInfo.cs @@ -1,5 +1,4 @@ - -namespace ShoopNCook.Models +namespace Models { public class RecipeInfo { diff --git a/Models/User.cs b/Models/User.cs index c9893c7..2f19f35 100644 --- a/Models/User.cs +++ b/Models/User.cs @@ -1,5 +1,4 @@ - -namespace ShoopNCook.Models +namespace Models { public class User { @@ -10,7 +9,7 @@ namespace ShoopNCook.Models Name = name; } - public Uri ProfilePicture { get; init; } - public string Name { get; init; } + public Uri ProfilePicture { get; init; } + public string Name { get; init; } } } diff --git a/ShoopNCook.csproj b/ShoopNCook.csproj index e727121..cff5220 100644 --- a/ShoopNCook.csproj +++ b/ShoopNCook.csproj @@ -1,174 +1,203 @@ - - - - net7.0;net7.0-android - $(TargetFrameworks);net7.0-windows10.0.19041.0 - - - Exe - ShoopNCook - true - true - enable - - - ShoopNCook - - - com.companyname.shoopncook - bf17e1fe-a722-42f6-a24d-3327d351c924 - - - 1.0 - 1 - - 11.0 - 13.1 - 21.0 - 10.0.17763.0 - 10.0.17763.0 - 6.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MyListPage.xaml - + + + + net7.0;net7.0-android + $(TargetFrameworks);net7.0-windows10.0.19041.0 + + + Exe + ShoopNCook + true + true + enable + + + ShoopNCook + + + com.companyname.shoopncook + bf17e1fe-a722-42f6-a24d-3327d351c924 + + + 1.0 + 1 + + 11.0 + 13.1 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ConnectAppShell.xaml + + + MainAppShell.xaml + + + MyListPage.xaml + IngredientEntry.xaml - - - - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - - - MSBuild:Compile - + + + + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + MSBuild:Compile - - - MSBuild:Compile - - - - - - - - - - + + + MSBuild:Compile + + + + + + + + + + diff --git a/ShoopNCook.sln b/ShoopNCook.sln index 7ffa604..f0e9130 100644 --- a/ShoopNCook.sln +++ b/ShoopNCook.sln @@ -4,7 +4,11 @@ VisualStudioVersion = 17.0.31611.283 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShoopNCook", "ShoopNCook.csproj", "{8ED2FB1D-C04D-478D-9271-CC91FE110396}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{E50D92DC-0BB1-4998-B085-EF47C55675AC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{E50D92DC-0BB1-4998-B085-EF47C55675AC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Models", "Models\Models.csproj", "{A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalEndpoint", "LocalEndpoint\LocalEndpoint.csproj", "{57732316-93B9-4DA0-A212-F8892D3D968B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -22,6 +26,14 @@ Global {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {E50D92DC-0BB1-4998-B085-EF47C55675AC}.Release|Any CPU.Build.0 = Release|Any CPU + {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A9D43E07-345D-4DD4-B4F9-CE69ED569B5F}.Release|Any CPU.Build.0 = Release|Any CPU + {57732316-93B9-4DA0-A212-F8892D3D968B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {57732316-93B9-4DA0-A212-F8892D3D968B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {57732316-93B9-4DA0-A212-F8892D3D968B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {57732316-93B9-4DA0-A212-F8892D3D968B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Views/LoginPage.xaml.cs b/Views/LoginPage.xaml.cs index 3e6250e..44b5208 100644 --- a/Views/LoginPage.xaml.cs +++ b/Views/LoginPage.xaml.cs @@ -22,6 +22,6 @@ public partial class LoginPage : ContentPage } private async void RegisterLabbelTapped(object sender, EventArgs e) { - await Shell.Current.GoToAsync("//RegisterPage"); + await Shell.Current.Navigation.PushAsync(new RegisterPage()); } } \ No newline at end of file diff --git a/Views/RegisterPage.xaml b/Views/RegisterPage.xaml index 92f4313..a7ca053 100644 --- a/Views/RegisterPage.xaml +++ b/Views/RegisterPage.xaml @@ -84,8 +84,6 @@ - -