ADD : Nav Button Command Popup (ToTest)

commands-19-09
Lou BRODA 1 year ago
parent 2bc8da6200
commit 60547644be

@ -4,8 +4,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LivreLand", "LivreLand\LivreLand.csproj", "{0E95A11F-0D16-4CC3-82CD-E3BE44C28B2B}"
ProjectSection(ProjectDependencies) = postProject
{7DB41B43-9DAA-48C8-8D41-EF2F06FDD33E} = {7DB41B43-9DAA-48C8-8D41-EF2F06FDD33E}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "Model\Model.csproj", "{7DB41B43-9DAA-48C8-8D41-EF2F06FDD33E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "Model\Model.csproj", "{7DB41B43-9DAA-48C8-8D41-EF2F06FDD33E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ViewModels", "ViewModels\ViewModels.csproj", "{72B707A3-3797-4F15-80BC-9D5ECA7B67EE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -23,6 +28,10 @@ Global
{7DB41B43-9DAA-48C8-8D41-EF2F06FDD33E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DB41B43-9DAA-48C8-8D41-EF2F06FDD33E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DB41B43-9DAA-48C8-8D41-EF2F06FDD33E}.Release|Any CPU.Build.0 = Release|Any CPU
{72B707A3-3797-4F15-80BC-9D5ECA7B67EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72B707A3-3797-4F15-80BC-9D5ECA7B67EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72B707A3-3797-4F15-80BC-9D5ECA7B67EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72B707A3-3797-4F15-80BC-9D5ECA7B67EE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -78,6 +78,9 @@
<MauiXaml Update="View\ContentViews\PopupHomePlusButtonView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="View\ContentViews\PopupISBNView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="View\ContentViews\PopupLetterView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>

@ -23,8 +23,10 @@ public static class MauiProgram
.AddSingleton<NavigatorVM>()
.AddSingleton<BibliothequeView>();
//Ajouter des Singletons <ILibraryManager, LibraryStub>, Manager et ManagerVm
#if DEBUG
builder.Logging.AddDebug();
builder.Logging.AddDebug();
#endif
return builder.Build();

@ -22,7 +22,8 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<view:HeaderHome Grid.Row="0"/>
<view:HeaderHome Grid.Row="0"
ButtonTappedCommand="{Binding Navigator.PopupHomePlusNavigationCommand}"/>
<ScrollView Grid.Row="2">
<Grid>
<Grid.RowDefinitions>

@ -118,6 +118,9 @@
</Image.Behaviors>
</Image>
</Grid>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Navigator.PopupISBNNavigationCommand}"/>
</Grid.GestureRecognizers>
</Grid>
<Border.StrokeShape>
<RoundRectangle CornerRadius="10" />

@ -1,12 +1,27 @@
using CommunityToolkit.Maui.Views;
using LivreLand.ViewModel;
namespace LivreLand.View.ContentViews;
public partial class PopupHomePlusButtonView : Popup
{
public PopupHomePlusButtonView()
#region Properties
public NavigatorVM Navigator { get; private set; }
#endregion
#region Constructor
public PopupHomePlusButtonView(NavigatorVM navigatorVM)
{
InitializeComponent();
Navigator = navigatorVM;
InitializeComponent();
Size = new Size(0.8 * (DeviceDisplay.Current.MainDisplayInfo.Width / DeviceDisplay.Current.MainDisplayInfo.Density), 0.5 * (DeviceDisplay.Current.MainDisplayInfo.Width / DeviceDisplay.Current.MainDisplayInfo.Density));
}
BindingContext = this;
}
#endregion
}

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:contentView="clr-namespace:LivreLand.View.ContentViews"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="LivreLand.View.ContentViews.PopupISBNView"
HorizontalOptions="Center"
VerticalOptions="Center"
Color="Transparent">
<Border>
<Grid BackgroundColor="{AppThemeBinding Light={StaticResource PopupBackground}, Dark={StaticResource Black}}">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0"
Margin="5">
<Label Text="Saisir l'ISBN"
Style="{StaticResource MasterStateBookText}"/>
</Grid>
<Grid Grid.Row="1"
Margin="5">
<Entry />
</Grid>
</Grid>
<Border.StrokeShape>
<RoundRectangle CornerRadius="10" />
</Border.StrokeShape>
</Border>
</toolkit:Popup>

@ -0,0 +1,12 @@
using CommunityToolkit.Maui.Views;
namespace LivreLand.View.ContentViews;
public partial class PopupISBNView : Popup
{
public PopupISBNView()
{
InitializeComponent();
Size = new Size(0.8 * (DeviceDisplay.Current.MainDisplayInfo.Width / DeviceDisplay.Current.MainDisplayInfo.Density), 0.5 * (DeviceDisplay.Current.MainDisplayInfo.Width / DeviceDisplay.Current.MainDisplayInfo.Density));
}
}

@ -2,9 +2,11 @@
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="LivreLand.View.HeaderHome">
x:Class="LivreLand.View.HeaderHome"
x:Name="this">
<Grid ColumnDefinitions="auto, *, auto"
<Grid BindingContext="{x:Reference this}"
ColumnDefinitions="auto, *, auto"
Margin="5">
<Grid>
<Label Text="Modifier"
@ -18,8 +20,8 @@
BackgroundColor="Transparent"
MaximumHeightRequest="20"
MaximumWidthRequest="20"
Clicked="OnPlusClicked"
Grid.Column="2">
Grid.Column="2"
Command="{Binding ButtonTappedCommand}">
<ImageButton.Behaviors>
<toolkit:IconTintColorBehavior TintColor="{StaticResource PinkOrange}"/>
</ImageButton.Behaviors>

@ -1,18 +1,30 @@
using CommunityToolkit.Maui.Views;
using LivreLand.View.ContentViews;
using LivreLand.ViewModel;
using System.Windows.Input;
namespace LivreLand.View;
public partial class HeaderHome : ContentView
{
public HeaderHome()
{
InitializeComponent();
}
public void OnPlusClicked(object sender, EventArgs e)
#region Properties
public NavigatorVM Navigator { get; private set; }
public static readonly BindableProperty ButtonTappedCommandProperty = BindableProperty.Create(nameof(ButtonTappedCommand), typeof(ICommand), typeof(HeaderPage));
public ICommand ButtonTappedCommand
{
var plusPopup = new PopupHomePlusButtonView();
App.Current.MainPage.ShowPopup(plusPopup);
get { return (ICommand)GetValue(ButtonTappedCommandProperty); }
set { SetValue(ButtonTappedCommandProperty, value); }
}
#endregion
#region Constructor
public HeaderHome()
{
InitializeComponent();
}
#endregion
}

@ -4,10 +4,10 @@
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="LivreLand.View.HeaderPage"
x:Name="this"
BindingContext="{x:Reference this}"
BackgroundColor="{AppThemeBinding Light={Binding HeaderColor}, Dark={StaticResource Black}}">
<Grid Margin="5">
<Grid BindingContext="{x:Reference this}"
Margin="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
@ -40,7 +40,7 @@
Style="{StaticResource HeaderTitle}"
Grid.Column="2"/>
<Grid.GestureRecognizers>
<TapGestureRecognizer Tapped="OnBackButtonTapped"/>
<TapGestureRecognizer Command="{Binding PopupBackButtonNavigationCommand}"/>
</Grid.GestureRecognizers>
</Grid>
<ImageButton VerticalOptions="Center"
@ -49,7 +49,7 @@
MaximumHeightRequest="20"
MaximumWidthRequest="20"
IsVisible="{Binding HeaderPlusButtonVisible}"
Clicked="OnPlusClicked"
Command="{Binding ButtonTappedCommand}"
Grid.Column="2">
<ImageButton.Behaviors>
<toolkit:IconTintColorBehavior TintColor="{StaticResource PinkOrange}"/>

@ -2,11 +2,18 @@ using LivreLand.View.ContentViews;
using Microsoft.Maui.ApplicationModel;
using Microsoft.Maui.Graphics;
using CommunityToolkit.Maui.Views;
using System.Windows.Input;
using LivreLand.ViewModel;
namespace LivreLand.View;
public partial class HeaderPage : ContentView
{
#region Properties
public NavigatorVM Navigator { get; private set; }
public static readonly BindableProperty HeaderTitleProperty = BindableProperty.Create(nameof(HeaderTitle), typeof(string), typeof(HeaderPage), string.Empty);
public string HeaderTitle
{
@ -42,19 +49,29 @@ public partial class HeaderPage : ContentView
set => SetValue(HeaderPage.HeaderColorProperty, value);
}
public static readonly BindableProperty ButtonPlusTappedCommandProperty = BindableProperty.Create(nameof(ButtonPlusTappedCommand), typeof(ICommand), typeof(HeaderPage));
public ICommand ButtonPlusTappedCommand
{
get { return (ICommand)GetValue(ButtonPlusTappedCommandProperty); }
set { SetValue(ButtonPlusTappedCommandProperty, value); }
}
public static readonly BindableProperty ButtonBackTappedCommandProperty = BindableProperty.Create(nameof(ButtonBackTappedCommand), typeof(ICommand), typeof(HeaderPage));
public ICommand ButtonBackTappedCommand
{
get { return (ICommand)GetValue(ButtonBackTappedCommandProperty); }
set { SetValue(ButtonBackTappedCommandProperty, value); }
}
#endregion
#region Constructor
public HeaderPage()
{
InitializeComponent();
}
public void OnBackButtonTapped(object sender, EventArgs e)
{
App.Current.MainPage.Navigation.PopAsync();
}
#endregion
public void OnPlusClicked(object sender, EventArgs e)
{
var plusPopup = new PopupHomePlusButtonView();
App.Current.MainPage.ShowPopup(plusPopup);
}
}

@ -3,8 +3,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:view="clr-namespace:LivreLand.View"
xmlns:contentView="clr-namespace:LivreLand.View.ContentViews"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="LivreLand.View.TousView"
Title="TousView">
<!--<ContentPage.Behaviors>
<toolkit:EventToCommandBehavior />
</ContentPage.Behaviors>-->
<Grid>
<Grid.RowDefinitions>
@ -17,7 +22,9 @@
HeaderBackButtonText="Mes livres"
HeaderPlusButtonVisible="True"
HeaderSwitchButtonVisible="True"
Grid.Row="0"/>
Grid.Row="0"
ButtonPlusTappedCommand="{Binding Navigator.PopupHomePlusNavigationCommand}"
ButtonBackTappedCommand="{Binding Navigator.PopupBackButtonNavigationCommand}"/>
<ScrollView Grid.Row="2">
<Grid>
<Grid.RowDefinitions>
@ -44,7 +51,6 @@
</Grid>
<CollectionView ItemsSource="{Binding DamasioBooks}"
SelectionMode="Single"
SelectionChanged="OnSelectionChanged"
Grid.Row="2">
<CollectionView.ItemTemplate>
<DataTemplate>

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LivreLand.ViewModel
{
class BookVM
{
//public Book Model
//{
// get => model;
// set => model = value;
//}
//private Book model;
//public BookVM()
//{
// Model = model;
//}
//public string Title
//{
// get => model.Title;
// set
// {
// model.Title = value;
// }
//}
}
}

@ -1,4 +1,6 @@
using LivreLand.View;
using CommunityToolkit.Maui.Views;
using LivreLand.View;
using LivreLand.View.ContentViews;
using System;
using System.Collections.Generic;
using System.Linq;
@ -21,6 +23,9 @@ namespace LivreLand.ViewModel
public ICommand AuteurNavigationCommand { get; }
public ICommand DatePublicationNavigationCommand { get; }
public ICommand NoteNavigationCommand { get; }
public ICommand PopupHomePlusNavigationCommand { get; }
public ICommand PopupISBNNavigationCommand { get; }
public ICommand PopupBackButtonNavigationCommand { get; }
#endregion
@ -36,6 +41,9 @@ namespace LivreLand.ViewModel
AuteurNavigationCommand = new Command(() => Navigator.PushAsync(new FiltrageAuteurView()));
DatePublicationNavigationCommand = new Command(() => Navigator.PushAsync(new FiltrageDateView()));
NoteNavigationCommand = new Command(() => Navigator.PushAsync(new FiltrageNoteView()));
PopupHomePlusNavigationCommand = new Command(() => App.Current.MainPage.ShowPopup(new PopupHomePlusButtonView(this)));
PopupISBNNavigationCommand = new Command(() => App.Current.MainPage.ShowPopup(new PopupISBNView()));
PopupBackButtonNavigationCommand = new Command(() => App.Current.MainPage.Navigation.PopAsync());
}
#endregion

@ -0,0 +1,23 @@
using System.Windows.Input;
namespace ViewModels
{
public class ManagerVM
{
//public Manager Model
//{
// get => model;
// private set => model = value;
//}
//private Manager model;
//public ICommand GetBooksByTitleCommand;
//public ManagerVM(Manager model)
//{
// Model = model;
// GetBooksByTitleCommand = new Command(async () =>
// )
//}
}
}

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