Add (Back-End): Prototype archi
continuous-integration/drone/push Build is failing Details

Back-End
lodufour1 2 years ago
parent 1606a3a133
commit f07ea2f058

@ -19,9 +19,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils", "Utils\Utils.csproj
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stub", "Stub\Stub.csproj", "{14ED7ADF-7B83-432E-A87B-40C153041067}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFrontEnd", "Tests\TestFrontEnd.csproj", "{945A6DB3-CB0A-4FB8-8117-64F0CB0D838A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{945A6DB3-CB0A-4FB8-8117-64F0CB0D838A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VMWrapper", "VMWrapper\VMWrapper.csproj", "{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VMWrapper", "VMWrapper\VMWrapper.csproj", "{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToolKit", "ToolKit\ToolKit.csproj", "{778541B9-BECF-49DC-8860-B8F134A6F4E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -71,6 +73,10 @@ Global
{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{377DC5AB-5D7C-4A29-ACED-C08B581A8E58}.Release|Any CPU.Build.0 = Release|Any CPU
{778541B9-BECF-49DC-8860-B8F134A6F4E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{778541B9-BECF-49DC-8860-B8F134A6F4E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{778541B9-BECF-49DC-8860-B8F134A6F4E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{778541B9-BECF-49DC-8860-B8F134A6F4E2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -4,7 +4,7 @@
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:vm="clr-namespace:BookApp.ViewModel"
xmlns:model="clr-namespace:Model;assembly=Model"
x:DataType="vm:TousViewModel"
x:DataType="vm:ViewModelManager"
x:Class="BookApp.Composants.CollectionFiltrage">
<CollectionView ItemsSource="{Binding Authors}">
<CollectionView.ItemTemplate>

@ -19,7 +19,7 @@ public partial class CollectionFiltrage : ContentView
public ObservableCollection<ObjetTemp> MyCollections1 { get; set; }*/
public CollectionFiltrage(TousViewModel data)
public CollectionFiltrage(ViewModelManager data)
{
InitializeComponent();

@ -30,9 +30,10 @@ namespace BookApp
#endif
builder.Services.AddSingleton<ILibraryManager, LibraryStub>();
builder.Services.AddSingleton<BookViewModel>();
builder.Services.AddSingleton<TousViewModel>();
builder.Services.AddSingleton<ViewModel.ViewModelManager>();
builder.Services.AddSingleton<Filtrage>();
builder.Services.AddSingleton<CollectionFiltrage>();
// transient pour recharger la data à l'execute

@ -4,9 +4,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:composants="clr-namespace:BookApp.Composants"
xmlns:vm="clr-namespace:BookApp.ViewModel"
xmlns:model="clr-namespace:Model;assembly=Model"
x:DataType="vm:TousViewModel"
xmlns:vmw="clr-namespace:VMWrapper;assembly=VMWrapper"
x:DataType="vmw:BookViewModel"
x:Class="BookApp.Pages.Filtrage">
<Shell.BackButtonBehavior>
<BackButtonBehavior IsVisible="False" IsEnabled="False"/>
@ -66,8 +66,7 @@
<StackLayout>
<Rectangle HeightRequest="1" BackgroundColor="LightGray"/>
<SearchBar Placeholder="Search items..."/>
<Rectangle HeightRequest="1" BackgroundColor="LightGray"/>
<CollectionView ItemsSource="{Binding Authors}" VerticalOptions="FillAndExpand">
<CollectionView ItemsSource="{Binding authorList}" VerticalOptions="FillAndExpand">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="model:Author">
<StackLayout Padding="5">

@ -1,12 +1,13 @@
using BookApp.ViewModel;
using VMWrapper;
namespace BookApp.Pages
{
public partial class Filtrage : ContentPage
{
SearchBar searchBar = new SearchBar { Placeholder = "Search items..." };
public Filtrage(TousViewModel data)
public Filtrage(BookViewModel data)
{
InitializeComponent();
BindingContext= data;

@ -7,7 +7,7 @@ namespace BookApp.ViewModel;
public class TousViewModel
public class ViewModelManager
{
BookViewModel _viewModel;
@ -16,11 +16,11 @@ public class TousViewModel
/* public ObservableCollection<AuteurGroup> AuteurGroups { get; private set; } =
new ObservableCollection<AuteurGroup>();*/
public TousViewModel(BookViewModel viewModel)
public ViewModelManager(BookViewModel viewModel)
{
_viewModel = viewModel;
GetAuthors();
//GetAuthors();
/* ObservableCollection<Auteur> auteurs = new Stub().CreateStubData();
foreach (Auteur auteur in auteurs)
{
@ -29,16 +29,16 @@ public class TousViewModel
}
//fireandforget
public async void GetAuthors()
/*public async void GetAuthors()
{
var authors1 = await _viewModel.GetAuthor();
var authors1 = await _viewModel.GetAuthors();
Authors.Clear();
foreach (var author in authors1)
{
Authors.Add(author);
}
}
}*/
}
/*public class AuteurGroup : ObservableCollection<Book>

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BookApp.ViewModel
{
internal class ViewModelNavigation
{
}
}

@ -21,4 +21,9 @@
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Stub\Stub.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,7 @@
namespace ToolKit
{
public class Class1
{
}
}

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -1,32 +1,88 @@
using Model;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Xml.Linq;
namespace VMWrapper
{
// All the code in this file is included in all platforms.
public class BookViewModel
public class BookViewModel : INotifyPropertyChanged
{
ILibraryManager data;
ObservableCollection<Author> authorList;
public BookViewModel(ILibraryManager data)
public ObservableCollection<Author> authorList { get; private set; } = new ObservableCollection<Author>();
public ObservableCollection<Book> bookList { get; private set; } = new ObservableCollection<Book>();
public ObservableCollection<AuteurGroup> AuteurGroups { get; private set; } = new ObservableCollection<AuteurGroup>();
public event PropertyChangedEventHandler PropertyChanged;
public BookViewModel(ILibraryManager data)
{
this.data = data;
GetAuthors();
}
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public class AuteurGroup : ObservableCollection<Book>
{
public string Name { get; private set; }
public AuteurGroup(string name, ObservableCollection<Book> books): base(books)
{
Name = name;
}
}
public void GetBooks()
{
var objet = data.GetBooksByAuthor("", 0, 8);
var ojb = objet.Result.Item2;
/*foreach (Book Book in ojb)
{
AuteurGroups.Add(new AuteurGroup(Book.Authors.Name, auteur.Books));
}
ObservableCollection<Auteur> auteurs = new Stub().CreateStubData();
foreach (Auteur auteur in auteurs)
{
AuteurGroups.Add(new AuteurGroup(auteur.Name, auteur.Books));
}
*/
}
public async Task<ObservableCollection<Author>> GetAuthor()
public void GetAuthors()
{
var objet = await data.GetAuthorsByName("",0,10);
var objet = data.GetAuthorsByName("",0,10);
var ojb = objet.Result.Item2;
authorList.Clear();
foreach (var author in ojb)
{
authorList.Add(author);
}
}
public async Task<ObservableCollection<Book>> GetBooksByTitle()
{
var objet = await data.GetBooksByTitle("", 0, 9);
var ojb = objet.Item2;
return new ObservableCollection<Author>(ojb);
return new ObservableCollection<Book>(ojb);
}
}
}
Loading…
Cancel
Save