Merge dev-binding -> dev-binding-album
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
c25a43c415
@ -0,0 +1,21 @@
|
||||
<?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="Linaris.AddPlaylistPage"
|
||||
Title="AddPlaylistPage">
|
||||
<VerticalStackLayout BackgroundColor="#404040">
|
||||
<Frame Margin="10" CornerRadius="75" HeightRequest="150" WidthRequest="150" IsClippedToBounds="True" HorizontalOptions="Center" VerticalOptions="Center">
|
||||
<Image Source="{Binding ImageURL}" Aspect="AspectFill" WidthRequest="150" HeightRequest="150" Margin="-20" IsAnimationPlaying="True">
|
||||
<Image.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="ChangeImage"/>
|
||||
</Image.GestureRecognizers>
|
||||
</Image>
|
||||
</Frame>
|
||||
<Entry Text="{Binding Name}" WidthRequest="300" Placeholder="Nom de la playlist" TextColor="White" Margin="0,20,0,20" VerticalOptions="Center" HorizontalOptions="Center"/>
|
||||
<Entry Text="{Binding Description}" WidthRequest="300" HeightRequest="150" Placeholder="Description de la playlist" VerticalTextAlignment="Start" TextColor="White" Margin="0,20,0,20" VerticalOptions="Center" HorizontalOptions="Center"/>
|
||||
<HorizontalStackLayout HorizontalOptions="Center" Margin="10" Spacing="15">
|
||||
<Button Text="Créer la playlist" BackgroundColor="green" FontSize="20" Clicked="AddPlaylist"/>
|
||||
<Button Text="Annuler" BackgroundColor="red" FontSize="20" Clicked="Cancel"/>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
@ -0,0 +1,58 @@
|
||||
using Model;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Linaris;
|
||||
|
||||
public partial class AddPlaylistPage : ContentPage
|
||||
{
|
||||
public Playlist NewPlaylist { get; } = new Playlist();
|
||||
|
||||
public AddPlaylistPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = NewPlaylist;
|
||||
}
|
||||
|
||||
private async void ChangeImage(object sender, EventArgs e)
|
||||
{
|
||||
var result = await FilePicker.PickAsync(new PickOptions
|
||||
{
|
||||
PickerTitle = "Choisissez une nouvelle image !",
|
||||
FileTypes = FilePickerFileType.Images
|
||||
});
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender is Image image)
|
||||
{
|
||||
if (image.BindingContext is Playlist playlist)
|
||||
{
|
||||
playlist.ImageURL = result.FullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Cancel(object sender, EventArgs e)
|
||||
{
|
||||
Navigation.PopModalAsync();
|
||||
}
|
||||
|
||||
private async void AddPlaylist(object sender, EventArgs e)
|
||||
{
|
||||
if ((Application.Current as App).Manager.GetPlaylistByName(NewPlaylist.Name) != null)
|
||||
{
|
||||
await DisplayAlert("Erreur !", "La playlist existe déjà", "OK");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(NewPlaylist.Name))
|
||||
{
|
||||
await DisplayAlert("Erreur !", "Le nom de la playlist ne doit pas être vide !", "OK");
|
||||
return;
|
||||
}
|
||||
(Application.Current as App).Manager.AddPlaylist(NewPlaylist);
|
||||
await Navigation.PopModalAsync();
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?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="Linaris.EditPlaylistPage"
|
||||
Title="EditPlaylistPage">
|
||||
<VerticalStackLayout BackgroundColor="#404040">
|
||||
<Frame Margin="10" CornerRadius="75" HeightRequest="150" WidthRequest="150" IsClippedToBounds="True" HorizontalOptions="Center" VerticalOptions="Center">
|
||||
<Image Source="{Binding ImageURL}" Aspect="AspectFill" WidthRequest="150" HeightRequest="150" Margin="-20" IsAnimationPlaying="True">
|
||||
<Image.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="ChangeImage"/>
|
||||
</Image.GestureRecognizers>
|
||||
</Image>
|
||||
</Frame>
|
||||
<Entry Text="{Binding Name}" WidthRequest="300" Placeholder="Nom de la playlist" TextColor="White" Margin="0,20,0,20" VerticalOptions="Center" HorizontalOptions="Center"/>
|
||||
<Entry Text="{Binding Description}" WidthRequest="300" HeightRequest="150" Placeholder="Description de la playlist" VerticalTextAlignment="Start" TextColor="White" Margin="0,20,0,20" VerticalOptions="Center" HorizontalOptions="Center"/>
|
||||
<HorizontalStackLayout HorizontalOptions="Center" Margin="10" Spacing="15">
|
||||
<Button Text="Modifier la playlist" BackgroundColor="green" FontSize="20" Clicked="EditPlaylist"/>
|
||||
<Button Text="Annuler" BackgroundColor="red" FontSize="20" Clicked="Cancel"/>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
@ -0,0 +1,62 @@
|
||||
using Model;
|
||||
using Model.Stub;
|
||||
|
||||
namespace Linaris;
|
||||
|
||||
public partial class EditPlaylistPage : ContentPage
|
||||
{
|
||||
|
||||
private Playlist playlist;
|
||||
|
||||
public Playlist Playlist { get => playlist; }
|
||||
|
||||
public EditPlaylistPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
CopyCurrent();
|
||||
BindingContext = Playlist;
|
||||
}
|
||||
|
||||
private void CopyCurrent()
|
||||
{
|
||||
playlist = new Playlist();
|
||||
playlist.Name = (Application.Current as App).Manager.CurrentPlaylist.Name;
|
||||
playlist.Description = (Application.Current as App).Manager.CurrentPlaylist.Description;
|
||||
playlist.ImageURL = (Application.Current as App).Manager.CurrentPlaylist.ImageURL;
|
||||
}
|
||||
|
||||
private async void ChangeImage(object sender, EventArgs e)
|
||||
{
|
||||
var result = await FilePicker.PickAsync(new PickOptions
|
||||
{
|
||||
PickerTitle = "Choisissez une nouvelle image !",
|
||||
FileTypes = FilePickerFileType.Images
|
||||
});
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender is Image image)
|
||||
{
|
||||
if (image.BindingContext is Playlist playlist)
|
||||
{
|
||||
playlist.ImageURL = result.FullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Cancel(object sender, EventArgs e)
|
||||
{
|
||||
Navigation.PopModalAsync();
|
||||
}
|
||||
|
||||
private void EditPlaylist(object sender, EventArgs e)
|
||||
{
|
||||
(Application.Current as App).Manager.CurrentPlaylist.Name = playlist.Name;
|
||||
(Application.Current as App).Manager.CurrentPlaylist.Description = playlist.Description;
|
||||
(Application.Current as App).Manager.CurrentPlaylist.ImageURL = playlist.ImageURL;
|
||||
Navigation.PopModalAsync();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue