Mamadou Elaphi ARAFA 3 years ago
parent 500c4fa532
commit 7d4ffdde18

@ -1,5 +1,6 @@
using CalculateurApp.View; using CalculateurApp.View;
using CalculateurApp.ViewModel; using CalculateurApp.ViewModel;
using ClassCalculateurMoyenne;
namespace CalculateurApp namespace CalculateurApp
{ {
@ -9,9 +10,11 @@ namespace CalculateurApp
{ {
InitializeComponent(); InitializeComponent();
MainPage = new NavigationPage(new HomePage()); MainPage = new NavigationPage(new HomePage());
//MainPage = new AppShell(BlocViewModel c); //MainPage = new AppShell(BlocViewModel c);
// MainPage = new Maquette(); // MainPage = new Maquette ();
// MainPage = new UEPage1();
} }
} }
} }

@ -60,22 +60,31 @@
<Compile Update="View\HomePage.xaml.cs"> <Compile Update="View\HomePage.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon> <DependentUpon>%(Filename)</DependentUpon>
</Compile> </Compile>
<Compile Update="View\MaquettePage.xaml.cs">
<DependentUpon>MaquettePage.xaml</DependentUpon>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<MauiXaml Update="View\EXE.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="View\HomePage.xaml"> <MauiXaml Update="View\HomePage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="View\Maquette.xaml"> <MauiXaml Update="View\MaquettePage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="View\Matiere1.xaml"> <MauiXaml Update="View\Matiere1.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="View\PageUe.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="View\Start.xaml"> <MauiXaml Update="View\Start.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="View\UE.xaml"> <MauiXaml Update="View\UEPage1.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
</ItemGroup> </ItemGroup>

@ -17,7 +17,7 @@ namespace CalculateurApp
}); });
builder.Services.AddTransient<Start>(); builder.Services.AddTransient<Start>();
builder.Services.AddTransient<BlocViewModel>(); builder.Services.AddTransient<BlocViewModel>();
builder.Services.AddSingleton<UE>(); builder.Services.AddSingleton<UEPage1>();
builder.Services.AddSingleton<UeViewModel>(); builder.Services.AddSingleton<UeViewModel>();
builder.Services.AddSingleton<Maquette>(); builder.Services.AddSingleton<Maquette>();
builder.Services.AddSingleton<MaquetteViewModel>(); builder.Services.AddSingleton<MaquetteViewModel>();

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CalculateurApp.View.EXE"
Title="EXE">
<Grid
Padding="10"
RowSpacing="600"
ColumnSpacing="6">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition/>
</Grid.ColumnDefinitions >
<Grid BackgroundColor="AliceBlue">
<Label Text=" Matiere" VerticalOptions="Center" HorizontalOptions="Start"></Label>
<Label Text="Coef" Grid.Row="0" Grid.Column="1" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"></Label>
</Grid>
</Grid>
</ContentPage>

@ -0,0 +1,9 @@
namespace CalculateurApp.View;
public partial class EXE : ContentPage
{
public EXE()
{
InitializeComponent();
}
}

@ -12,18 +12,11 @@
Padding="10" Padding="10"
RowSpacing="10" RowSpacing="10"
ColumnSpacing="10"> ColumnSpacing="10">
<Entry Placeholder="Ajout de BLOC DANS LA MAQUETTE"
Grid.Row="1" BackgroundColor="AliceBlue"
<Image
Grid.ColumnSpan="2"
Source=""
BackgroundColor="Transparent"
/>
<Entry Placeholder="Ajout de BLOC DANS LA MAQUETTE"
Grid.Row="1" BackgroundColor="AliceBlue"
Text="{Binding blocModel.Nom }" Text="{Binding blocModel.Nom }"
TextColor="Black" TextColor="Black"
/> />
<Button <Button
Command="{Binding AddCommand}" Command="{Binding AddCommand}"
Text="Add" Text="Add"
@ -32,34 +25,40 @@
</Button> </Button>
<Label Text="Liste des blocs" Grid.Row="2" Grid.ColumnSpan="2" FontSize="Header" HorizontalOptions="Center" TextDecorations="Underline" TextColor="Black" FontAttributes="Bold, Italic" ></Label> <Label Text="Liste des blocs" Grid.Row="2" Grid.ColumnSpan="2" FontSize="Header" HorizontalOptions="Center" TextDecorations="Underline" TextColor="Black" FontAttributes="Bold, Italic" ></Label>
<CollectionView Grid.Row="3" Grid.ColumnSpan="3" ItemsSource="{Binding Items}" SelectionMode="None" > <CollectionView Grid.Row="3" Grid.ColumnSpan="3" ItemsSource="{Binding Items}" SelectionMode="None" >
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type model:BlocModel }"> <DataTemplate x:DataType="{x:Type model:BlocModel }">
<SwipeView> <SwipeView>
<SwipeView.RightItems> <SwipeView.RightItems>
<SwipeItems> <SwipeItems>
<SwipeItem Text="Delete" <SwipeItem Text="Delete"
BackgroundColor="Red" BackgroundColor="Red"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:MaquetteViewModel}}, Path=DeleteCommand}" Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:MaquetteViewModel}}, Path=DeleteCommand}"
CommandParameter="{Binding .}" CommandParameter="{Binding .}"
/> />
</SwipeItems> </SwipeItems>
</SwipeView.RightItems> </SwipeView.RightItems>
<Grid Padding="0"> <Grid Padding="0">
<Frame> <Frame>
<Frame.GestureRecognizers > <Frame.GestureRecognizers >
<TapGestureRecognizer <TapGestureRecognizer
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:MaquetteViewModel}}, Path=TapCommand}" Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:MaquetteViewModel}}, Path=TapCommand}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</Frame.GestureRecognizers> </Frame.GestureRecognizers>
<Label Text="{Binding Nom}" <Label Text="{Binding Nom}"
FontSize="10" TextColor="Black" /> FontSize="10" TextColor="Black" />
</Frame> </Frame>
</Grid>
</SwipeView> </Grid>
</DataTemplate>
</CollectionView.ItemTemplate> </SwipeView>
</CollectionView> </DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<CollectionView>
</CollectionView>
</Grid> </Grid>

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewmodel="clr-namespace:CalculateurApp.ViewModel"
xmlns:model="clr-namespace:ClassCalculateurMoyenne;assembly=ClassCalculateurMoyenne"
x:DataType="viewmodel:UeViewModel"
x:Class="CalculateurApp.View.PageUe"
Title="PageUe">
<!--<Frame Margin="10,0,10,0" VerticalOptions="center">
<Grid RowDefinitions="100 ,auto,*"
ColumnDefinitions=".75*,.25*"
Padding="10"
RowSpacing="6"
ColumnSpacing="6">
<Entry
Placeholder="entrer matiere"
Grid.Row="1"
Text="{Binding ue}"
TextColor="Black"
BackgroundColor="AliceBlue"
WidthRequest="250"
/>
<Label Text="{Binding Nom}"></Label>
<Button Text="go" Command="{Binding gobackcommand}"></Button>
<Entry
Placeholder="coef"
VerticalOptions="start"
HorizontalOptions="start"
WidthRequest="100"
Grid.Row="1"
Grid.Column="1"
BackgroundColor="AliceBlue">
</Entry>
<Button Grid.Column="10" Grid.Row="1" VerticalOptions="end" HorizontalOptions="end" Text="ok" WidthRequest="50"></Button>
<CollectionView Grid.Row="2" Grid.Column="2" ItemsSource="{Binding items}" >
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type model:ue }">
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="delete"
BackgroundColor="Red"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:blocviewmodel}}, Path=deletecommand}"
CommandParameter="{Binding .}"
/>
</SwipeItems>
</SwipeView.RightItems>
<Grid Padding="0">
<Frame>
<Frame.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding Source={RelativeSource AncestorLevel={x:Type viewmodel:blocviewmodel}}, Path=tapcommand}"
CommandParameter="{Binding .}"/>
</Frame.GestureRecognizers>
<Label Text="{Binding intitulé}"
FontSize="10" TextColor="Black" />
</Frame>
</Grid>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</Frame>-->
</ContentPage>

@ -0,0 +1,9 @@
namespace CalculateurApp.View;
public partial class PageUe : ContentPage
{
public PageUe()
{
InitializeComponent();
}
}

@ -2,47 +2,76 @@
<TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewmodel="clr-namespace:CalculateurApp.ViewModel" xmlns:viewmodel="clr-namespace:CalculateurApp.ViewModel"
x:DataType="viewmodel:UeViewModel"
xmlns:model="clr-namespace:ClassCalculateurMoyenne;assembly=ClassCalculateurMoyenne" xmlns:model="clr-namespace:ClassCalculateurMoyenne;assembly=ClassCalculateurMoyenne"
x:Class="CalculateurApp.View.Start" x:Class="CalculateurApp.View.Start"
Title="StartPage" Title="StartPage"
BarTextColor="LightSalmon" BarTextColor="LightSalmon"
SelectedTabColor="DarkRed" SelectedTabColor="DarkRed"
UnselectedTabColor="DarkKhaki"> UnselectedTabColor="DarkKhaki">
<ContentPage Title=" Blocs " IconImageSource="mamoyenne.png" x:DataType="viewmodel:BlocViewModel"> <ContentPage Title=" Blocs " IconImageSource="mamoyenne.png" x:DataType="viewmodel:BlocViewModel">
<Grid RowDefinitions="100 ,Auto,*" <Grid RowDefinitions="100 ,Auto,*"
ColumnDefinitions=".75*,.25*" ColumnDefinitions=".75*,.25*"
Padding="10" Padding="10"
RowSpacing="10" RowSpacing="10"
ColumnSpacing="10"> ColumnSpacing="10">
<Image <Entry Placeholder=" UES DU BLOC "
Grid.ColumnSpan="2" Grid.Row="1"
Source="" Text="{Binding ue.Intitulé}"
BackgroundColor="Transparent"
/>
<Entry Placeholder="Entrer les UES"
Grid.Row="1"
Text="{Binding ue.Intitulé}"
TextColor="Black" TextColor="Black"
WidthRequest="150"
VerticalOptions="StartAndExpand"
HorizontalOptions="Start"
/> />
<Entry
Placeholder="coef"
WidthRequest="60"
Grid.Row="1"
HorizontalOptions="Center"
VerticalOptions="Center"
BackgroundColor="AliceBlue"
Text="{Binding ue.Coefficient}">
</Entry>
<!--<Label Text="{Binding Nom}"></Label> <!--<Label Text="{Binding Nom}"></Label>
<Button Text="go" Command="{Binding GoBackCommand}"></Button>--> <Button Text="go" Command="{Binding GoBackCommand}"></Button>-->
<Button <Button
Command="{Binding AddCommand}" Command="{Binding AddCommand}"
Text="Add" Text="Add"
Grid.Row="1" Grid.Row="1"
Grid.Column="1"> Grid.Column="1"
>
</Button> </Button>
<CollectionView Grid.Row="2" Grid.ColumnSpan="2" ItemsSource="{Binding Items}" > <CollectionView Grid.Row="2" Grid.ColumnSpan="2" ItemsSource="{Binding Items}" >
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type model:UE }"> <DataTemplate x:DataType="{x:Type model:UE }">
<SwipeView> <SwipeView>
<Grid Padding="10" ColumnSpacing="40">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Grid.Row="1"
Grid.Column="0"
Text="{Binding Intitulé}"
FontAttributes="None"
VerticalOptions="End"
/>
<Label Grid.Column="3"
Grid.Row="1"
Text="{Binding Coefficient}"
TextColor="Blue"
FontAttributes="Bold" />
<!--// <Button Text="DELETE"></Button>-->
</Grid>
</SwipeView>
<!--<SwipeView>
<SwipeView.RightItems> <SwipeView.RightItems>
<SwipeItems> <SwipeItems>
<SwipeItem Text="Delete" <SwipeItem Text="Delete"
@ -52,8 +81,8 @@
/> />
</SwipeItems> </SwipeItems>
</SwipeView.RightItems> </SwipeView.RightItems>
<Grid Padding="0"> <Grid Padding="0">-->
<Frame> <!--<Frame>
<Frame.GestureRecognizers> <Frame.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:BlocViewModel}}, Path=TapCommand}" Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:BlocViewModel}}, Path=TapCommand}"
@ -63,65 +92,62 @@
FontSize="10" TextColor="Black" /> FontSize="10" TextColor="Black" />
</Frame> </Frame>
</Grid> </Grid>
</SwipeView> </SwipeView>-->
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
</CollectionView> </CollectionView>
</Grid> </Grid>
</ContentPage> </ContentPage>
<ContentPage Title="UE" IconImageSource="mamoyenne.png" > <!--<ContentPage Title="ue" IconImageSource="mamoyenne.png" x:DataType="viewmodel:UeViewModel" >
<Frame Margin="10,0,10,0" VerticalOptions="Center"> <Frame Margin="10,0,10,0" VerticalOptions="center">
<Grid RowDefinitions="100 ,Auto,*" <Grid RowDefinitions="100 ,auto,*"
ColumnDefinitions=".75*,.25*" ColumnDefinitions=".75*,.25*"
Padding="10" Padding="10"
RowSpacing="6" RowSpacing="6"
ColumnSpacing="6"> ColumnSpacing="6">
<Entry <Entry
Placeholder="Entrer MATIERE" Placeholder="entrer matiere"
Grid.Row="1" Grid.Row="1"
Text="{Binding ue.Intitulé}" Text="{Binding ue.intitulé}"
TextColor="Black" TextColor="Black"
BackgroundColor="AliceBlue" BackgroundColor="AliceBlue"
WidthRequest="250" WidthRequest="250"
/> />
<!--<Label Text="{Binding Nom}"></Label> <Label Text="{Binding Nom}"></Label>
<Button Text="go" Command="{Binding GoBackCommand}"></Button>--> <Button Text="go" Command="{Binding gobackcommand}"></Button>
<Entry <Entry
Placeholder="Coef" Placeholder="coef"
VerticalOptions="Start" VerticalOptions="start"
HorizontalOptions="Start" HorizontalOptions="start"
WidthRequest="100" WidthRequest="100"
Grid.Row="1" Grid.Row="1"
Grid.Column="1" Grid.Column="1"
BackgroundColor="AliceBlue"> BackgroundColor="AliceBlue">
</Entry> </Entry>
<Button Grid.Column="10" Grid.Row="1" VerticalOptions="End" HorizontalOptions="End" Text="OK" WidthRequest="50"></Button> <Button Grid.Column="10" Grid.Row="1" VerticalOptions="end" HorizontalOptions="end" Text="ok" WidthRequest="50"></Button>
<CollectionView Grid.Row="2" Grid.ColumnSpan="2" ItemsSource="{Binding Items}" > <CollectionView Grid.Row="2" Grid.Column="2" ItemsSource="{Binding items}" >
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type model:UE }"> <DataTemplate x:DataType="{x:Type model:ue }">
<SwipeView> <SwipeView>
<SwipeView.RightItems> <SwipeView.RightItems>
<SwipeItems> <SwipeItems>
<SwipeItem Text="Delete" <SwipeItem Text="delete"
BackgroundColor="Red" BackgroundColor="Red"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:BlocViewModel}}, Path=DeleteCommand}" Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:blocviewmodel}}, Path=deletecommand}"
CommandParameter="{Binding .}" CommandParameter="{Binding .}"
/> />
</SwipeItems> </SwipeItems>
</SwipeView.RightItems> </SwipeView.RightItems>
<Grid Padding="0"> <Grid Padding="0">
<Frame> <Frame>
<Frame.GestureRecognizers> <Frame.GestureRecognizers>
<TapGestureRecognizer <TapGestureRecognizer
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:BlocViewModel}}, Path=TapCommand}" Command="{Binding Source={RelativeSource AncestorLevel={x:Type viewmodel:blocviewmodel}}, Path=tapcommand}"
CommandParameter="{Binding .}"/> CommandParameter="{Binding .}"/>
</Frame.GestureRecognizers> </Frame.GestureRecognizers>
<Label Text="{Binding Intitulé}" <Label Text="{Binding intitulé}"
FontSize="10" TextColor="Black" /> FontSize="10" TextColor="Black" />
</Frame> </Frame>
</Grid> </Grid>
@ -129,16 +155,9 @@
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
</CollectionView> </CollectionView>
</Grid>
</Grid>
</Frame> </Frame>
</ContentPage> </ContentPage>-->
<ContentPage Title="Matiere" IconImageSource="img.png" > <ContentPage Title="Matiere" IconImageSource="img.png" >

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CalculateurApp.View.UE"
Title="UE">
<Frame Margin="10,0,10,0" VerticalOptions="Center">
<Grid BackgroundColor="White" Padding="30,30,0,39"
RowSpacing="-400"
ColumnSpacing="10">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Text="MATIERE" Grid.Column="1" WidthRequest="150"></Label>
<Entry
Grid.Column="2"
BackgroundColor="White"
HorizontalOptions="Start"
VerticalOptions="Start"
WidthRequest="150"
Placeholder=" Nom de la matiere ">
</Entry>
<Label Text="COEFFICENT" Grid.Row="1" WidthRequest="150" Grid.Column="1"></Label>
<Entry
Grid.Row="1"
Grid.Column="2"
BackgroundColor="White"
HorizontalOptions="Start"
VerticalOptions="Start"
WidthRequest="150"
Placeholder=" Nom de la matiere ">
</Entry>
<Button Text="Annuler" HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="110" Grid.Column="0" ></Button>
<Button Text="Ajouter" HorizontalOptions="Start" VerticalOptions="Center" Grid.Column="2" WidthRequest="110"></Button>
</Grid>
</Frame>
</ContentPage>

@ -1,13 +0,0 @@
using CalculateurApp.ViewModel;
namespace CalculateurApp.View;
public partial class UE : ContentPage
{
public UE(UeViewModel u)
{
InitializeComponent();
BindingContext = u;
}
}

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewmodel="clr-namespace:CalculateurApp.ViewModel"
xmlns:model="clr-namespace:ClassCalculateurMoyenne;assembly=ClassCalculateurMoyenne"
x:DataType="viewmodel:UeViewModel"
x:Class="CalculateurApp.View.UEPage1"
Title="UEPage1">
<Frame Margin="10,0,10,0" >
<Grid RowDefinitions="100 ,auto,*"
ColumnDefinitions=".75*,.25*"
Padding="10"
RowSpacing="6"
ColumnSpacing="6">
<Entry
Placeholder="entrer matiere"
Grid.Row="1"
Text="{Binding ma.Nommatiere}"
TextColor="Black"
BackgroundColor="AliceBlue"
WidthRequest="250"
/>
<!--<Label Text="{Binding }"></Label>-->
<!--<Button Text="go" Command="{Binding AddCommand}"></Button>-->
<!--<Entry
Placeholder="coef"
WidthRequest="100"
Grid.Row="1"
Grid.Column="1"
BackgroundColor="AliceBlue"
Text="{Binding u.Coefficient}">
</Entry>-->
<Button Command="{Binding AddCommand}" Grid.Column="10" Grid.Row="1" Text="ok" WidthRequest="50">
</Button>
<CollectionView Grid.Row="2" Grid.Column="0" ItemsSource="{Binding Items}" >
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type model:Matiere }">
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="delete"
BackgroundColor="Red"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:UeViewModel}}, Path=deletecommand}"
CommandParameter="{Binding .}"
/>
</SwipeItems>
</SwipeView.RightItems>
<Grid Padding="0">
<Frame>
<Frame.GestureRecognizers>
<TapGestureRecognizer
CommandParameter="{Binding .}"/>
</Frame.GestureRecognizers>
<Label Text="{Binding Nommatiere}"
FontSize="10" TextColor="Black" />
</Frame>
</Grid>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<CollectionView Grid.Row="2" Grid.Column="0" ItemsSource="{Binding Items}" >
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type model:Matiere }">
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="delete"
BackgroundColor="Red"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:UeViewModel}}, Path=deletecommand}"
CommandParameter="{Binding .}"
/>
</SwipeItems>
</SwipeView.RightItems>
<Grid Padding="0">
<Frame>
<Frame.GestureRecognizers>
<TapGestureRecognizer
CommandParameter="{Binding .}"/>
</Frame.GestureRecognizers>
<Label Text="{Binding Nommatiere}"
FontSize="10" TextColor="Black" />
</Frame>
</Grid>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</Frame>
</ContentPage>

@ -0,0 +1,12 @@
using CalculateurApp.ViewModel;
namespace CalculateurApp.View;
public partial class UEPage1 : ContentPage
{
public UEPage1()
{
InitializeComponent();
BindingContext = new UeViewModel();
}
}

@ -10,11 +10,10 @@ using System.Threading.Tasks;
namespace CalculateurApp.ViewModel namespace CalculateurApp.ViewModel
{ {
[QueryProperty("Nom", "Nom")] // [QueryProperty("Nom", "Nom")]
public partial class BlocViewModel:ObservableObject public partial class BlocViewModel:ObservableObject
{ {
[ObservableProperty]
string nom;
[RelayCommand] [RelayCommand]
async Task GoBack() async Task GoBack()
{ {
@ -25,23 +24,26 @@ namespace CalculateurApp.ViewModel
public BlocViewModel() public BlocViewModel()
{ {
Items = new ObservableCollection<UE>(); Items = new ObservableCollection<UE>();
blocModel=new BlocModel(); blocModel=new BlocModel();
ue = new UE(); ue = new UE();
} }
[ObservableProperty] [ObservableProperty]
ObservableCollection<UE> items; ObservableCollection<UE> items;
[ObservableProperty]
string intitulé;
[RelayCommand] [RelayCommand]
void Add() void Add()
{ {
if (string.IsNullOrEmpty(ue.Intitulé)) if (string.IsNullOrEmpty(ue.Intitulé)&& string.IsNullOrEmpty(ue.Coefficient.ToString()))
return; return;
UE u = new UE(ue.Intitulé); UE u = new UE(ue.Intitulé,ue.Coefficient);
//u.Intitulé = ue.Intitulé; //u.Intitulé = ue.Intitulé;
Items.Add(u); Items.Add(u);
ue.Intitulé = string.Empty; ue.Intitulé = string.Empty;
ue.Coefficient = 0;
} }
[RelayCommand] [RelayCommand]
void Delete(UE bl) void Delete(UE bl)

@ -21,8 +21,6 @@ namespace CalculateurApp.ViewModel
Items = new ObservableCollection<BlocModel>(); Items = new ObservableCollection<BlocModel>();
blocModel = new BlocModel(); blocModel = new BlocModel();
} }
[ObservableProperty] [ObservableProperty]
ObservableCollection<BlocModel> items; ObservableCollection<BlocModel> items;

@ -1,24 +1,73 @@
using CommunityToolkit.Mvvm.ComponentModel; using ClassCalculateurMoyenne;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace CalculateurApp.ViewModel namespace CalculateurApp.ViewModel
{ {
[QueryProperty("Nom", "Nom")] // [QueryProperty("Nom", "Nom")]
public partial class UeViewModel:ObservableObject public partial class UeViewModel:ObservableObject
{ {
//[ObservableProperty]
//string nom;
//[RelayCommand]
//async Task GoBack()
//{
// await Shell.Current.GoToAsync("..");
//}
public UE u { get; set; }
public Matiere ma { get; set; }
public UeViewModel()
{
Tems = new ObservableCollection<Matiere>();
Items = new ObservableCollection<Matiere>();
ma = new Matiere();
u = new UE();
}
[ObservableProperty] [ObservableProperty]
string nom; ObservableCollection<Matiere> items;
[ObservableProperty]
ObservableCollection<Matiere> tems;
[ObservableProperty]
string coefficient;
[ObservableProperty]
string nommatiere;
[RelayCommand]
void Add()
{
if (string.IsNullOrEmpty(ma.Nommatiere))
return;
Matiere m = new Matiere(ma.Nommatiere);
Items.Add(m);
ma.Nommatiere = string.Empty;
}
[RelayCommand] [RelayCommand]
async Task GoBack() void AddCoefUE()
{ {
await Shell.Current.GoToAsync("..");
} }
[RelayCommand]
void Delete(Matiere bl)
{
if (Items.Contains(bl))
{
Items.Remove(bl);
}
}
} }
} }

@ -63,9 +63,9 @@ namespace CalculateurMapping
bool result = false; bool result = false;
using (var context = new CalculContext()) using (var context = new CalculContext())
{ {
BlocEntity entity = context.Bloc.Find(data.id); BlocEntity entity = context.Bloc.Find(data.Id);
entity.Nom = data.Nom ; entity.Nom = data.Nom ;
entity.UE = data.ue.Select(j => new UEentity entity.ue = data.ue.Select(j => new UEentity
{ {
intitulé = j.Intitulé, intitulé = j.Intitulé,
}).ToList(); }).ToList();

@ -11,9 +11,9 @@ using System.Threading.Tasks;
namespace CalculateurMapping namespace CalculateurMapping
{ {
public class MaquetteDbDataManager : IDataManager<Maquette> public class MaquetteDbDataManager : IDataManager<MaquetteModel>
{ {
public async Task<bool> Add(Maquette mqt) public async Task<bool> Add(MaquetteModel mqt)
{ {
bool result = false; bool result = false;
using (var context = new CalculContext()) using (var context = new CalculContext())
@ -41,7 +41,7 @@ namespace CalculateurMapping
} }
public async Task<bool> Delete(Maquette maquette) public async Task<bool> Delete(MaquetteModel maquette)
{ {
bool result = false; bool result = false;
using (var context = new CalculContext()) using (var context = new CalculContext())
@ -54,11 +54,11 @@ namespace CalculateurMapping
return result; return result;
} }
public async Task<IEnumerable<Maquette>> GetAll() public async Task<IEnumerable<MaquetteModel>> GetAll()
{ {
using (var context = new CalculContext()) using (var context = new CalculContext())
{ {
return await context.Maquettes.Select(e => new Maquette return await context.Maquettes.Select(e => new MaquetteModel
( e.Id, ( e.Id,
e.NomMaquette, e.NomMaquette,
e.Bloc.Select(j => new BlocModel(j.Nom)).ToArray() e.Bloc.Select(j => new BlocModel(j.Nom)).ToArray()
@ -66,11 +66,11 @@ namespace CalculateurMapping
} }
} }
public async Task<Maquette> GetDataWithName(string name) public async Task<MaquetteModel> GetDataWithName(string name)
{ {
using (var context = new CalculContext()) using (var context = new CalculContext())
{ {
return await context.Maquettes.Where(e => e.NomMaquette == name).Select(e => new Maquette return await context.Maquettes.Where(e => e.NomMaquette == name).Select(e => new MaquetteModel
( (
e.Id, e.Id,
e.NomMaquette, e.NomMaquette,
@ -79,7 +79,7 @@ namespace CalculateurMapping
} }
} }
public async Task<bool> Update(Maquette data) public async Task<bool> Update(MaquetteModel data)
{ {
bool result = false; bool result = false;
using (var context = new CalculContext()) using (var context = new CalculContext())

@ -0,0 +1,61 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestCalculateurMoyanne", "..\Tests\TestCalculateurMoyanne\TestCalculateurMoyanne.csproj", "{707F316F-3141-4201-82FA-76E8B1E6A16C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassCalculateurMoyenne", "ClassCalculateurMoyenne\ClassCalculateurMoyenne.csproj", "{546A7EF0-BA4F-44A5-A4C3-2B173703A417}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StubCalculateur", "CalculateurStub\StubCalculateur.csproj", "{FF7D3A70-4FDD-47BF-859E-A25F88593F62}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CalculateurEF", "CalculateurEF\CalculateurEF.csproj", "{E265F701-B0ED-4EFF-ADAF-17B3E65E007F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CalculateurMapping", "CalculateurMapping\CalculateurMapping.csproj", "{2CF7DDB5-2FD8-4D80-9D5F-9C8DD12B8518}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BSN", "BSN\BSN.csproj", "{EE834623-6D68-4016-94B9-FF3AC58C0E15}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "testttt", "testttt\testttt.csproj", "{3030B3CE-5F2F-451A-9F07-AE2CA9351BD0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{707F316F-3141-4201-82FA-76E8B1E6A16C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{707F316F-3141-4201-82FA-76E8B1E6A16C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{707F316F-3141-4201-82FA-76E8B1E6A16C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{707F316F-3141-4201-82FA-76E8B1E6A16C}.Release|Any CPU.Build.0 = Release|Any CPU
{546A7EF0-BA4F-44A5-A4C3-2B173703A417}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{546A7EF0-BA4F-44A5-A4C3-2B173703A417}.Debug|Any CPU.Build.0 = Debug|Any CPU
{546A7EF0-BA4F-44A5-A4C3-2B173703A417}.Release|Any CPU.ActiveCfg = Release|Any CPU
{546A7EF0-BA4F-44A5-A4C3-2B173703A417}.Release|Any CPU.Build.0 = Release|Any CPU
{FF7D3A70-4FDD-47BF-859E-A25F88593F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF7D3A70-4FDD-47BF-859E-A25F88593F62}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF7D3A70-4FDD-47BF-859E-A25F88593F62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF7D3A70-4FDD-47BF-859E-A25F88593F62}.Release|Any CPU.Build.0 = Release|Any CPU
{E265F701-B0ED-4EFF-ADAF-17B3E65E007F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E265F701-B0ED-4EFF-ADAF-17B3E65E007F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E265F701-B0ED-4EFF-ADAF-17B3E65E007F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E265F701-B0ED-4EFF-ADAF-17B3E65E007F}.Release|Any CPU.Build.0 = Release|Any CPU
{2CF7DDB5-2FD8-4D80-9D5F-9C8DD12B8518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2CF7DDB5-2FD8-4D80-9D5F-9C8DD12B8518}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CF7DDB5-2FD8-4D80-9D5F-9C8DD12B8518}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2CF7DDB5-2FD8-4D80-9D5F-9C8DD12B8518}.Release|Any CPU.Build.0 = Release|Any CPU
{EE834623-6D68-4016-94B9-FF3AC58C0E15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE834623-6D68-4016-94B9-FF3AC58C0E15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE834623-6D68-4016-94B9-FF3AC58C0E15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE834623-6D68-4016-94B9-FF3AC58C0E15}.Release|Any CPU.Build.0 = Release|Any CPU
{3030B3CE-5F2F-451A-9F07-AE2CA9351BD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3030B3CE-5F2F-451A-9F07-AE2CA9351BD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3030B3CE-5F2F-451A-9F07-AE2CA9351BD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3030B3CE-5F2F-451A-9F07-AE2CA9351BD0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
EndGlobalSection
EndGlobal

@ -12,9 +12,9 @@ namespace StubCalculateur.Stub
{ {
private List<BlocModel> listb = new List<BlocModel>(); private List<BlocModel> listb = new List<BlocModel>();
public List<UE> ues = new List<UE>(); public List<UE> ues = new List<UE>();
private List<Maquette> lstmqt = new List<Maquette>(); private List<MaquetteModel> lstmqt = new List<MaquetteModel>();
public bool Delete(Maquette data) public bool Delete(MaquetteModel data)
{ {
if (data != null) if (data != null)
{ {
@ -23,7 +23,7 @@ namespace StubCalculateur.Stub
} }
return false; return false;
} }
public bool Add(Maquette data) public bool Add(MaquetteModel data)
{ {
if(data != null) if(data != null)
{ {
@ -33,11 +33,29 @@ namespace StubCalculateur.Stub
return false; return false;
} }
public IEnumerable<Maquette> GetAll() public async Task<IEnumerable<MaquetteModel>> GetAll()
{ {
return lstmqt; return lstmqt;
} }
public IEnumerable<Maquette> GetAllUeBloc(int n = 10) public async Task<IEnumerable<MaquetteModel>> GetAllMaquette(int n = 10)
{
for (int i = 0; i < n; i++)
{
Add(new MaquetteModel("Maquette " + i + 1));
}
return lstmqt;
}
public async Task<bool> Update(MaquetteModel data)
{
if (data != null)
{
int index = lstmqt.FindIndex(x => x.BLOCS == data.BLOCS);
lstmqt[index] = data;
}
return false;
}
public IEnumerable<MaquetteModel> GetAllUeBloc(int n = 10)
{ {
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
{ {

@ -44,6 +44,10 @@ namespace ClassCalculateurMoyenne
this.uEs = uEs; this.uEs = uEs;
} }
public BlocModel()
{
}
private IEnumerable<UE> Ajouterue(params UE[] ues) private IEnumerable<UE> Ajouterue(params UE[] ues)
{ {
List<UE> result = new(); List<UE> result = new();

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace ClassCalculateurMoyenne namespace ClassCalculateurMoyenne
{ {
public class Maquette public class MaquetteModel:IEquatable<MaquetteModel>
{ {
public int Id; public int Id;
public ReadOnlyCollection<UE> UES { get; set; } public ReadOnlyCollection<UE> UES { get; set; }
@ -21,19 +21,25 @@ namespace ClassCalculateurMoyenne
private readonly List<BlocModel> blocs = new List<BlocModel>(); private readonly List<BlocModel> blocs = new List<BlocModel>();
private object value; private object value;
public Maquette(List<UE> u, List<BlocModel> blc) public MaquetteModel(List<UE> u, List<BlocModel> blc)
{ {
UES = new ReadOnlyCollection<UE>(u); UES = new ReadOnlyCollection<UE>(u);
BLOCS = new ReadOnlyCollection<BlocModel>(blc); BLOCS = new ReadOnlyCollection<BlocModel>(blc);
} }
public Maquette(long id,string nomMaquette, object value) public MaquetteModel(long id,string nomMaquette, object value)
{ {
Id = Id; Id = Id;
NomMaquette = nomMaquette; NomMaquette = nomMaquette;
this.value = value; this.value = value;
} }
public MaquetteModel( string nomMaquette)
{
NomMaquette = nomMaquette;
}
public void supprimer(UE e) public void supprimer(UE e)
{ {
@ -84,7 +90,28 @@ namespace ClassCalculateurMoyenne
return false; return false;
} }
public bool Equals(MaquetteModel other)
{
return Equals(other.NomMaquette);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(obj, null)) return false;
if (ReferenceEquals(obj, this)) return true;
if (GetType() != obj.GetType()) return false;
return Equals(obj as UE);
}
public MaquetteModel(string nomMaquette, int id)
{
NomMaquette = nomMaquette;
Id = id;
}
public void setNomMaquete(string nom)
{
NomMaquette =nom;
}
} }
} }

@ -1,4 +1,5 @@
using System; using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -6,13 +7,17 @@ using System.Threading.Tasks;
namespace ClassCalculateurMoyenne namespace ClassCalculateurMoyenne
{ {
public class Matiere public class Matiere
{ {
public long Id { get; set; } public long Id { get; set; }
public string Nommatiere { get; set; } public string Nommatiere { get; set; }
public int Note { get; set; } public int Note { get; set; }
public int Coef { get; set; } public int Coef { get; set; }
public Matiere()
{
}
public Matiere(long id ,int note, string nommatiere, int coef) public Matiere(long id ,int note, string nommatiere, int coef)
{ {
Id = id; Id = id;

@ -7,7 +7,8 @@ namespace ClassCalculateurMoyenne
{ public long Id { get; set; } { public long Id { get; set; }
public ReadOnlyCollection<Matiere> Matieres { get; private set; } public ReadOnlyCollection<Matiere> Matieres { get; private set; }
private readonly List<Matiere> matieres = new List<Matiere>(); private readonly List<Matiere> matieres = new List<Matiere>();
public int Coefficient { get; set; } [ObservableProperty]
private int coefficient;
[ObservableProperty] [ObservableProperty]
private string intitulé; private string intitulé;
@ -36,8 +37,11 @@ namespace ClassCalculateurMoyenne
} }
public UE() { } public UE() { }
public UE(string intitulé, int coefficient) : this(intitulé) public UE(string intitulé, int coefficient)
{ {
Intitulé = intitulé;
Coefficient = coefficient;
} }
public override string ToString() public override string ToString()

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestCalculateurMoyanne.LesTests
{
public class UnitTestBloc
{
}
}

@ -0,0 +1,80 @@
using ClassCalculateurMoyenne;
using StubCalculateur.Stub;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestCalculateurMoyanne.LesTests
{
public class UnitTestMaquette
{
MaquetteModel m = new MaquetteModel("L3");
[Fact]
public void Test()
{
Assert.NotNull(m);
Assert.Equal("L3", m.NomMaquette);
Assert.NotEqual("E3", m.NomMaquette);
}
[Fact]
public void TestInvalidMaquette()
{
Assert.Throws<ArgumentException>(() => new MaquetteModel(null));
}
public class maquette_InlineData
{
[Theory]
[InlineData(false, "L6", 2, "L3", 2)]
[InlineData(false, "", 0, "", 0)]
[InlineData(true, "M1", 0, "M1", 0)]
public void TestConstructor(bool isValid, string expectedNomMaquette, int expectedId,
string NomMaquette, int id)
{
if (!isValid)
{
Assert.Throws<ArgumentException>(
() => new UE(NomMaquette, id));
return;
}
MaquetteModel m = new MaquetteModel(NomMaquette, id);
Assert.Equal(expectedNomMaquette, m.NomMaquette);
Assert.Equal(expectedId, m.Id);
}
// test avec stub
[Fact]
public void TestMaquetteStub()
{
StubMaquette stub = new StubMaquette();
Assert.Equal(10, stub.GetAllMaquette(10).Result.Count());
}
[Fact]
public void TestRemove()
{
StubMaquette stub = new StubMaquette();
MaquetteModel e = new MaquetteModel("L1");
stub.Add(e);
stub.Delete(e);
//Compter le nombre de Maq dans un objet IEnumerable
Assert.Equal(0, stub.GetAll().Result.Count());
}
public void TestUpdate()
{
StubMaquette stub = new StubMaquette();
MaquetteModel e = new MaquetteModel("E1");
stub.Add(e);
e.setNomMaquete ("L1");
stub.Update(e);
Assert.Equal("L1", stub.GetAll().Result.First().NomMaquette);
}
}
}
}

@ -11,14 +11,10 @@ namespace TestCalculateurMoyanne.LesTests
{ {
public class UnitTestUE public class UnitTestUE
{ {
UE e = new UE("E2"); UE e = new UE("E2");
private bool isEqual; private bool isEqual;
[Fact] [Fact]
public void Test() public void Test()
{ {
Assert.NotNull(e); Assert.NotNull(e);

Loading…
Cancel
Save