@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Linaris.FooterPage">
|
||||
|
||||
<Grid Grid.ColumnSpan="2" Grid.Row="1" BackgroundColor="Gray">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<HorizontalStackLayout Margin="10" Grid.ColumnSpan="2">
|
||||
<Image Source="album10.jpg" SemanticProperties.Description="Album 3" Aspect="AspectFit"/>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Text="Morceau" HorizontalOptions="Center" VerticalOptions="Center" Margin="8,0,0,0" FontSize="25"></Label>
|
||||
<Label Grid.Row="1" x:Name="artiste" Text="Artiste" HorizontalOptions="Center" VerticalOptions="Center" Margin="8,0,0,0" FontSize="15"></Label>
|
||||
</Grid>
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackLayout Grid.Row="0" Orientation="Horizontal" HorizontalOptions="CenterAndExpand" Margin="0,5,0,0">
|
||||
<ImageButton Source="rdm.png" Margin="0,10,8,10" WidthRequest="25" HeightRequest="25" Aspect="AspectFit" MinimumWidthRequest="1" MinimumHeightRequest="1" BackgroundColor="Transparent"/>
|
||||
<ImageButton x:Name="Back" Clicked="RewindButton_Clicked" Source="back.png" Margin="8,10,8,10" WidthRequest="20" HeightRequest="20" Aspect="AspectFit" MinimumWidthRequest="1" MinimumHeightRequest="1" BackgroundColor="Transparent"/>
|
||||
<ImageButton x:Name="Play" Clicked="PlayButton_Clicked" Source="play.png" Margin="8,0,8,0" WidthRequest="38" HeightRequest="38" Aspect="AspectFit" MinimumWidthRequest="5" MinimumHeightRequest="5" BackgroundColor="Transparent"/>
|
||||
<ImageButton x:Name="Next" Clicked="NextButton_Clicked" Source="next.png" Margin="8,10,8,10" WidthRequest="20" HeightRequest="20" Aspect="AspectFit" MinimumWidthRequest="1" MinimumHeightRequest="1" BackgroundColor="Transparent"/>
|
||||
<ImageButton Source="loop.png" Margin="8,10,0,10" WidthRequest="25" HeightRequest="25" Aspect="AspectFit" MinimumWidthRequest="1" MinimumHeightRequest="1" BackgroundColor="Transparent"/>
|
||||
</StackLayout>
|
||||
|
||||
<HorizontalStackLayout Grid.Row="1" HorizontalOptions="Center" Spacing="10" MinimumWidthRequest="15">
|
||||
<Label VerticalOptions="Center" Text="00:00:00" x:Name="currentTime"></Label>
|
||||
<Slider Value="0" ValueChanged="Bar_ValueChanged" WidthRequest="250" VerticalOptions="Center" x:Name="bar"/>
|
||||
<Label VerticalOptions="Center" Text="00:00:00" x:Name="endTime"></Label>
|
||||
</HorizontalStackLayout>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<HorizontalStackLayout Grid.Column="1" VerticalOptions="Center" Margin="0,0,15,0" HorizontalOptions="Fill">
|
||||
<Image Source="volume.png" VerticalOptions="Center" WidthRequest="30" HeightRequest="30" Margin="25,25,5,25"/>
|
||||
<Slider Grid.Column="1" x:Name="slider" WidthRequest="125" VerticalOptions="Center" Value="1" ValueChanged="Slider_ValueChanged"/>
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</ContentView>
|
@ -0,0 +1,126 @@
|
||||
using NAudio.Wave;
|
||||
|
||||
namespace Linaris;
|
||||
|
||||
public partial class FooterPage : ContentView
|
||||
{
|
||||
WaveOutEvent outputDevice;
|
||||
AudioFileReader audioFile;
|
||||
System.Timers.Timer timer;
|
||||
bool changementManuel = true;
|
||||
bool closing = false;
|
||||
string morceauEnCours;
|
||||
|
||||
public FooterPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
outputDevice = new WaveOutEvent();
|
||||
|
||||
// (s,a) = convention, s = sender, a = arguments, si appli fermée, on free tout
|
||||
outputDevice.PlaybackStopped += PlaybackStoppedHandler;
|
||||
|
||||
morceauEnCours = "D:\\Musique\\Création\\winter.mp3";
|
||||
audioFile = new AudioFileReader(morceauEnCours);
|
||||
outputDevice.Init(audioFile);
|
||||
}
|
||||
|
||||
public void PlayButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
string url = ((FileImageSource)Play.Source).File;
|
||||
if (url == "play.png")
|
||||
{
|
||||
outputDevice?.Play();
|
||||
Play.Source = "pause.png";
|
||||
Timer_Elapsed(sender, e);
|
||||
timer = new System.Timers.Timer(1000);
|
||||
timer.Elapsed += Timer_Elapsed;
|
||||
timer.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDevice?.Pause();
|
||||
Play.Source = "play.png";
|
||||
}
|
||||
}
|
||||
|
||||
public void RewindButton_Clicked(Object sender, EventArgs e)
|
||||
{
|
||||
audioFile.Position = 0;
|
||||
outputDevice?.Play();
|
||||
Play.Source = "pause.png";
|
||||
Timer_Elapsed(sender, e);
|
||||
timer = new System.Timers.Timer(1000);
|
||||
timer.Elapsed += Timer_Elapsed;
|
||||
timer.Enabled = true;
|
||||
}
|
||||
|
||||
public void NextButton_Clicked(Object sender, EventArgs e)
|
||||
{
|
||||
audioFile.Position = audioFile.Length;
|
||||
}
|
||||
|
||||
public void StopButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
outputDevice.Stop();
|
||||
audioFile.Position = 0;
|
||||
}
|
||||
|
||||
public void Slider_ValueChanged(object sender, ValueChangedEventArgs e)
|
||||
{
|
||||
outputDevice.Volume = (float)e.NewValue;
|
||||
}
|
||||
|
||||
public void Bar_ValueChanged(object sender, ValueChangedEventArgs e)
|
||||
{
|
||||
if (changementManuel)
|
||||
{
|
||||
double totalSeconds = audioFile.TotalTime.TotalSeconds;
|
||||
double newPosition = e.NewValue * totalSeconds;
|
||||
|
||||
audioFile.CurrentTime = TimeSpan.FromSeconds(newPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
changementManuel = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaybackStoppedHandler(object sender, StoppedEventArgs e)
|
||||
{
|
||||
if (closing)
|
||||
{
|
||||
outputDevice.Dispose();
|
||||
audioFile.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
Play.Dispatcher.Dispatch(() => Play.Source = "play.png");
|
||||
}
|
||||
}
|
||||
|
||||
private void Timer_Elapsed(object sender, EventArgs e)
|
||||
{
|
||||
TimeSpan totalTimeSpan = audioFile.TotalTime;
|
||||
TimeSpan currentTimeSpan = audioFile.CurrentTime;
|
||||
|
||||
string totalTimeFormatted = totalTimeSpan.ToString(@"hh\:mm\:ss");
|
||||
string currentTimeFormatted = currentTimeSpan.ToString(@"hh\:mm\:ss");
|
||||
|
||||
changementManuel = false;
|
||||
|
||||
bar.Dispatcher.Dispatch(() => bar.Value = audioFile.CurrentTime.TotalSeconds / audioFile.TotalTime.TotalSeconds);
|
||||
currentTime.Dispatcher.Dispatch(() => currentTime.Text = currentTimeFormatted);
|
||||
endTime.Dispatcher.Dispatch(() => endTime.Text = totalTimeFormatted);
|
||||
|
||||
}
|
||||
|
||||
private void LoadNewAudioFile(string filePath)
|
||||
{
|
||||
if (outputDevice.PlaybackState == PlaybackState.Playing)
|
||||
{
|
||||
outputDevice.Stop();
|
||||
}
|
||||
audioFile = new AudioFileReader(filePath);
|
||||
outputDevice.Init(audioFile);
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
<?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.LocalFilesPage"
|
||||
xmlns:control="clr-namespace:Syncfusion.Maui.ProgressBar;assembly=Syncfusion.Maui.ProgressBar"
|
||||
xmlns:sliders="clr-namespace:Syncfusion.Maui.Sliders;assembly=Syncfusion.Maui.Sliders"
|
||||
xmlns:local="clr-namespace:Linaris"
|
||||
Title="LocalFilesPage">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="6*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="8*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ContentView Style="{StaticResource FlyoutStyle}" Grid.Column="0" Grid.Row="0"></ContentView>
|
||||
|
||||
<ScrollView Grid.Column="1" Grid.Row="0" BackgroundColor="#404040">
|
||||
|
||||
<VerticalStackLayout>
|
||||
|
||||
<SearchBar Style="{StaticResource SearchBar}"/>
|
||||
|
||||
<FlexLayout Direction="Row" AlignItems="Start" JustifyContent="SpaceAround" Wrap="Wrap">
|
||||
|
||||
<VerticalStackLayout Margin="10">
|
||||
<ImageButton Source="mp3.png" SemanticProperties.Description="MP3" Style="{StaticResource Pochette}"/>
|
||||
<Label Text="The Last Breath" Style="{StaticResource Titre}"></Label>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout Margin="10">
|
||||
<ImageButton Source="wav.png" SemanticProperties.Description="WAV" Style="{StaticResource Pochette}"/>
|
||||
<Label Text="Love" Style="{StaticResource Titre}"></Label>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout Margin="10">
|
||||
<ImageButton Source="ogg.png" SemanticProperties.Description="OGG" Style="{StaticResource Pochette}"/>
|
||||
<Label Text="Winter" Style="{StaticResource Titre}"></Label>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout Margin="10">
|
||||
<ImageButton Source="midi.png" SemanticProperties.Description="MIDI" Style="{StaticResource Pochette}"/>
|
||||
<Label Text="Croissant" Style="{StaticResource Titre}"></Label>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout Margin="10">
|
||||
<ImageButton Source="mp3.png" SemanticProperties.Description="MP3" Style="{StaticResource Pochette}"/>
|
||||
<Label Text="Fredo et Louis" Style="{StaticResource Titre}"></Label>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout Margin="10">
|
||||
<ImageButton Source="mp3.png" SemanticProperties.Description="MP3" Style="{StaticResource Pochette}"/>
|
||||
<Label Text="end" Style="{StaticResource Titre}"></Label>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout Margin="10">
|
||||
<ImageButton Source="wav.png" SemanticProperties.Description="WAV" Style="{StaticResource Pochette}"/>
|
||||
<Label Text="calm" Style="{StaticResource Titre}"></Label>
|
||||
</VerticalStackLayout>
|
||||
|
||||
<VerticalStackLayout Margin="10">
|
||||
<ImageButton Source="mp3.png" SemanticProperties.Description="MP3" Style="{StaticResource Pochette}"/>
|
||||
<Label Text="Lessgooo" Style="{StaticResource Titre}"></Label>
|
||||
</VerticalStackLayout>
|
||||
|
||||
</FlexLayout>
|
||||
|
||||
</VerticalStackLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<local:FooterPage Grid.Row="1" Grid.ColumnSpan="2"/>
|
||||
|
||||
</Grid>
|
||||
</ContentPage>
|
@ -0,0 +1,9 @@
|
||||
namespace Linaris;
|
||||
|
||||
public partial class LocalFilesPage : ContentPage
|
||||
{
|
||||
public LocalFilesPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 33 KiB |