maui media element 如何通过c#(不要用xaml的绑定)实现在播完上一曲后自动加载下一曲并播放
maui media element 如何通过c#(不要用xaml的绑定)实现在播完上一曲后自动加载下一曲并播放
Windows
.NET
.NET MAUI
-
fsdfsfd 260 信誉分
2025-01-13T02:30:20.2766667+00:00 media element 在播完一首后触发MediaEnded事件,导致MediaEnded的实例 Placeholder.currentstate==MediaElementState.None,后面在给Placeholder.source添加任何source,一直出现(Placeholder.currentstate==MediaElementState.None)
并且在触发MediaEnded事件 MediaEnded的实例 Placeholder似乎会被注销掉,Placeholder==null
-
Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 34,226 信誉分 • Microsoft 供应商
2025-01-13T09:01:15.2966667+00:00 您是想检测MediaElementState的值的变化, 如果变成None以后给新的source?您的ViewModel是否有播放下一首的操作,是否可以在判断strate为none的时候手动调用一次播放下一首操作的Action<T>?
-
fsdfsfd 260 信誉分
2025-01-13T09:20:10.1766667+00:00 我是在MediaEnded事件处理函数(OnMediaEnded)中,给mediaelement.source一个新的值,但
Placeholder.currentstate一直等于MediaElementState.None 不变,使用mediaelement 不会改变,同时注意到mediaelement对象在MediaEnded事件处理函数后,(会被回收掉?)通过设置调试点其ID变红还报COM错误
-
fsdfsfd 260 信誉分
2025-01-13T09:27:51.2133333+00:00 今天晚上我上传压缩包吧,没有github,麻烦看下
-
Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 34,226 信誉分 • Microsoft 供应商
2025-01-13T09:41:04.99+00:00 为了安全请不要直接上传sample, 你可以在问题中编辑上代码片段以及复现步骤, 我会创建一个sample来测试。 如果您坚持上传sample, 请确保里面没有敏感信息, 感谢您的理解。
-
fsdfsfd 260 信誉分
2025-01-13T14:14:23.1766667+00:00 MainPage.xaml.cs
using CommunityToolkit.Maui.Core.Primitives; using CommunityToolkit.Maui.Views; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.LifecycleEvents; using System.ComponentModel; using System.Runtime.CompilerServices; using AI_Media; namespace SimpleAudioPlayer { public partial class MainPage : ContentPage { private int CountPlayMode_Clicked = 0; private int CountPlay_Clicked = -1; private int CountPlayList_Clicked = -1; private Window PlayList_Window; private AI_Audio audio = AI_Audio.GetInstance(); public enum Audio_PlayMode { Repeat=0, Shuffle, Singlerepeat=-1 } private Audio_PlayMode audio_playmode { get { if(CountPlayMode_Clicked == 0) { return Audio_PlayMode.Repeat; } else if(CountPlayMode_Clicked==1) { return Audio_PlayMode.Shuffle; } else if(CountPlayMode_Clicked == -1) { return Audio_PlayMode.Singlerepeat; } return Audio_PlayMode.Repeat; } } public MainPage() { InitializeComponent(); PlayList_Window = new Window(new ListPage()); PlayList_Window.Title = "PlayList_Window"; const int newWidth = 488; const int newHeight = 220; PlayList_Window.Width = PlayList_Window.MinimumWidth = PlayList_Window.MaximumWidth = newWidth; PlayList_Window.Height = PlayList_Window.MinimumHeight = PlayList_Window.MaximumHeight = newHeight; MusicPosition.BindingContext= mediaElement; MusicPosition.SetBinding(Slider.ValueProperty, "Position.TotalMilliseconds"); audio.InitAI_Audio(); } private void Button_Pressed(object sender, EventArgs e) { var button=(ImageButton)sender; ChangeButtonColor(button.ClassId); } private void Button_Released(object sender, EventArgs e) { var button = (ImageButton)sender; ResetButtonColor(button.ClassId); } private void Button_Clicked(object sender, EventArgs e) { if(sender is ImageButton) { var button = (ImageButton)sender; InputMessage(button.ClassId); ChangeButtonColor(button.ClassId); } else if(sender is Slider) { var button= (Slider)sender; InputMessage(button.ClassId); } } private void InputMessage(string message) { if (mediaElement.CurrentState==MediaElementState.None) { if(message=="Play") { LoadSongToMediaElementSource(); } } if(mediaElement.CurrentState != MediaElementState.None) { switch (message) { case "PlayMode": PlayModeState(); break; case "PlayLast": PlayLast_Button(); break; case "Play": PlayState(); break; case "PlayNext": PlayNext_Button(); break; case "VolumeValue": PlayVolumeState(); break; case "PlayList": PlayListState(); break; } } if ( message=="PlayFile") { FileWindow(); } } private async void FileWindow() { try { var result = await FilePicker.PickAsync(PickOptions.Default); if (result != null) { var path = result.FullPath; audio.AddSong(path); } } catch (Exception ex) { // The user canceled or something went wrong } if(mediaElement.CurrentState != MediaElementState.Playing&& mediaElement.CurrentState != MediaElementState.Paused) { LoadSongToMediaElementSource(); } } private void PlayModeState() { CountPlayMode_Clicked++; if (CountPlayMode_Clicked == 0) { PlayMode.Source = ImageSource.FromFile("repeat.png"); } else if(CountPlayMode_Clicked == 1) { PlayMode.Source = ImageSource.FromFile("shuffle.png"); } else if (CountPlayMode_Clicked == 2) { PlayMode.Source = ImageSource.FromFile("singlerepeat.png"); CountPlayMode_Clicked = -1; } SetMediaElementPlayMode(); } private void PlayLast_Button() { //if(audio.Playlist.Count==1) //{ //} //else //{ // LoadSongToMediaElementSource(); //} } private void PlayNext_Button() { //if (audio.Playlist.Count == 1) //{ //} //else //{ // LoadSongToMediaElementSource(); //} } private void PlayState() { CountPlay_Clicked++; if(CountPlay_Clicked == 0) { Play.Source = ImageSource.FromFile("play.png"); PlayMusic(); } else { Play.Source = ImageSource.FromFile("pause.png"); CountPlay_Clicked = -1; PauseMusic(); } } private void PlayVolumeState() { mediaElement.Volume = VolumeValue.Value / 100; } private void PlayListState() { CountPlayList_Clicked++; if( CountPlayList_Clicked == 0) { var mainwindow = this.GetParentWindow(); PlayList_Window.X = mainwindow.X+6; PlayList_Window.Y = mainwindow.Y + 212; Application.Current?.OpenWindow(PlayList_Window); } else { CountPlayList_Clicked = -1; var mainwindow = this.GetParentWindow(); mainwindow.Height /= 2; mainwindow.MaximumHeight = mainwindow.Height; Application.Current?.CloseWindow(PlayList_Window); } } private void ChangeButtonColor(string buttonname) { switch(buttonname) { case "PlayMode": PlayMode.BackgroundColor = Color.FromRgb(9, 244, 253); break; case "PlayLast": PlayLast.BackgroundColor = Color.FromRgb(9, 244, 253); break; case "Play": Play.BackgroundColor = Color.FromRgb(9, 244, 253); break; case "PlayNext": PlayNext.BackgroundColor = Color.FromRgb(9, 244, 253); break; case "PlayList": PlayList.BackgroundColor = Color.FromRgb(9, 244, 253); break; case "PlayFile": PlayFile.BackgroundColor = Color.FromRgb(9, 244, 253); break; } } private void ResetButtonColor(string buttonname) { switch (buttonname) { case "PlayMode": PlayMode.BackgroundColor = Color.FromRgb(255, 255, 255); break; case "PlayLast": PlayLast.BackgroundColor = Color.FromRgb(255, 255, 255); break; case "Play": Play.BackgroundColor = Color.FromRgb(255, 255, 255); break; case "PlayNext": PlayNext.BackgroundColor = Color.FromRgb(255, 255, 255); break; case "PlayList": PlayList.BackgroundColor = Color.FromRgb(255, 255, 255); break; case "PlayFile": PlayFile.BackgroundColor = Color.FromRgb(255, 255, 255); break; } } private void SetMediaElementPlayMode() { switch(audio_playmode) { case Audio_PlayMode.Repeat: mediaElement.ShouldLoopPlayback = false; break; case Audio_PlayMode.Shuffle: mediaElement.ShouldLoopPlayback = false; break; case Audio_PlayMode.Singlerepeat: mediaElement.ShouldLoopPlayback = true; break; } } private void LoadSongToMediaElementSource() { SetMediaElementPlayMode(); if(audio.Songlist.Count>0) { string songname = ""; if(audio_playmode==Audio_PlayMode.Shuffle) { songname = audio.Playlist[audio.RandonReturnNumber_PlayList()]; } else { songname = audio.Playlist[audio.SequenceReturnNumber_PlayList()]; } mediaElement.Source = MediaSource.FromFile(audio.Songlist[songname].songpath); SongName.Text = audio.Songlist[songname].SongName; ArtistName.Text = audio.Songlist[songname].SongArtist; if(audio.Songlist[songname].Image!=null) { Album_Art.Source = audio.Songlist[songname].Image; } else { Album_Art.Source = null; } } } private void PlayMusic() { if (mediaElement.CurrentState == MediaElementState.Stopped ||mediaElement.CurrentState == MediaElementState.Paused) { mediaElement.Play(); string total_duration = mediaElement.Duration.ToString(); if(total_duration!=string.Empty) { Total_Duration_Music.Text = total_duration.Substring(3,5); MusicPosition.Maximum = mediaElement.Duration.TotalMilliseconds; } else { Total_Duration_Music.Text = "Error"; } } } private void PauseMusic() { if(mediaElement.CurrentState == MediaElementState.Playing) { mediaElement.Pause(); } } private void MoveMusicPosition() { mediaElement?.SeekTo(TimeSpan.FromMilliseconds(MusicPosition.Value)); } private async void ContentPage_Unloaded(object? sender, EventArgs e) { // Stop and cleanup MediaElement when we navigate away audio.SaveSongByFileOs(); await Task.Delay(2000); mediaElement.Handler?.DisconnectHandler(); } private void mediaElement_MediaEnded(object sender, EventArgs e) { if (mediaElement.CurrentState == MediaElementState.Stopped) { LoadSongToMediaElementSource(); } } private void mediaElement_MediaOpened(object sender, EventArgs e) { if(mediaElement.CurrentState== MediaElementState.Paused) { if(CountPlay_Clicked == 0) { mediaElement.Play(); } } } private void ContentPage_Loaded(object sender, EventArgs e) { LoadSongToMediaElementSource(); } private void MusicPosition_ValueChanged(object sender, ValueChangedEventArgs e) { MoveMusicPosition(); } } }
-
fsdfsfd 260 信誉分
2025-01-13T14:14:59.29+00:00 MainPage.xaml
<?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:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" x:Class="SimpleAudioPlayer.MainPage" Unloaded="ContentPage_Unloaded" Loaded="ContentPage_Loaded"> <ContentPage.Resources> <ResourceDictionary> <Style x:Key="Border_Style_Play_Botton_Area" TargetType="Border"> <Setter Property="StrokeThickness" Value="4"/> <Setter Property="StrokeShape" Value="RoundRectangle 10,10,10,10"/> </Style> <Style x:Key="Border_Style_Play_Show_Area" TargetType="Border"> <Setter Property="StrokeThickness" Value="2"/> <Setter Property="StrokeShape" Value="RoundRectangle 5,5,5,5"/> </Style> </ResourceDictionary> </ContentPage.Resources> <Grid RowSpacing="2"> <!-- 定义行--> <Grid.RowDefinitions> <RowDefinition Height="{OnPlatform 76,Android=*}"/> <RowDefinition Height="{OnPlatform 100,Android=*}"/> </Grid.RowDefinitions> <!-- 定义列--> <Grid.ColumnDefinitions> <ColumnDefinition Width="{OnPlatform 480 ,Android=*}"/> </Grid.ColumnDefinitions> <!-- 定义播放器按键区域--> <Grid Grid.Row="0" Grid.Column="0" Margin="4,6,0,0" ColumnSpacing="2"> <Grid.RowDefinitions> <RowDefinition Height="{OnPlatform 68,Android=*}"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> </Grid.ColumnDefinitions> <Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource Border_Style_Play_Botton_Area}"> <ImageButton x:Name="PlayMode" ClassId="PlayMode" Aspect="Center" Source="repeat.png" Pressed="Button_Pressed" Released="Button_Released" Clicked="Button_Clicked"/> </Border> <Border Grid.Row="0" Grid.Column="2" Style="{StaticResource Border_Style_Play_Botton_Area}"> <ImageButton x:Name="PlayLast" ClassId="PlayLast" Aspect="Center" Source="playlast.png" Pressed="Button_Pressed" Released="Button_Released" Clicked="Button_Clicked"/> </Border> <Border Grid.Row="0" Grid.Column="3" Style="{StaticResource Border_Style_Play_Botton_Area}"> <ImageButton x:Name="Play" ClassId="Play" Aspect="Center" Source="pause.png" Pressed="Button_Pressed" Released="Button_Released" Clicked="Button_Clicked"/> </Border> <Border Grid.Row="0" Grid.Column="4" Style="{StaticResource Border_Style_Play_Botton_Area}"> <ImageButton x:Name="PlayNext" ClassId="PlayNext" Aspect="Center" Source="playnext.png" Pressed="Button_Pressed" Released="Button_Released" Clicked="Button_Clicked"/> </Border> <Border Grid.Row="0" Grid.Column="5" Style="{StaticResource Border_Style_Play_Botton_Area}" Grid.ColumnSpan="2"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="{OnPlatform 60,Android=*}"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="{OnPlatform 35 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 45 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 45 ,Android=*}"/> </Grid.ColumnDefinitions> <Image Grid.Row="0" Grid.Column="0" x:Name="Volume" ClassId="Volume" Source="soundon.png" Aspect="Center"/> <Slider x:Name="VolumeValue" ClassId="VolumeValue" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Minimum="0" Maximum="100" ThumbColor="Gray" MinimumTrackColor="Gray" HeightRequest="35" Value="20" ValueChanged="Button_Clicked"/> </Grid> </Border> </Grid> <!-- 定义播放显示区域--> <Grid Grid.Row="1" Grid.Column="0" Margin="6,6,0,0" ColumnSpacing="2"> <Grid.RowDefinitions> <RowDefinition Height="{OnPlatform 94,Android=*}"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> </Grid.ColumnDefinitions> <Border Grid.Row="0" Grid.Column="0" Style="{StaticResource Border_Style_Play_Show_Area}" Grid.ColumnSpan="2" WidthRequest="94" HeightRequest="94"> <Image Margin="2,2,2,2" x:Name="Album_Art" Aspect="AspectFill" WidthRequest="86" HeightRequest="86"/> </Border> <Border Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="4" Style="{StaticResource Border_Style_Play_Show_Area}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="{OnPlatform 25,Android=*}"/> <RowDefinition Height="{OnPlatform 25,Android=*}"/> <RowDefinition Height="{OnPlatform 40,Android=*}"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="{OnPlatform 266 ,Android=*}"/> </Grid.ColumnDefinitions> <toolkit:MediaElement x:Name="mediaElement" ShouldAutoPlay="False" ShouldShowPlaybackControls="false" MediaEnded="mediaElement_MediaEnded" MediaOpened="mediaElement_MediaOpened" /> <Label x:Name="SongName" Grid.Row="0" Grid.Column="0" HorizontalOptions="Center"/> <Label x:Name="ArtistName" Grid.Row="1" Grid.Column="0" HorizontalOptions="Center"/> <Grid Grid.Row="2" Grid.Column="0"> <Grid.RowDefinitions> <RowDefinition Height="{OnPlatform 15,Android=*}"/> <RowDefinition Height="{OnPlatform 25,Android=*}"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="{OnPlatform 266 ,Android=*}"/> </Grid.ColumnDefinitions> <Grid Grid.Row="0" Grid.Column="0"> <Grid.RowDefinitions> <RowDefinition Height="{OnPlatform 15,Android=*}"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="{OnPlatform 133 ,Android=*}"/> <ColumnDefinition Width="{OnPlatform 133 ,Android=*}"/> </Grid.ColumnDefinitions> <Label x:Name="Current_Time_Music" Text="{Binding Source={x:Reference mediaElement},Path=Position,StringFormat='{0:mm\\:ss}'}" Grid.Row="0" Grid.Column="0" HeightRequest="20"/> <Label x:Name="Total_Duration_Music" Text="00:00" Grid.Row="0" Grid.Column="1" HeightRequest="20" HorizontalOptions="End"/> </Grid> <Slider x:Name="MusicPosition" ClassId="MusicPosition" Grid.Row="1" Grid.Column="0" Minimum="0" HeightRequest="30" WidthRequest="260" ThumbColor="Gray" MinimumTrackColor="Gray" ValueChanged="MusicPosition_ValueChanged" /> </Grid> </Grid> </Border> <Grid Grid.Row="0" Grid.Column="6" Grid.ColumnSpan="1"> <Grid.RowDefinitions> <RowDefinition Height="{OnPlatform 47,Android=*}"/> <RowDefinition Height="{OnPlatform 47,Android=*}"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="{OnPlatform 66 ,Android=*}"/> </Grid.ColumnDefinitions> <Border Grid.Row="0" Grid.Column="0" Style="{StaticResource Border_Style_Play_Show_Area}"> <ImageButton x:Name="PlayFile" ClassId="PlayFile" Aspect="Center" Source="folders.png" Pressed="Button_Pressed" Released="Button_Released" Clicked="Button_Clicked"/> </Border> <Border Grid.Row="1" Grid.Column="0" Style="{StaticResource Border_Style_Play_Show_Area}"> <ImageButton x:Name="PlayList" ClassId="PlayList" Aspect="Center" Source="playlist.png" Pressed="Button_Pressed" Released="Button_Released" Clicked="Button_Clicked"/> </Border> </Grid> </Grid> </Grid> </ContentPage>
-
fsdfsfd 260 信誉分
2025-01-13T14:15:36.4666667+00:00 ListPage.xaml.cs
using AI_Media; using CommunityToolkit.Maui.Core.Extensions; using System.Collections.ObjectModel; namespace SimpleAudioPlayer; public partial class ListPage : ContentPage { private ObservableCollection<SongData> songdatas = new ObservableCollection<SongData>(); private AI_Audio audio=AI_Audio.GetInstance(); public ListPage() { InitializeComponent(); } public void InitSongDatas() { foreach (var song in audio.Songlist.Values) { songdatas.Add(SongData.InitBySong(song)); } PlayPage.ItemsSource = songdatas; } private void ContentPage_Loaded(object sender, EventArgs e) { songdatas = new ObservableCollection<SongData>(); InitSongDatas(); } private void ContentPage_Unloaded(object sender, EventArgs e) { songdatas.Clear(); PlayPage.ItemsSource = songdatas; } }
-
fsdfsfd 260 信誉分
2025-01-13T14:16:13.5+00:00 ListPage.xaml
<?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="SimpleAudioPlayer.ListPage" Loaded="ContentPage_Loaded" Unloaded="ContentPage_Unloaded"> <ContentPage.Resources> <ResourceDictionary> <Style x:Key="Border_Style_Egde" TargetType="Border"> <Setter Property="StrokeThickness" Value="6"/> <Setter Property="StrokeShape" Value="RoundRectangle 10,10,10,10"/> </Style> <Style x:Key="Border_Style_Item" TargetType="Border"> <Setter Property="StrokeThickness" Value="2"/> <Setter Property="StrokeShape" Value="RoundRectangle 5,5,5,5"/> </Style> </ResourceDictionary> </ContentPage.Resources> <Grid> <Grid.RowDefinitions> <RowDefinition Height="220"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="488"/> </Grid.ColumnDefinitions> <Border Grid.Row="0" Grid.Column="0" HeightRequest="210" WidthRequest="480" Style="{StaticResource Border_Style_Egde}"> <CollectionView Margin="4,4,4,4" x:Name="PlayPage" ItemsSource="{Binding songdatas}"> <CollectionView.ItemTemplate> <DataTemplate> <Grid Padding="2"> <Border StrokeThickness="4" HeightRequest="95" Padding="1" Style="{StaticResource Border_Style_Item}"> <Grid Margin="4,4,4,4"> <Grid.RowDefinitions> <RowDefinition Height="80"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="90"/> <ColumnDefinition Width="90"/> <ColumnDefinition Width="90"/> <ColumnDefinition Width="90"/> <ColumnDefinition Width="80"/> </Grid.ColumnDefinitions> <Image Grid.Row="0" Grid.Column="0" Source="{Binding Image}"/> <Grid Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" > <Grid.RowDefinitions> <RowDefinition Height="40"/> <RowDefinition Height="40"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="270"/> </Grid.ColumnDefinitions> <Label Grid.Row="0" Grid.Column="0" WidthRequest="270" FontSize="15" FontFamily="Times New Roman" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Text="{Binding SongName}" /> <Label Grid.Row="1" Grid.Column="0" WidthRequest="270" FontSize="15" FontFamily="Times New Roman" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Text="{Binding SongArtist}" /> </Grid> <Border Grid.Row="0" Grid.Column="4" StrokeThickness="4" StrokeShape="RoundRectangle 40,40,40,40" HorizontalOptions="Center" VerticalOptions="Center" HeightRequest="70" WidthRequest="70"> <ImageButton Source="play.png"/> </Border> </Grid> </Border> </Grid> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> </Border> </Grid> </ContentPage>
-
fsdfsfd 260 信誉分
2025-01-13T14:16:56.5266667+00:00 SongData.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using AI_Media; namespace SimpleAudioPlayer { class SongData { public string SongName { get; set; } public string SongArtist { get; set; } public string SongPath { get; set; } public StreamImageSource Image { get; set; } public static SongData InitBySong(Song song) { SongData holder = new SongData(); if (song!=null) { holder.SongName = song.SongName; holder.SongArtist = song.SongArtist; holder.SongPath = song.SongPath; holder.Image = song.Image; return holder; } return holder; } } }
-
Deleted
此评论已被删除,因为违反了我们的行为准则。 在采取措施之前,已通过自动检测手动报告或识别该评论。 有关详细信息,请参阅我们的行为准则。
-
fsdfsfd 260 信誉分
2025-01-13T14:18:34.0633333+00:00 App.xaml
<?xml version = "1.0" encoding = "UTF-8" ?> <Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:SimpleAudioPlayer" x:Class="SimpleAudioPlayer.App"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Resources/Styles/Colors.xaml" /> <ResourceDictionary Source="Resources/Styles/Styles.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>
-
fsdfsfd 260 信誉分
2025-01-13T14:19:38.96+00:00 App.xaml.cs
using CommunityToolkit.Maui.Views; using Microsoft.Maui.Controls.PlatformConfiguration; using CommunityToolkit.Maui; using AI_Media; namespace SimpleAudioPlayer { public partial class App : Application { public App() { InitializeComponent(); MainPage = new AppShell(); } #if WINDOWS protected override Window CreateWindow(IActivationState activationState) { var window = base.CreateWindow(activationState); const int newWidth = 500; const int newHeight = 220; window.Width = window.MinimumWidth = window.MaximumWidth = newWidth; window.Height = window.MinimumHeight = window.MaximumHeight = newHeight; window.X = 800; window.Y = 40; window.Destroying += (s, e) => { // Custom logic Application.Current.Quit(); }; return window; } #endif } }
-
Deleted
此评论已被删除,因为违反了我们的行为准则。 在采取措施之前,已通过自动检测手动报告或识别该评论。 有关详细信息,请参阅我们的行为准则。
登录以评论