├── .editorconfig ├── .gitattributes ├── .gitignore ├── Assets └── 1.png ├── LICENSE ├── MatoMusic.sln ├── README.md └── src ├── MatoMusic.Core ├── Configuration │ └── AppConfigurations.cs ├── Helper │ └── CommonHelper.cs ├── Impl │ ├── MusicControlService.cs │ └── MusicInfoManager.cs ├── Interfaces │ ├── IMusicControlService.cs │ └── IMusicInfoManager.cs ├── Localization │ ├── MatoMusicLocalization.cs │ ├── SourceFiles │ │ ├── MatoMusic-zh-Hans.xml │ │ └── MatoMusic.xml │ └── TranslateExtension.cs ├── MatoMusic - Backup.Core.csproj ├── MatoMusic.Core.csproj ├── MatoMusicBuilderExtensions.cs ├── MatoMusicConsts.cs ├── MatoMusicCoreModule.cs ├── Models │ ├── AlbumInfo.cs │ ├── ArtistInfo.cs │ ├── BillboardInfo.cs │ ├── Entities │ │ ├── Playlist.cs │ │ ├── PlaylistItem.cs │ │ └── Queue.cs │ ├── MenuCellInfo.cs │ ├── MusicCollectionInfo.cs │ ├── MusicInfo.cs │ └── PlaylistInfo.cs ├── MusicInfoComparer.cs ├── Platforms │ ├── Android │ │ ├── MusicControlService.cs │ │ └── MusicInfoManager.cs │ ├── Windows │ │ ├── MusicControlService.cs │ │ └── MusicInfoManager.cs │ └── iOS │ │ ├── MusicControlService.cs │ │ └── MusicInfoManager.cs ├── Services │ └── MusicRelatedService.cs ├── Settings │ ├── CommonSettingNames.cs │ └── CommonSettingProvider.cs ├── Theme │ └── Theme.cs ├── ViewModels │ ├── MusicRelatedViewModel.cs │ └── ViewModelBase.cs ├── appsettings.json ├── log4net.Production.config ├── log4net.config ├── mato.db ├── mato.db-shm └── mato.db-wal ├── MatoMusic.EntityFrameworkCore ├── EntityFrameworkCore │ ├── DbContextOptionsConfigurer.cs │ ├── MatoMusicDbContext.cs │ ├── MatoMusicDbContextFactory.cs │ └── MatoMusicEntityFrameworkCoreModule.cs ├── Helper │ └── WithDbContextHelper.cs ├── MatoMusic - Backup.EntityFrameworkCore.csproj ├── MatoMusic.EntityFrameworkCore.csproj ├── Migrations │ ├── 20211129105407_init.Designer.cs │ ├── 20211129105407_init.cs │ └── MatoMusicDbContextModelSnapshot.cs └── Seed │ ├── InitialDbBuilder.cs │ └── SeedHelper.cs ├── MatoMusic.Infrastructure ├── AlphaGroupedObserveableCollection.cs ├── Common │ ├── FaIcons.cs │ ├── IBasicInfo.cs │ └── IClueObject.cs ├── Helper │ ├── CommonHelper.cs │ ├── DirFileHelper.cs │ ├── StreamHelper.cs │ └── TokenHelper.cs ├── InfoResult.cs ├── MatoMusic.Infrastructure.csproj └── ObservableObject.cs └── MatoMusic ├── App.xaml ├── App.xaml.cs ├── Common ├── CommonFunctionEventArgs.cs ├── ContentPageBase.cs ├── ContentViewBase.cs ├── MusicFunctionEventArgs.cs ├── PopupBase.cs └── PopupSize.cs ├── Controls ├── MenuCell.xaml ├── MenuCell.xaml.cs ├── MusicGroupHeaderView.xaml ├── MusicGroupHeaderView.xaml.cs ├── MusicMiniView.xaml ├── MusicMiniView.xaml.cs ├── PlayingMotionView.xaml └── PlayingMotionView.xaml.cs ├── Converter ├── AlbumArtConverter.cs ├── Bool2StringConverter.cs ├── DecimalDigitVisibleConverter.cs ├── IntegerDigitVisibleConverter.cs ├── IsValid2BoolConverter.cs ├── SecondsToTimeSpanConverter.cs ├── SliderMaxValueConverter.cs └── True2FalseConverter.cs ├── MatoMusic.csproj ├── MatoMusicModule.cs ├── MauiProgram.cs ├── Platforms ├── Android │ ├── AndroidManifest.xml │ ├── MainActivity.cs │ ├── MainApplication.cs │ └── Resources │ │ └── values │ │ └── colors.xml ├── MacCatalyst │ ├── AppDelegate.cs │ ├── Info.plist │ └── Program.cs ├── Windows │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ │ ├── LockScreenLogo.scale-200.png │ │ ├── SplashScreen.png │ │ ├── SplashScreen.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ │ ├── StoreLogo.png │ │ └── Wide310x150Logo.scale-200.png │ ├── Package.appxmanifest │ └── app.manifest └── iOS │ ├── AppDelegate.cs │ ├── Info.plist │ ├── Program.cs │ └── Resources │ └── LaunchScreen.xib ├── Properties └── launchSettings.json ├── Resources ├── AppIcon │ ├── appicon.svg │ └── appiconfg.svg ├── Fonts │ ├── FontAwesome.ttf │ ├── OpenSans-Regular.ttf │ ├── OpenSans-Semibold.ttf │ └── fa-regular-400.ttf ├── Images │ ├── albumart_placeholder.png │ ├── cd2.png │ ├── dotnet_bot.svg │ ├── headphone.png │ └── microphone2.png ├── Raw │ └── AboutAssets.txt ├── Splash │ └── splash.svg └── Styles │ ├── Colors.xaml │ └── Styles.xaml ├── Services ├── MusicFunctionManager.cs └── NavigationService.cs ├── Styles ├── CommonResourceDictionary.xaml ├── CommonResourceDictionary.xaml.cs ├── DarkTheme.xaml ├── DarkTheme.xaml.cs ├── LightTheme.xaml └── LightTheme.xaml.cs ├── ViewModels ├── LibraryPageViewModel.cs ├── MusicCollectionPageViewModel.cs ├── MusicFunctionPageViewModel.cs ├── MusicMiniViewViewModel.cs ├── NowPlayingPageViewModel.cs ├── PlaylistEntryPageViewModel.cs ├── PlaylistFunctionPageViewModel.cs ├── PlaylistPageViewModel.cs └── QueuePageViewModel.cs └── Views ├── LibraryPages ├── AlbumPage.xaml ├── AlbumPage.xaml.cs ├── ArtistPage.xaml ├── ArtistPage.xaml.cs ├── MusicPage.xaml └── MusicPage.xaml.cs ├── MainPage.xaml ├── MainPage.xaml.cs ├── MusicCollectionPage.xaml ├── MusicCollectionPage.xaml.cs ├── MusicFunctionPage.xaml ├── MusicFunctionPage.xaml.cs ├── NowPlayingPage.xaml ├── NowPlayingPage.xaml.cs ├── PlaylistChoosePage.xaml ├── PlaylistChoosePage.xaml.cs ├── PlaylistEntryPage.xaml ├── PlaylistEntryPage.xaml.cs ├── PlaylistFunctionPage.xaml ├── PlaylistFunctionPage.xaml.cs ├── PlaylistPage.xaml ├── PlaylistPage.xaml.cs ├── QueuePage.xaml └── QueuePage.xaml.cs /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # CS4014: 由于此调用不会等待,因此在调用完成前将继续执行当前方法 4 | dotnet_diagnostic.CS4014.severity = error 5 | 6 | # CS0108: 成员隐藏继承的成员;缺少关键字 new 7 | dotnet_diagnostic.CS0108.severity = error 8 | 9 | # CS0114: 成员隐藏继承的成员;缺少关键字 override 10 | dotnet_diagnostic.CS0114.severity = error 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Assets/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/Assets/1.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 linxiao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MatoMusic.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31611.283 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MatoMusic.Infrastructure", "src\MatoMusic.Infrastructure\MatoMusic.Infrastructure.csproj", "{43D583A5-55D6-433D-8076-A08768356C1F}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MatoMusic", "src\MatoMusic\MatoMusic.csproj", "{68529DDF-93E7-4706-AD1F-D9016F6FB079}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MatoMusic.Core", "src\MatoMusic.Core\MatoMusic.Core.csproj", "{ECFE93EA-DF08-44E4-8695-90F8C3BFB5D2}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MatoMusic.EntityFrameworkCore", "src\MatoMusic.EntityFrameworkCore\MatoMusic.EntityFrameworkCore.csproj", "{547D2427-E66D-4184-BA7A-E51D3130017B}" 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D19CF8EF-129D-445F-A088-5B6670BCEB06}" 15 | ProjectSection(SolutionItems) = preProject 16 | .editorconfig = .editorconfig 17 | EndProjectSection 18 | EndProject 19 | Global 20 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 21 | Debug|Any CPU = Debug|Any CPU 22 | Debug|x64 = Debug|x64 23 | Release|Any CPU = Release|Any CPU 24 | Release|x64 = Release|x64 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {43D583A5-55D6-433D-8076-A08768356C1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {43D583A5-55D6-433D-8076-A08768356C1F}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {43D583A5-55D6-433D-8076-A08768356C1F}.Debug|x64.ActiveCfg = Debug|Any CPU 30 | {43D583A5-55D6-433D-8076-A08768356C1F}.Debug|x64.Build.0 = Debug|Any CPU 31 | {43D583A5-55D6-433D-8076-A08768356C1F}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {43D583A5-55D6-433D-8076-A08768356C1F}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {43D583A5-55D6-433D-8076-A08768356C1F}.Release|x64.ActiveCfg = Release|x64 34 | {43D583A5-55D6-433D-8076-A08768356C1F}.Release|x64.Build.0 = Release|x64 35 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 38 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Debug|x64.ActiveCfg = Debug|Any CPU 39 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Debug|x64.Build.0 = Debug|Any CPU 40 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Debug|x64.Deploy.0 = Debug|Any CPU 41 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Release|Any CPU.Deploy.0 = Release|Any CPU 44 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Release|x64.ActiveCfg = Release|x64 45 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Release|x64.Build.0 = Release|x64 46 | {68529DDF-93E7-4706-AD1F-D9016F6FB079}.Release|x64.Deploy.0 = Release|x64 47 | {ECFE93EA-DF08-44E4-8695-90F8C3BFB5D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 48 | {ECFE93EA-DF08-44E4-8695-90F8C3BFB5D2}.Debug|Any CPU.Build.0 = Debug|Any CPU 49 | {ECFE93EA-DF08-44E4-8695-90F8C3BFB5D2}.Debug|x64.ActiveCfg = Debug|Any CPU 50 | {ECFE93EA-DF08-44E4-8695-90F8C3BFB5D2}.Debug|x64.Build.0 = Debug|Any CPU 51 | {ECFE93EA-DF08-44E4-8695-90F8C3BFB5D2}.Release|Any CPU.ActiveCfg = Release|Any CPU 52 | {ECFE93EA-DF08-44E4-8695-90F8C3BFB5D2}.Release|Any CPU.Build.0 = Release|Any CPU 53 | {ECFE93EA-DF08-44E4-8695-90F8C3BFB5D2}.Release|x64.ActiveCfg = Release|x64 54 | {ECFE93EA-DF08-44E4-8695-90F8C3BFB5D2}.Release|x64.Build.0 = Release|x64 55 | {547D2427-E66D-4184-BA7A-E51D3130017B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 56 | {547D2427-E66D-4184-BA7A-E51D3130017B}.Debug|Any CPU.Build.0 = Debug|Any CPU 57 | {547D2427-E66D-4184-BA7A-E51D3130017B}.Debug|x64.ActiveCfg = Debug|Any CPU 58 | {547D2427-E66D-4184-BA7A-E51D3130017B}.Debug|x64.Build.0 = Debug|Any CPU 59 | {547D2427-E66D-4184-BA7A-E51D3130017B}.Release|Any CPU.ActiveCfg = Release|Any CPU 60 | {547D2427-E66D-4184-BA7A-E51D3130017B}.Release|Any CPU.Build.0 = Release|Any CPU 61 | {547D2427-E66D-4184-BA7A-E51D3130017B}.Release|x64.ActiveCfg = Release|x64 62 | {547D2427-E66D-4184-BA7A-E51D3130017B}.Release|x64.Build.0 = Release|x64 63 | EndGlobalSection 64 | GlobalSection(SolutionProperties) = preSolution 65 | HideSolutionNode = FALSE 66 | EndGlobalSection 67 | GlobalSection(ExtensibilityGlobals) = postSolution 68 | SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572} 69 | EndGlobalSection 70 | EndGlobal 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MatoMusic 2 | 使用.NET MAUI开发的音乐播放器 3 | 4 | 5 | 6 | ![](./Assets/1.png) 7 | 8 | ## 技术博客 9 | 系列文章将分步解读音乐播放器核心业务及代码: 10 | 11 | * [深入解读.NET MAUI音乐播放器项目(一):概述与架构](https://blog.csdn.net/jevonsflash/article/details/128960586) 12 | * [深入解读.NET MAUI音乐播放器项目(二):播放内核](https://blog.csdn.net/jevonsflash/article/details/128986962) 13 | * [深入解读.NET MAUI音乐播放器项目(三):界面交互](https://blog.csdn.net/jevonsflash/article/details/129112689) 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Configuration/AppConfigurations.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | using Abp.Extensions; 3 | using Microsoft.Extensions.Configuration; 4 | 5 | namespace MatoMusic.Core.Configuration 6 | { 7 | public static class AppConfigurations 8 | { 9 | private static readonly ConcurrentDictionary ConfigurationCache; 10 | 11 | static AppConfigurations() 12 | { 13 | ConfigurationCache = new ConcurrentDictionary(); 14 | } 15 | 16 | public static IConfigurationRoot Get(string path, string environmentName = null) 17 | { 18 | var cacheKey = path + "#" + environmentName; 19 | return ConfigurationCache.GetOrAdd( 20 | cacheKey, 21 | _ => BuildConfiguration(path, environmentName) 22 | ); 23 | } 24 | 25 | private static IConfigurationRoot BuildConfiguration(string path, string environmentName = null) 26 | { 27 | var builder = new ConfigurationBuilder() 28 | .SetBasePath(path) 29 | .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); 30 | 31 | if (!environmentName.IsNullOrWhiteSpace()) 32 | { 33 | builder = builder.AddJsonFile($"appsettings.{environmentName}.json", optional: true); 34 | } 35 | 36 | builder = builder.AddEnvironmentVariables(); 37 | 38 | return builder.Build(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Helper/CommonHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Microsoft.Maui.Controls; 8 | 9 | namespace MatoMusic.Core.Helper 10 | { 11 | public class CommonHelper 12 | { 13 | public static void ShowMsg(string msg) 14 | { 15 | 16 | Application.Current.MainPage.DisplayAlert("提示", msg, "好"); 17 | } 18 | 19 | public static void ShowNoAuthorized() 20 | { 21 | Application.Current.MainPage.DisplayAlert("需要权限", "MatoPlayer需要您媒体库的权限,劳烦至「设置」「隐私权」「媒体与AppleMusic」 打开权限,谢谢", "好"); 22 | } 23 | 24 | public static async Task PromptAsync(string title, string initialValue = null, string msg = null) 25 | { 26 | 27 | return await Application.Current.MainPage.DisplayPromptAsync(title, msg, "确定", "取消", "请输入内容", initialValue: initialValue); 28 | } 29 | 30 | public static void GoUrl(object obj) 31 | { 32 | throw new NotImplementedException(); 33 | } 34 | 35 | public static void BeginInvokeOnMainThread(Action action) 36 | { 37 | Application.Current.MainPage.Dispatcher.Dispatch(action); 38 | } 39 | } 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Impl/MusicControlService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Abp.Dependency; 7 | using MatoMusic.Core.Interfaces; 8 | using MatoMusic.Infrastructure.Helper; 9 | using Microsoft.Maui; 10 | using Microsoft.Maui.Controls; 11 | 12 | 13 | 14 | namespace MatoMusic.Core 15 | { 16 | public partial class MusicControlService : IMusicControlService, ISingletonDependency 17 | { 18 | public IMusicInfoManager MusicInfoManager { get; set; } 19 | 20 | public event EventHandler OnPlayFinished; 21 | 22 | public event EventHandler OnRebuildMusicInfosFinished; 23 | 24 | public event EventHandler OnProgressChanged; 25 | 26 | public event EventHandler OnPlayStatusChanged; 27 | 28 | public MusicControlService(IMusicInfoManager musicInfoManager) 29 | { 30 | this.MusicInfoManager=musicInfoManager; 31 | } 32 | 33 | 34 | private int[] shuffleMap; 35 | 36 | public int[] ShuffleMap 37 | { 38 | get 39 | { 40 | if (shuffleMap == null || shuffleMap.Length == 0) 41 | { 42 | shuffleMap = CommonHelper.GetRandomArry(0, LastIndex); 43 | } 44 | return shuffleMap; 45 | } 46 | } 47 | 48 | 49 | 50 | private List musicInfos; 51 | 52 | public List MusicInfos 53 | { 54 | get 55 | { 56 | if (musicInfos == null || musicInfos.Count == 0) 57 | { 58 | musicInfos = new List(); 59 | } 60 | return musicInfos; 61 | } 62 | } 63 | 64 | 65 | 66 | 67 | public partial Task RebuildMusicInfos(Action callback); 68 | 69 | 70 | public int LastIndex { get { return MusicInfos.FindLastIndex(c => true); } } 71 | 72 | 73 | public partial double Duration(); 74 | 75 | 76 | public partial double CurrentTime(); 77 | 78 | 79 | public partial bool IsPlaying(); 80 | 81 | 82 | public partial bool IsInitFinished(); 83 | 84 | 85 | public partial void SeekTo(double position); 86 | 87 | 88 | public partial MusicInfo GetNextMusic(MusicInfo current, bool isShuffle); 89 | 90 | 91 | public partial MusicInfo GetPreMusic(MusicInfo current, bool isShuffle); 92 | 93 | 94 | public partial int GetMusicIndex(MusicInfo musicInfo); 95 | 96 | public partial MusicInfo GetMusicByIndex(int index); 97 | 98 | 99 | public partial Task InitPlayer(MusicInfo musicInfo); 100 | 101 | 102 | public partial void Play(MusicInfo currentMusic); 103 | 104 | 105 | 106 | public partial void Stop(); 107 | 108 | 109 | 110 | public partial void PauseOrResume(); 111 | 112 | 113 | 114 | public partial void PauseOrResume(bool status); 115 | 116 | 117 | 118 | 119 | public partial Task UpdateShuffleMap(); 120 | 121 | 122 | 123 | public partial void SetRepeatOneStatus(bool isRepeatOne); 124 | 125 | private partial int GetShuffleMusicIndex(int originItem, int increment); 126 | 127 | } 128 | 129 | 130 | } 131 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Interfaces/IMusicControlService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Abp.Dependency; 7 | 8 | namespace MatoMusic.Core.Interfaces 9 | { 10 | public interface IMusicControlService 11 | { 12 | event EventHandler OnPlayFinished; 13 | event EventHandler OnRebuildMusicInfosFinished; 14 | event EventHandler OnProgressChanged; 15 | event EventHandler OnPlayStatusChanged; 16 | public IMusicInfoManager MusicInfoManager { get; set; } 17 | 18 | int[] ShuffleMap { get; } 19 | List MusicInfos { get; } 20 | int LastIndex { get; } 21 | Task RebuildMusicInfos(Action callback); 22 | void SeekTo(double position); 23 | MusicInfo GetNextMusic(MusicInfo current, bool isShuffle); 24 | MusicInfo GetPreMusic(MusicInfo current, bool isShuffle); 25 | int GetMusicIndex(MusicInfo musicInfo); 26 | MusicInfo GetMusicByIndex(int index); 27 | Task InitPlayer(MusicInfo musicInfo); 28 | void Play(MusicInfo currentMusic); 29 | void Stop(); 30 | void PauseOrResume(); 31 | void PauseOrResume(bool status); 32 | Task UpdateShuffleMap(); 33 | void SetRepeatOneStatus(bool isRepeatOne); 34 | double Duration(); 35 | double CurrentTime(); 36 | bool IsPlaying(); 37 | bool IsInitFinished(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Interfaces/IMusicInfoManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Abp.Dependency; 4 | using MatoMusic.Core.Models; 5 | using MatoMusic.Core.Models.Entities; 6 | using MatoMusic.Infrastructure; 7 | 8 | namespace MatoMusic.Core.Interfaces 9 | { 10 | public interface IMusicInfoManager 11 | { 12 | Task ClearQueue(); 13 | Task CreatePlaylist(Playlist playlist); 14 | Task CreatePlaylistEntry(MusicInfo musicInfo, long playlistId); 15 | Task CreatePlaylistEntrys(List musics, long playlistId); 16 | Task CreatePlaylistEntrys(MusicCollectionInfo musicCollectionInfo, long playlistId); 17 | Task CreatePlaylistEntrysToMyFavourite(List musics); 18 | Task CreatePlaylistEntrysToMyFavourite(MusicCollectionInfo musicCollectionInfo); 19 | Task CreatePlaylistEntryToMyFavourite(MusicInfo musicInfo); 20 | Task CreateQueueEntry(MusicInfo musicInfo); 21 | Task CreateQueueEntrys(List musicInfos); 22 | Task CreateQueueEntrys(MusicCollectionInfo musics); 23 | Task DeleteMusicInfoFormQueueEntry(MusicInfo musicInfo); 24 | Task DeleteMusicInfoFormQueueEntry(string musicTitle); 25 | Task DeletePlaylist(long playlistId); 26 | Task DeletePlaylist(Playlist playlist); 27 | Task DeletePlaylistEntry(MusicInfo musicInfo, long playlistId); 28 | Task DeletePlaylistEntry(string musicTitle, long playlistId); 29 | Task DeletePlaylistEntryFromMyFavourite(MusicInfo musicInfo); 30 | Task>> GetAlbumInfos(); 31 | Task> GetAlphaGroupedAlbumInfo(); 32 | Task> GetAlphaGroupedArtistInfo(); 33 | Task> GetAlphaGroupedMusicInfo(); 34 | Task>> GetArtistInfos(); 35 | Task GetIsMyFavouriteContains(MusicInfo musicInfo); 36 | Task GetIsMyFavouriteContains(string musicTitle); 37 | Task GetIsPlaylistContains(MusicInfo musicInfo, long playlistId); 38 | Task GetIsPlaylistContains(string musicTitle, long playlistId); 39 | Task GetIsQueueContains(string musicTitle); 40 | Task>> GetMusicInfos(); 41 | Task> GetPlaylist(); 42 | Task> GetPlaylistEntry(long playlistId); 43 | Task> GetPlaylistEntryFormMyFavourite(); 44 | Task> GetPlaylistInfo(); 45 | Task> GetQueueEntry(); 46 | Task InsertToEndQueueEntry(MusicInfo musicInfo); 47 | Task InsertToEndQueueEntrys(List musicInfos); 48 | Task InsertToNextQueueEntry(MusicInfo musicInfo, MusicInfo currentMusic); 49 | void ReorderMyFavourite(MusicInfo oldMusicInfo, MusicInfo newMusicInfo); 50 | void ReorderPlaylist(MusicInfo oldMusicInfo, MusicInfo newMusicInfo, long playlistId); 51 | void ReorderQueue(MusicInfo oldMusicInfo, MusicInfo newMusicInfo); 52 | Task UpdatePlaylist(Playlist playlist); 53 | } 54 | } -------------------------------------------------------------------------------- /src/MatoMusic.Core/Localization/MatoMusicLocalization.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Abp.Configuration.Startup; 7 | using Abp.Localization.Dictionaries; 8 | using Abp.Localization.Dictionaries.Xml; 9 | using Abp.Reflection.Extensions; 10 | 11 | namespace MatoMusic.Core.Localization 12 | { 13 | internal class LocalizationConfigurer 14 | { 15 | public static void Configure(ILocalizationConfiguration localizationConfiguration) 16 | { 17 | localizationConfiguration.Sources.Add( 18 | new DictionaryBasedLocalizationSource(MatoMusicConsts.LocalizationSourceName, 19 | new XmlEmbeddedFileLocalizationDictionaryProvider( 20 | typeof(LocalizationConfigurer).GetAssembly(), 21 | "MatoMusic.Core.Localization.SourceFiles" 22 | ) 23 | ) 24 | ); 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Localization/SourceFiles/MatoMusic-zh-Hans.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 关于 5 | 首先感谢下载并体验,祝您有个好心情 6 | 如果您在使用的过程中有疑问,可以参考下面的使用帮助,也可以发送邮件给我。邮件链接在【意见反馈】一栏。 7 | 更新内容: 8 | 添加曲目 9 | 添加歌单 10 | 添加到.. 11 | 收藏至我最喜爱 12 | 添加到队列 13 | 追加到队列 14 | 专辑 15 | 艺术家 16 | 这是一款专注本地音乐体验的播放器 17 | 取消 18 | 清空 19 | 新增歌单 20 | 请输入歌单名称 21 | 编辑 22 | 编辑歌单 23 | 意见反馈 24 | 如果您觉得MatoPlayer不错,请支持我! 25 | 同样,我非常期待您的意见和建议。请将要反馈的内容发送到以下地址: 26 | 也可以关注我的新浪微博: 27 | 去「音乐库」看看 28 | 当前曲目为空 29 | 在AppStore上打分和评价 30 | 使用帮助 31 | 1.在音乐库中,若您只是点击歌曲而不添加到队列,只能起到预览作用而不能再次找到此歌曲2.在队列与歌单中可通过长按激活排序状态3.在主页您可以点击专辑封面打开歌词 32 | 音乐库 33 | 请将设备链接至iTunes,然后同步一些歌曲 34 | 请拷贝一些歌曲到您的Android设备中 35 | 请开始一首歌以显示歌词 36 | 已关闭自动歌词 37 | 点此加载 38 | 番茄播放器 39 | 添加失败 40 | 已存在 41 | 无法修改 42 | 已添加至 43 | 已添加至队列 44 | 已追加至队列 45 | 已创建 46 | 已修改 47 | 已删除 48 | 无法使用名称 49 | 已清空队列 50 | 无法删除 51 | 已关闭睡眠模式 52 | 歌曲 53 | 我最喜爱 54 | 新建歌单 55 | 下一曲 56 | 没有任何项目 57 | 说明 58 | 正在播放 59 | 个性化 60 | 播放 61 | 播放全部 62 | 歌单 63 | 下一首播放 64 | 播放此 65 | 队列 66 | 删除 67 | 重命名.. 68 | 搜索 69 | 请输入歌曲、艺术家、或专辑的名称 70 | 设置 71 | 睡眠模式设置 72 | 常规 73 | 自动下载歌词 74 | 协助改善产品 75 | 睡眠模式 76 | 已开启睡眠模式 将在{0}小时{1}分钟后停止 77 | 注意:请保证播放器在前台运行,可锁屏 78 | 已启用睡眠 79 | 本应用使用并遵循各开源框架条款 80 | 提交 81 | 定时 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Localization/TranslateExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Reflection; 4 | using System.Resources; 5 | using Abp.Domain.Services; 6 | using Abp.Localization; 7 | using Microsoft.Maui.Controls; 8 | using Microsoft.Maui.Controls.Xaml; 9 | 10 | namespace MatoMusic.Core 11 | { 12 | // You exclude the 'Extension' suffix when using in Xaml markup 13 | [ContentProperty("Text")] 14 | public class TranslateExtension : DomainService, IMarkupExtension 15 | { 16 | public TranslateExtension() 17 | { 18 | LocalizationSourceName = MatoMusicConsts.LocalizationSourceName; 19 | 20 | } 21 | public string Text { get; set; } 22 | 23 | public object ProvideValue(IServiceProvider serviceProvider) 24 | { 25 | Console.WriteLine(CultureInfo.CurrentUICulture); 26 | if (Text == null) 27 | return ""; 28 | var translation = L(Text); 29 | return translation; 30 | } 31 | 32 | 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/MatoMusic - Backup.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0-android;net7.0-ios 5 | $(TargetFrameworks);net7.0-windows10.0.19041.0 6 | 7 | 8 | true 9 | true 10 | enable 11 | 12 | 14.2 13 | 14.0 14 | 21.0 15 | 10.0.17763.0 16 | 10.0.17763.0 17 | 6.5 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/MatoMusic.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0-android34.0;net8.0-ios 5 | $(TargetFrameworks);net8.0-windows10.0.19041.0 6 | 7 | 8 | true 9 | true 10 | enable 11 | 12 | 14.2 13 | 14.0 14 | 21.0 15 | 10.0.17763.0 16 | 10.0.17763.0 17 | 6.5 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/MatoMusicBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Security.Cryptography; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using Abp; 10 | using Abp.Extensions; 11 | using Abp.Castle.Logging.Log4Net; 12 | using Abp.Dependency; 13 | using Abp.Modules; 14 | using Castle.Facilities.Logging; 15 | using Castle.Windsor.MsDependencyInjection; 16 | using MatoMusic.Infrastructure.Helper; 17 | using Microsoft.Extensions.DependencyInjection; 18 | using Microsoft.Maui; 19 | using Microsoft.Maui.Hosting; 20 | 21 | namespace MatoMusic.Core 22 | { 23 | 24 | public static class MatoMusicBuilderExtensions 25 | { 26 | 27 | public static MauiAppBuilder UseMatoMusic(this MauiAppBuilder builder) where TStartupModule : AbpModule 28 | { 29 | var logCfgName = "log4net.config"; 30 | var appCfgName = "appsettings.json"; 31 | var dbName = "mato.db"; 32 | 33 | string documentsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), MatoMusicConsts.LocalizationSourceName, logCfgName); 34 | string documentsPath2 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), MatoMusicConsts.LocalizationSourceName, appCfgName); 35 | string dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), MatoMusicConsts.LocalizationSourceName, dbName); 36 | 37 | InitConfig(logCfgName, documentsPath); 38 | InitConfig(appCfgName, documentsPath2); 39 | InitDataBase(dbName, dbPath); 40 | var _bootstrapper = AbpBootstrapper.Create(options => 41 | { 42 | options.IocManager = IocManager.Instance; 43 | }); 44 | _bootstrapper.IocManager.IocContainer.AddFacility(f => f.UseAbpLog4Net().WithConfig(documentsPath)); 45 | 46 | builder.Services.AddSingleton(_bootstrapper); 47 | WindsorRegistrationHelper.CreateServiceProvider(_bootstrapper.IocManager.IocContainer, builder.Services); 48 | 49 | return builder; 50 | } 51 | 52 | private static void InitConfig(string logCfgName, string documentsPath) 53 | { 54 | 55 | var assembly = IntrospectionExtensions.GetTypeInfo(typeof(MatoMusicBuilderExtensions)).Assembly; 56 | 57 | Stream stream = assembly.GetManifestResourceStream($"MatoMusic.Core.{logCfgName}"); 58 | string text = ""; 59 | using (var reader = new System.IO.StreamReader(stream)) 60 | { 61 | text = reader.ReadToEnd(); 62 | } 63 | if (DirFileHelper.IsExistFile(documentsPath)) 64 | { 65 | var currentFileContent = DirFileHelper.ReadFile(documentsPath); 66 | var isSameContent = currentFileContent.ToMd5() == text.ToMd5(); 67 | if (isSameContent) 68 | { 69 | return; 70 | } 71 | DirFileHelper.CreateFile(documentsPath, text); 72 | 73 | } 74 | else 75 | { 76 | DirFileHelper.CreateFile(documentsPath, text); 77 | 78 | } 79 | } 80 | 81 | private static void InitDataBase(string dbName, string documentsPath) 82 | { 83 | var assembly = IntrospectionExtensions.GetTypeInfo(typeof(MatoMusicBuilderExtensions)).Assembly; 84 | //ef不需要我们写入db文件 85 | //Stream stream = assembly.GetManifestResourceStream($"MatoMusic.Core.{dbName}"); 86 | //StreamHelper.WriteStream(stream, documentsPath); 87 | 88 | var path = Path.GetDirectoryName(documentsPath); 89 | DirFileHelper.CreateDir(path); 90 | } 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/MatoMusicConsts.cs: -------------------------------------------------------------------------------- 1 | namespace MatoMusic.Core 2 | { 3 | public class MatoMusicConsts 4 | { 5 | public const string LocalizationSourceName = "MatoMusic"; 6 | 7 | public const string ConnectionStringName = "Default"; 8 | 9 | public const bool MultiTenancyEnabled = false; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/MatoMusicCoreModule.cs: -------------------------------------------------------------------------------- 1 | using Abp.AutoMapper; 2 | using Abp.Modules; 3 | using Abp.Reflection.Extensions; 4 | using MatoMusic.Core.Configuration; 5 | using MatoMusic.Core.Localization; 6 | using MatoMusic.Core.Services; 7 | using MatoMusic.Core.Settings; 8 | using MatoMusic.Core.ViewModel; 9 | using Microsoft.Extensions.Configuration; 10 | using Microsoft.Extensions.Hosting; 11 | using System; 12 | using System.Collections.Generic; 13 | using System.IO; 14 | using System.Linq; 15 | using System.Reflection; 16 | using System.Text; 17 | using System.Threading.Tasks; 18 | 19 | namespace MatoMusic.Core 20 | { 21 | [DependsOn( 22 | typeof(AbpAutoMapperModule))] 23 | public class MatoMusicCoreModule : AbpModule 24 | { 25 | private readonly string development; 26 | 27 | public MatoMusicCoreModule() 28 | { 29 | development = EnvironmentName.Development; 30 | 31 | } 32 | public override void PreInitialize() 33 | { 34 | LocalizationConfigurer.Configure(Configuration.Localization); 35 | 36 | Configuration.Settings.Providers.Add(); 37 | 38 | string documentsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), MatoMusicConsts.LocalizationSourceName); 39 | 40 | var configuration = AppConfigurations.Get(documentsPath, development); 41 | var connectionString = configuration.GetConnectionString(MatoMusicConsts.ConnectionStringName); 42 | 43 | var dbName = "mato.db"; 44 | string dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), MatoMusicConsts.LocalizationSourceName, dbName); 45 | 46 | Configuration.DefaultNameOrConnectionString = String.Format(connectionString, dbPath); 47 | base.PreInitialize(); 48 | } 49 | 50 | public override void Initialize() 51 | { 52 | IocManager.RegisterAssemblyByConvention(typeof(MatoMusicCoreModule).GetAssembly()); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/AlbumInfo.cs: -------------------------------------------------------------------------------- 1 | namespace MatoMusic.Core.Models 2 | { 3 | public class AlbumInfo : MusicCollectionInfo 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/ArtistInfo.cs: -------------------------------------------------------------------------------- 1 | namespace MatoMusic.Core.Models 2 | { 3 | public class ArtistInfo : MusicCollectionInfo 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/BillboardInfo.cs: -------------------------------------------------------------------------------- 1 | namespace MatoMusic.Core.Models 2 | { 3 | public class BillboardInfo : MusicCollectionInfo 4 | { 5 | public string OnlineId { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/Entities/Playlist.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Entities.Auditing; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.ComponentModel.DataAnnotations.Schema; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace MatoMusic.Core.Models.Entities 11 | { 12 | public class Playlist : FullAuditedEntity 13 | { 14 | public Playlist() 15 | { 16 | 17 | } 18 | public Playlist(string name, bool isHidden, bool isRemovable) 19 | { 20 | Title = name; 21 | IsHidden = isHidden; 22 | IsRemovable = isRemovable; 23 | } 24 | 25 | [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] 26 | public override long Id { get; set; } 27 | public string Title { get; set; } 28 | 29 | public bool IsHidden { get; set; } 30 | 31 | public bool IsRemovable { get; set; } 32 | 33 | public ICollection PlaylistItems { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/Entities/PlaylistItem.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Entities.Auditing; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.ComponentModel.DataAnnotations.Schema; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace MatoMusic.Core.Models.Entities 10 | { 11 | public class PlaylistItem : FullAuditedEntity 12 | { 13 | public PlaylistItem() 14 | { 15 | 16 | } 17 | public PlaylistItem(long playlistId, long musicInfoId, string musicTitle, int rank) 18 | { 19 | PlaylistId = playlistId; 20 | MusicInfoId= musicInfoId; 21 | MusicTitle = musicTitle; 22 | Rank = rank; 23 | } 24 | 25 | [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] 26 | public override long Id { get; set; } 27 | 28 | public int Rank { get; set; } 29 | 30 | public long PlaylistId { get; set; } 31 | [ForeignKey("PlaylistId")] 32 | 33 | public Playlist Playlist { get; set; } 34 | public string MusicTitle { get; set; } 35 | 36 | public long MusicInfoId { get; set; } 37 | 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/Entities/Queue.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Entities.Auditing; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.ComponentModel.DataAnnotations.Schema; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace MatoMusic.Core.Models.Entities 11 | { 12 | public class Queue : FullAuditedEntity 13 | { 14 | public Queue() 15 | { 16 | 17 | } 18 | public Queue(string musicTitle, int rank, long musicInfoId) 19 | { 20 | MusicTitle = musicTitle; 21 | Rank = rank; 22 | MusicInfoId = musicInfoId; 23 | } 24 | 25 | [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] 26 | public override long Id { get; set; } 27 | 28 | public long MusicInfoId { get; set; } 29 | 30 | public int Rank { get; set; } 31 | 32 | public string MusicTitle { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/MenuCellInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MatoMusic.Core.Models 8 | { 9 | public class MenuCellInfo 10 | { 11 | public MenuCellInfo() 12 | { 13 | Enable = true; 14 | } 15 | public string Title { get; set; } 16 | public string Code { get; set; } 17 | public string Icon { get; set; } 18 | public bool Enable { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/MusicCollectionInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | using System.Collections.Specialized; 4 | using System.Linq; 5 | using MatoMusic.Infrastructure; 6 | using MatoMusic.Infrastructure.Common; 7 | using Microsoft.Maui.Controls; 8 | 9 | namespace MatoMusic.Core 10 | { 11 | public abstract class MusicCollectionInfo : ObservableObject, IBasicInfo 12 | { 13 | 14 | public long Id 15 | { 16 | get; 17 | set; 18 | } 19 | 20 | private string _title; 21 | 22 | public string Title 23 | { 24 | get { return _title; } 25 | set 26 | { 27 | _title = value; 28 | RaisePropertyChanged(); 29 | } 30 | } 31 | 32 | 33 | public string GroupHeader { get; set; } 34 | 35 | 36 | private ObservableCollection _musics; 37 | 38 | public ObservableCollection Musics 39 | { 40 | get 41 | { 42 | if (_musics == null) 43 | { 44 | _musics = new ObservableCollection(); 45 | } 46 | return _musics; 47 | 48 | } 49 | set 50 | { 51 | _musics = value; 52 | _musics.CollectionChanged += _musics_CollectionChanged; 53 | RaisePropertyChanged(); 54 | RaisePropertyChanged(nameof(Time)); 55 | RaisePropertyChanged(nameof(Count)); 56 | 57 | } 58 | } 59 | 60 | private void _musics_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) 61 | { 62 | if (e.Action == NotifyCollectionChangedAction.Remove || e.Action == NotifyCollectionChangedAction.Add) 63 | { 64 | RaisePropertyChanged(nameof(Time)); 65 | RaisePropertyChanged(nameof(Count)); 66 | } 67 | } 68 | 69 | public string Artist 70 | { 71 | get; 72 | set; 73 | } 74 | public ImageSource AlbumArt { get; set; } 75 | public string AlbumArtPath { get; set; } 76 | 77 | public int Count => Musics.Count(); 78 | 79 | public string Time 80 | { 81 | get 82 | { 83 | var totalSec = Math.Truncate((double)Musics.Sum(c => (long)c.Duration)); 84 | var totalTime = TimeSpan.FromSeconds(totalSec); 85 | var time = totalTime.ToString("g"); 86 | return time; 87 | } 88 | } 89 | 90 | } 91 | } -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/MusicInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Abp.Dependency; 8 | using MatoMusic.Core.Interfaces; 9 | using MatoMusic.Infrastructure; 10 | using MatoMusic.Infrastructure.Common; 11 | using Microsoft.Maui.Controls; 12 | 13 | namespace MatoMusic.Core 14 | { 15 | public class MusicInfo : ObservableObject, IBasicInfo, IClueObject 16 | { 17 | public MusicInfo() 18 | { 19 | PropertyChanged += MusicInfo_PropertyChanged; 20 | } 21 | 22 | private async void MusicInfo_PropertyChanged(object sender, PropertyChangedEventArgs e) 23 | { 24 | var MusicInfoManager = IocManager.Instance.Resolve(); 25 | 26 | if (e.PropertyName == nameof(IsFavourite)) 27 | { 28 | if (IsFavourite) 29 | { 30 | await MusicInfoManager.CreatePlaylistEntryToMyFavourite(this); 31 | } 32 | else 33 | { 34 | await MusicInfoManager.DeletePlaylistEntryFromMyFavourite(this); 35 | } 36 | } 37 | } 38 | 39 | public long Id { get; set; } 40 | public string OnlineId { get; set; } 41 | public string Title 42 | { 43 | get; 44 | set; 45 | } 46 | public string Url 47 | { 48 | get; 49 | set; 50 | } 51 | public string AlbumTitle 52 | { 53 | get; 54 | set; 55 | } 56 | public string Artist 57 | { 58 | get; 59 | set; 60 | } 61 | 62 | private bool _isFavourite; 63 | public bool IsFavourite 64 | { 65 | get { return _isFavourite; } 66 | 67 | set 68 | { 69 | if (value != _isFavourite) 70 | { 71 | _isFavourite = value; 72 | if (IsInitFinished) 73 | { 74 | RaisePropertyChanged(); 75 | 76 | } 77 | } 78 | } 79 | } 80 | 81 | private bool _isPlaying; 82 | 83 | public bool IsPlaying 84 | { 85 | get { return _isPlaying; } 86 | set 87 | { 88 | if (value != _isPlaying) 89 | { 90 | _isPlaying = value; 91 | 92 | RaisePropertyChanged(); 93 | 94 | 95 | }; 96 | } 97 | } 98 | 99 | public string GroupHeader { get; set; } 100 | public ImageSource AlbumArt { get; set; } 101 | public string AlbumArtPath { get; set; } 102 | public ulong Duration { get; set; } 103 | public string Genre { get; set; } 104 | 105 | public List ClueStrings 106 | { 107 | get 108 | { 109 | var result = new List(); 110 | 111 | 112 | result.Add(Title); 113 | result.Add(Artist); 114 | result.Add(AlbumTitle); 115 | return result; 116 | } 117 | } 118 | 119 | public string GC { get; set; } 120 | 121 | public bool IsInitFinished; 122 | 123 | /// 124 | /// 提供搜索线索 125 | /// 126 | /// 搜索线索字符串 127 | public override string ToString() 128 | { 129 | return string.Format("{0} {1} {2}", Title, Artist, AlbumTitle); 130 | } 131 | 132 | 133 | public void SetFavourite(bool isF, bool isAffectPlaylist = true) 134 | { 135 | if (isAffectPlaylist) 136 | { 137 | IsFavourite = isF; 138 | } 139 | else 140 | { 141 | _isFavourite = isF; 142 | } 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Models/PlaylistInfo.cs: -------------------------------------------------------------------------------- 1 | using Abp.AutoMapper; 2 | using MatoMusic.Core.Models.Entities; 3 | using Microsoft.Maui.Controls; 4 | 5 | namespace MatoMusic.Core.Models 6 | { 7 | 8 | [AutoMapFrom(typeof(Playlist))] 9 | [AutoMapTo(typeof(Playlist))] 10 | public class PlaylistInfo : MusicCollectionInfo 11 | { 12 | public bool IsHidden { get; set; } 13 | 14 | public bool IsRemovable { get; set; } 15 | 16 | public ImageSource PlaylistArt { get; set; } 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /src/MatoMusic.Core/MusicInfoComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MatoMusic.Core 8 | { 9 | public class MusicInfoComparer : IEqualityComparer 10 | { 11 | public bool Equals(MusicInfo x, MusicInfo y) 12 | { 13 | return x.Id == y.Id && (bool)x.Url?.Equals(y.Url); 14 | } 15 | 16 | public int GetHashCode(MusicInfo obj) 17 | { 18 | return (int)obj.Id; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Settings/CommonSettingNames.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MatoMusic.Core.Settings 8 | { 9 | public static class CommonSettingNames 10 | { 11 | public const string DatabaseVersion = "DatabaseVersion"; 12 | 13 | public const string IsNewSeason = "IsNewSeason"; 14 | public const string IsSleepModeOn = "IsSleepModeOn"; 15 | public const string TimingOffValue = "TimingOffValue"; 16 | public const string IsStopWhenTerminate = "IsStopWhenTerminate"; 17 | public const string IsAutoLrc = "IsAutoLrc"; 18 | public const string IsAutoOffset = "IsAutoOffset"; 19 | public const string IsAutoGA = "IsAutoGA"; 20 | public const string BackgroundList = "BackgroundList"; 21 | public const string IsShuffle = "IsShuffle"; 22 | public const string IsRepeatOne = "IsRepeatOne"; 23 | public const string IsRepeat = "IsRepeat"; 24 | public const string BreakPointMusicIndex = "BreakPointMusicIndex"; 25 | public const string IsHideQueueButton = "IsHideQueueButton"; 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Settings/CommonSettingProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Abp; 7 | using Abp.Configuration; 8 | using Abp.Localization; 9 | 10 | namespace MatoMusic.Core.Settings 11 | { 12 | internal class CommonSettingProvider : SettingProvider 13 | { 14 | public override IEnumerable GetSettingDefinitions(SettingDefinitionProviderContext context) 15 | { 16 | return new[] 17 | { 18 | new SettingDefinition(CommonSettingNames.DatabaseVersion, "1999-01-01", L("数据库版本"), scopes: SettingScopes.All), 19 | new SettingDefinition(CommonSettingNames.IsSleepModeOn, "false", L("睡眠模式开关"), scopes: SettingScopes.All), 20 | new SettingDefinition(CommonSettingNames.IsAutoLrc, "true", L("是否自动歌词"), scopes: SettingScopes.All), 21 | new SettingDefinition(CommonSettingNames.IsAutoOffset, "false", L("是否自动滚动"), scopes: SettingScopes.All), 22 | new SettingDefinition(CommonSettingNames.IsStopWhenTerminate, "false", L("离开后关闭"), scopes: SettingScopes.All), 23 | new SettingDefinition(CommonSettingNames.TimingOffValue, "1200", L("倒计时"), scopes: SettingScopes.All), 24 | new SettingDefinition(CommonSettingNames.BreakPointMusicIndex, "0", L("歌曲上次播放位置"), scopes: SettingScopes.All), 25 | new SettingDefinition(CommonSettingNames.IsRepeat, "false", L("是否循环"), scopes: SettingScopes.All), 26 | new SettingDefinition(CommonSettingNames.IsRepeatOne, "false", L("是否单曲循环"), scopes: SettingScopes.All), 27 | new SettingDefinition(CommonSettingNames.IsShuffle, "false", L("是否随机播放"), scopes: SettingScopes.All), 28 | new SettingDefinition(CommonSettingNames.IsHideQueueButton, "false", L("是否隐藏正在播放页面底端的队列按钮"), scopes: SettingScopes.All), 29 | }; 30 | } 31 | 32 | private static LocalizableString L(string name) 33 | { 34 | return new LocalizableString(name, AbpConsts.LocalizationSourceName); 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/Theme/Theme.cs: -------------------------------------------------------------------------------- 1 | using Abp.Domain.Entities.Auditing; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | using System.ComponentModel.DataAnnotations.Schema; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace MatoMusic.Core.Theme 11 | { 12 | public class Theme : FullAuditedEntity 13 | { 14 | [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] 15 | public override long Id { get; set; } 16 | public string Title { get; set; } 17 | public string Name { get; set; } 18 | public string Img { get; set; } 19 | 20 | public bool IsSel { get; set; } 21 | public string ColorA { get; set; } 22 | public string ColorB { get; set; } 23 | public string ColorC { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Diagnostics; 5 | using System.Linq.Expressions; 6 | using System.Reflection; 7 | using System.Runtime.CompilerServices; 8 | using System.Text; 9 | using Abp; 10 | using Abp.Dependency; 11 | using Abp.Domain.Services; 12 | 13 | namespace MatoMusic.Core.ViewModel 14 | { 15 | public abstract class ViewModelBase : AbpServiceBase, INotifyPropertyChanged 16 | { 17 | 18 | public ViewModelBase() 19 | { 20 | LocalizationSourceName = MatoMusicConsts.LocalizationSourceName; 21 | } 22 | 23 | /// Occurs after a property value changes. 24 | public event PropertyChangedEventHandler PropertyChanged; 25 | 26 | /// 27 | /// Provides access to the PropertyChanged event handler to derived classes. 28 | /// 29 | protected PropertyChangedEventHandler PropertyChangedHandler { get; } 30 | 31 | [Conditional("DEBUG")] 32 | [DebuggerStepThrough] 33 | public void VerifyPropertyName(string propertyName) 34 | { 35 | Type type = GetType(); 36 | if (!string.IsNullOrEmpty(propertyName) && type.GetTypeInfo().GetDeclaredProperty(propertyName) == null) 37 | throw new ArgumentException("Property not found", propertyName); 38 | } 39 | 40 | public virtual void RaisePropertyChanged([CallerMemberName] string propertyName = null) 41 | { 42 | // ISSUE: reference to a compiler-generated field 43 | PropertyChangedEventHandler propertyChanged = PropertyChanged; 44 | if (propertyChanged == null) 45 | return; 46 | propertyChanged(this, new PropertyChangedEventArgs(propertyName)); 47 | } 48 | 49 | public virtual void RaisePropertyChanged(Expression> propertyExpression) 50 | { 51 | // ISSUE: reference to a compiler-generated field 52 | if (PropertyChanged == null) 53 | return; 54 | string propertyName = GetPropertyName(propertyExpression); 55 | if (string.IsNullOrEmpty(propertyName)) 56 | return; 57 | RaisePropertyChanged(propertyName); 58 | } 59 | 60 | protected static string GetPropertyName(Expression> propertyExpression) 61 | { 62 | if (propertyExpression == null) 63 | throw new ArgumentNullException(nameof(propertyExpression)); 64 | MemberExpression body = propertyExpression.Body as MemberExpression; 65 | if (body == null) 66 | throw new ArgumentException("Invalid argument", nameof(propertyExpression)); 67 | PropertyInfo member = body.Member as PropertyInfo; 68 | if (member == null) 69 | throw new ArgumentException("Argument is not a property", nameof(propertyExpression)); 70 | return member.Name; 71 | } 72 | 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "Default": "Data Source=file:{0};" 4 | }, 5 | "Logging": { 6 | "IncludeScopes": false, 7 | "LogLevel": { 8 | "Default": "Debug", 9 | "System": "Information", 10 | "Microsoft": "Information" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/log4net.Production.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/log4net.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/MatoMusic.Core/mato.db: -------------------------------------------------------------------------------- 1 | SQLite format 3@ .O}  -------------------------------------------------------------------------------- /src/MatoMusic.Core/mato.db-shm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic.Core/mato.db-shm -------------------------------------------------------------------------------- /src/MatoMusic.Core/mato.db-wal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic.Core/mato.db-wal -------------------------------------------------------------------------------- /src/MatoMusic.EntityFrameworkCore/EntityFrameworkCore/DbContextOptionsConfigurer.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using Microsoft.EntityFrameworkCore; 3 | 4 | namespace MatoMusic.EntityFrameworkCore 5 | { 6 | public static class DbContextOptionsConfigurer 7 | { 8 | public static void Configure( 9 | DbContextOptionsBuilder dbContextOptions, 10 | string connectionString 11 | ) 12 | { 13 | /* This is the single point to configure DbContextOptions for MatoMusicDbContext */ 14 | dbContextOptions.UseSqlite(connectionString); 15 | } 16 | 17 | public static void Configure(DbContextOptionsBuilder builder, DbConnection connection) 18 | { 19 | builder.UseSqlite(connection); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MatoMusic.EntityFrameworkCore/EntityFrameworkCore/MatoMusicDbContext.cs: -------------------------------------------------------------------------------- 1 | using Abp.EntityFrameworkCore; 2 | using Microsoft.EntityFrameworkCore; 3 | using MatoMusic.Core.Theme; 4 | using MatoMusic.Core.Models.Entities; 5 | 6 | namespace MatoMusic.EntityFrameworkCore 7 | { 8 | public class MatoMusicDbContext : AbpDbContext 9 | { 10 | //Add DbSet properties for your entities... 11 | 12 | public DbSet Queue { get; set; } 13 | public DbSet Playlist { get; set; } 14 | public DbSet PlaylistItem { get; set; } 15 | public DbSet Theme { get; set; } 16 | public MatoMusicDbContext(DbContextOptions options) 17 | : base(options) 18 | { 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MatoMusic.EntityFrameworkCore/EntityFrameworkCore/MatoMusicDbContextFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using MatoMusic.Core; 5 | using MatoMusic.Core.Configuration; 6 | using Microsoft.EntityFrameworkCore; 7 | using Microsoft.EntityFrameworkCore.Design; 8 | using Microsoft.Extensions.Configuration; 9 | 10 | namespace MatoMusic.EntityFrameworkCore 11 | { 12 | /* This class is needed to run EF Core PMC commands. Not used anywhere else */ 13 | public class MatoMusicDbContextFactory : IDesignTimeDbContextFactory 14 | { 15 | public MatoMusicDbContext CreateDbContext(string[] args) 16 | { 17 | var sqliteFilename = "mato.db"; 18 | string documentsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), sqliteFilename); 19 | var builder = new DbContextOptionsBuilder(); 20 | var hostFolder = Path.Combine(Environment.CurrentDirectory, "bin", "Debug", "net8.0"); 21 | 22 | var configuration = AppConfigurations.Get(hostFolder); 23 | DbContextOptionsConfigurer.Configure( 24 | builder, 25 | configuration.GetConnectionString(MatoMusicConsts.ConnectionStringName) 26 | ); 27 | 28 | return new MatoMusicDbContext(builder.Options); 29 | 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/MatoMusic.EntityFrameworkCore/EntityFrameworkCore/MatoMusicEntityFrameworkCoreModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Transactions; 3 | using Abp.Dependency; 4 | using Abp.Domain.Uow; 5 | using Abp.EntityFrameworkCore; 6 | using Abp.EntityFrameworkCore.Configuration; 7 | using Abp.EntityFrameworkCore.Uow; 8 | using Abp.Modules; 9 | using Abp.Reflection.Extensions; 10 | using MatoMusic.Core; 11 | using MatoMusic.EntityFrameworkCore.Seed; 12 | using Microsoft.EntityFrameworkCore; 13 | 14 | namespace MatoMusic.EntityFrameworkCore 15 | { 16 | [DependsOn( 17 | typeof(MatoMusicCoreModule), 18 | typeof(AbpEntityFrameworkCoreModule))] 19 | public class MatoMusicEntityFrameworkCoreModule : AbpModule 20 | { 21 | public bool SkipDbContextRegistration { get; set; } 22 | 23 | public bool SkipDbSeed { get; set; } 24 | 25 | public override void PreInitialize() 26 | { 27 | if (!SkipDbContextRegistration) 28 | { 29 | Configuration.Modules.AbpEfCore().AddDbContext(options => 30 | { 31 | if (options.ExistingConnection != null) 32 | { 33 | DbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); 34 | } 35 | else 36 | { 37 | DbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ConnectionString); 38 | } 39 | }); 40 | } 41 | } 42 | public override void Initialize() 43 | { 44 | 45 | IocManager.RegisterAssemblyByConvention(typeof(MatoMusicEntityFrameworkCoreModule).GetAssembly()); 46 | 47 | } 48 | 49 | public override void PostInitialize() 50 | { 51 | Helper.WithDbContextHelper.WithDbContext(IocManager, RunMigrate); 52 | if (!SkipDbSeed) 53 | { 54 | SeedHelper.SeedHostDb(IocManager); 55 | } 56 | } 57 | 58 | public static void RunMigrate(MatoMusicDbContext dbContext) 59 | { 60 | dbContext.Database.Migrate(); 61 | } 62 | 63 | 64 | } 65 | } -------------------------------------------------------------------------------- /src/MatoMusic.EntityFrameworkCore/Helper/WithDbContextHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Transactions; 7 | using Abp.Dependency; 8 | using Abp.Domain.Uow; 9 | using Abp.EntityFrameworkCore.Uow; 10 | using Microsoft.EntityFrameworkCore; 11 | 12 | namespace MatoMusic.EntityFrameworkCore.Helper 13 | { 14 | public class WithDbContextHelper 15 | { 16 | public static void WithDbContext(IIocResolver iocResolver, Action contextAction) 17 | where TDbContext : DbContext 18 | { 19 | using (var uowManager = iocResolver.ResolveAsDisposable()) 20 | { 21 | using (var uow = uowManager.Object.Begin(TransactionScopeOption.Suppress)) 22 | { 23 | var context = uowManager.Object.Current.GetDbContext(); 24 | 25 | contextAction(context); 26 | 27 | uow.Complete(); 28 | } 29 | } 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/MatoMusic.EntityFrameworkCore/MatoMusic - Backup.EntityFrameworkCore.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0-android;net7.0-ios 5 | $(TargetFrameworks);net7.0-windows10.0.19041.0 6 | 7 | 8 | true 9 | true 10 | enable 11 | 12 | 14.2 13 | 14.0 14 | 21.0 15 | 10.0.17763.0 16 | 10.0.17763.0 17 | 6.5 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | all 27 | runtime; build; native; contentfiles; analyzers; buildtransitive 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/MatoMusic.EntityFrameworkCore/MatoMusic.EntityFrameworkCore.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0-android34.0;net8.0-ios 5 | $(TargetFrameworks);net8.0-windows10.0.19041.0 6 | 7 | 8 | true 9 | true 10 | enable 11 | 12 | 14.2 13 | 14.0 14 | 21.0 15 | 10.0.17763.0 16 | 10.0.17763.0 17 | 6.5 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | all 26 | runtime; build; native; contentfiles; analyzers; buildtransitive 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/MatoMusic.EntityFrameworkCore/Seed/InitialDbBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MatoMusic.EntityFrameworkCore.Seed 4 | { 5 | internal class InitialDbBuilder 6 | { 7 | private MatoMusicDbContext context; 8 | 9 | public InitialDbBuilder(MatoMusicDbContext context) 10 | { 11 | this.context = context; 12 | } 13 | 14 | internal void Create() 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/MatoMusic.EntityFrameworkCore/Seed/SeedHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Transactions; 7 | using Abp.Dependency; 8 | using Abp.Domain.Uow; 9 | using Abp.EntityFrameworkCore.Uow; 10 | using Microsoft.EntityFrameworkCore; 11 | 12 | namespace MatoMusic.EntityFrameworkCore.Seed 13 | { 14 | public static class SeedHelper 15 | { 16 | public static void SeedHostDb(IIocResolver iocResolver) 17 | { 18 | Helper.WithDbContextHelper.WithDbContext(iocResolver, SeedHostDb); 19 | } 20 | 21 | public static void SeedHostDb(MatoMusicDbContext context) 22 | { 23 | context.SuppressAutoSetTenantId = true; 24 | 25 | // Host seed 26 | new InitialDbBuilder(context).Create(); 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/MatoMusic.Infrastructure/Common/IBasicInfo.cs: -------------------------------------------------------------------------------- 1 | namespace MatoMusic.Infrastructure.Common 2 | { 3 | public interface IBasicInfo 4 | { 5 | long Id { get; set; } 6 | string Title { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /src/MatoMusic.Infrastructure/Common/IClueObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MatoMusic.Infrastructure.Common 8 | { 9 | public interface IClueObject 10 | { 11 | /// 12 | /// 线索字符串表 13 | /// 14 | List ClueStrings { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/MatoMusic.Infrastructure/Helper/CommonHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace MatoMusic.Infrastructure.Helper 9 | { 10 | public class CommonHelper 11 | { 12 | public static int[] GetRandomArry(int minval, int maxval) 13 | { 14 | 15 | int[] arr = new int[maxval - minval + 1]; 16 | int i; 17 | //初始化数组 18 | for (i = 0; i <= maxval - minval; i++) 19 | { 20 | arr[i] = i + minval; 21 | } 22 | //随机数 23 | Random r = new Random(); 24 | for (int j = maxval - minval; j >= 1; j--) 25 | { 26 | int address = r.Next(0, j); 27 | int tmp = arr[address]; 28 | arr[address] = arr[j]; 29 | arr[j] = tmp; 30 | } 31 | //输出 32 | foreach (int k in arr) 33 | { 34 | Debug.WriteLine(k + " "); 35 | } 36 | return arr; 37 | } 38 | 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/MatoMusic.Infrastructure/Helper/StreamHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace MatoMusic.Infrastructure.Helper 7 | { 8 | public class StreamHelper 9 | { 10 | public static void WriteStream(Stream stream, string fileName) 11 | { 12 | FileStream fs = null; 13 | BinaryWriter bw = null; 14 | try 15 | { 16 | byte[] bytes = new byte[stream.Length]; 17 | stream.Read(bytes, 0, bytes.Length); 18 | stream.Seek(0, SeekOrigin.Begin); 19 | fs = new FileStream(fileName, FileMode.Create); 20 | bw = new BinaryWriter(fs); 21 | bw.Write(bytes); 22 | } 23 | catch (Exception ex) 24 | { 25 | return; 26 | } 27 | finally 28 | { 29 | bw.Close(); 30 | fs.Close(); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/MatoMusic.Infrastructure/Helper/TokenHelper.cs: -------------------------------------------------------------------------------- 1 | namespace MatoMusic.Infrastructure.Helper 2 | { 3 | public class TokenHelper 4 | { 5 | internal static readonly string WindowToken = "WINDOW"; 6 | } 7 | } -------------------------------------------------------------------------------- /src/MatoMusic.Infrastructure/InfoResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MatoMusic.Infrastructure 8 | { 9 | public class InfoResult 10 | { 11 | public InfoResult(bool isSucess) 12 | { 13 | IsSucess = isSucess; 14 | Result = default; 15 | } 16 | public InfoResult(bool isSucess, T result) 17 | { 18 | IsSucess = isSucess; 19 | Result = result; 20 | } 21 | public bool IsSucess { get; set; } 22 | public T Result { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/MatoMusic.Infrastructure/MatoMusic.Infrastructure.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.1 5 | enable 6 | AnyCPU;x64 7 | 8 | 9 | 10 | 11 | all 12 | runtime; build; native; contentfiles; analyzers 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/MatoMusic.Infrastructure/ObservableObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Diagnostics; 5 | using System.Linq.Expressions; 6 | using System.Reflection; 7 | using System.Runtime.CompilerServices; 8 | using System.Text; 9 | 10 | namespace MatoMusic.Infrastructure 11 | { 12 | public class ObservableObject : INotifyPropertyChanged 13 | { 14 | /// Occurs after a property value changes. 15 | public event PropertyChangedEventHandler PropertyChanged; 16 | 17 | /// 18 | /// Provides access to the PropertyChanged event handler to derived classes. 19 | /// 20 | protected PropertyChangedEventHandler PropertyChangedHandler { get; } 21 | 22 | [Conditional("DEBUG")] 23 | [DebuggerStepThrough] 24 | public void VerifyPropertyName(string propertyName) 25 | { 26 | Type type = GetType(); 27 | if (!string.IsNullOrEmpty(propertyName) && type.GetTypeInfo().GetDeclaredProperty(propertyName) == null) 28 | throw new ArgumentException("Property not found", propertyName); 29 | } 30 | 31 | public virtual void RaisePropertyChanged([CallerMemberName] string propertyName = null) 32 | { 33 | // ISSUE: reference to a compiler-generated field 34 | PropertyChangedEventHandler propertyChanged = PropertyChanged; 35 | if (propertyChanged == null) 36 | return; 37 | propertyChanged(this, new PropertyChangedEventArgs(propertyName)); 38 | } 39 | 40 | public virtual void RaisePropertyChanged(Expression> propertyExpression) 41 | { 42 | // ISSUE: reference to a compiler-generated field 43 | if (PropertyChanged == null) 44 | return; 45 | string propertyName = GetPropertyName(propertyExpression); 46 | if (string.IsNullOrEmpty(propertyName)) 47 | return; 48 | RaisePropertyChanged(propertyName); 49 | } 50 | 51 | protected static string GetPropertyName(Expression> propertyExpression) 52 | { 53 | if (propertyExpression == null) 54 | throw new ArgumentNullException(nameof(propertyExpression)); 55 | MemberExpression body = propertyExpression.Body as MemberExpression; 56 | if (body == null) 57 | throw new ArgumentException("Invalid argument", nameof(propertyExpression)); 58 | PropertyInfo member = body.Member as PropertyInfo; 59 | if (member == null) 60 | throw new ArgumentException("Argument is not a property", nameof(propertyExpression)); 61 | return member.Name; 62 | } 63 | 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/MatoMusic/App.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/MatoMusic/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Abp; 4 | using Abp.Castle.Logging.Log4Net; 5 | using Abp.Dependency; 6 | using Castle.Facilities.Logging; 7 | using MatoMusic.Core; 8 | using Microsoft.Maui; 9 | using Microsoft.Maui.Controls; 10 | using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific; 11 | using Application = Microsoft.Maui.Controls.Application; 12 | 13 | namespace MatoMusic 14 | { 15 | public partial class App : Application 16 | { 17 | private readonly AbpBootstrapper _abpBootstrapper; 18 | 19 | public App(AbpBootstrapper abpBootstrapper) 20 | { 21 | _abpBootstrapper = abpBootstrapper; 22 | InitializeComponent(); 23 | _abpBootstrapper.Initialize(); 24 | this.MainPage = abpBootstrapper.IocManager.Resolve(typeof(MainPage)) as MainPage; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MatoMusic/Common/CommonFunctionEventArgs.cs: -------------------------------------------------------------------------------- 1 |  2 | using MatoMusic.Infrastructure.Common; 3 | 4 | namespace MatoMusic.Common 5 | { 6 | public class CommonFunctionEventArgs 7 | { 8 | public CommonFunctionEventArgs(IBasicInfo info, string code) 9 | { 10 | Info = info; 11 | Code = code; 12 | } 13 | public IBasicInfo Info { get; set; } 14 | public string Code { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /src/MatoMusic/Common/ContentPageBase.cs: -------------------------------------------------------------------------------- 1 | using Abp; 2 | using Abp.Configuration; 3 | using Abp.Dependency; 4 | using Abp.Localization; 5 | using Abp.Localization.Sources; 6 | using Abp.ObjectMapping; 7 | using MatoMusic.Core; 8 | using MatoMusic.Core.Interfaces; 9 | using MatoMusic.Core.Services; 10 | using MatoMusic.Core.ViewModel; 11 | using MatoMusic.Services; 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Globalization; 15 | using System.Linq; 16 | using System.Text; 17 | using System.Threading.Tasks; 18 | 19 | namespace MatoMusic 20 | { 21 | public class ContentPageBase : ContentPage 22 | { 23 | 24 | public IMusicInfoManager MusicInfoManager => IocManager.Instance.Resolve(); 25 | 26 | public IMusicControlService MusicControlService => IocManager.Instance.Resolve(); 27 | 28 | public MusicRelatedService MusicRelatedService => IocManager.Instance.Resolve(); 29 | 30 | public IObjectMapper ObjectMapper { get; set; } 31 | 32 | public NavigationService navigationService { get; set; } 33 | 34 | 35 | /// 36 | /// Reference to the setting manager. 37 | /// 38 | public ISettingManager SettingManager { get; set; } 39 | 40 | 41 | /// 42 | /// Reference to the localization manager. 43 | /// 44 | public ILocalizationManager LocalizationManager { get; set; } 45 | 46 | /// 47 | /// Gets/sets name of the localization source that is used in this application service. 48 | /// It must be set in order to use and methods. 49 | /// 50 | protected string LocalizationSourceName { get; set; } 51 | 52 | /// 53 | /// Gets localization source. 54 | /// It's valid if is set. 55 | /// 56 | protected ILocalizationSource LocalizationSource 57 | { 58 | get 59 | { 60 | if (LocalizationSourceName == null) 61 | { 62 | throw new AbpException("Must set LocalizationSourceName before, in order to get LocalizationSource"); 63 | } 64 | 65 | if (_localizationSource == null || _localizationSource.Name != LocalizationSourceName) 66 | { 67 | _localizationSource = LocalizationManager.GetSource(LocalizationSourceName); 68 | } 69 | 70 | return _localizationSource; 71 | } 72 | } 73 | private ILocalizationSource _localizationSource; 74 | 75 | 76 | /// 77 | /// Constructor. 78 | /// 79 | protected ContentPageBase() 80 | { 81 | LocalizationSourceName = MatoMusicConsts.LocalizationSourceName; 82 | ObjectMapper = NullObjectMapper.Instance; 83 | LocalizationManager = NullLocalizationManager.Instance; 84 | } 85 | 86 | /// 87 | /// Gets localized string for given key name and current language. 88 | /// 89 | /// Key name 90 | /// Localized string 91 | protected virtual string L(string name) 92 | { 93 | return LocalizationSource.GetString(name); 94 | } 95 | 96 | /// 97 | /// Gets localized string for given key name and current language with formatting strings. 98 | /// 99 | /// Key name 100 | /// Format arguments 101 | /// Localized string 102 | protected virtual string L(string name, params object[] args) 103 | { 104 | return LocalizationSource.GetString(name, args); 105 | } 106 | 107 | /// 108 | /// Gets localized string for given key name and specified culture information. 109 | /// 110 | /// Key name 111 | /// culture information 112 | /// Localized string 113 | protected virtual string L(string name, CultureInfo culture) 114 | { 115 | return LocalizationSource.GetString(name, culture); 116 | } 117 | 118 | /// 119 | /// Gets localized string for given key name and current language with formatting strings. 120 | /// 121 | /// Key name 122 | /// culture information 123 | /// Format arguments 124 | /// Localized string 125 | protected virtual string L(string name, CultureInfo culture, params object[] args) 126 | { 127 | return LocalizationSource.GetString(name, culture, args); 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/MatoMusic/Common/MusicFunctionEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using MatoMusic.Core.Models; 7 | using MatoMusic.Infrastructure.Common; 8 | 9 | namespace MatoMusic.Common 10 | { 11 | public class MusicFunctionEventArgs : EventArgs 12 | { 13 | public MusicFunctionEventArgs(IBasicInfo musicInfo, MenuCellInfo menuCellInfo) 14 | { 15 | this.MusicInfo = musicInfo; 16 | this.MenuCellInfo = menuCellInfo; 17 | } 18 | public IBasicInfo MusicInfo { get; set; } 19 | public MenuCellInfo MenuCellInfo { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MatoMusic/Common/PopupBase.cs: -------------------------------------------------------------------------------- 1 | using Abp; 2 | using Abp.Configuration; 3 | using Abp.Localization; 4 | using Abp.Localization.Sources; 5 | using Abp.ObjectMapping; 6 | using CommunityToolkit.Maui.Views; 7 | using MatoMusic.Core; 8 | using MatoMusic.Core.Interfaces; 9 | using MatoMusic.Core.Services; 10 | using MatoMusic.Core.ViewModel; 11 | using MatoMusic.Services; 12 | using System; 13 | using System.Collections.Generic; 14 | using System.Globalization; 15 | using System.Linq; 16 | using System.Text; 17 | using System.Threading.Tasks; 18 | 19 | namespace MatoMusic 20 | { 21 | public class PopupBase : Popup 22 | { 23 | 24 | public NavigationService navigationService { get; set; } 25 | /// 26 | /// Reference to the setting manager. 27 | /// 28 | public ISettingManager SettingManager { get; set; } 29 | 30 | 31 | /// 32 | /// Reference to the localization manager. 33 | /// 34 | public ILocalizationManager LocalizationManager { get; set; } 35 | 36 | /// 37 | /// Gets/sets name of the localization source that is used in this application service. 38 | /// It must be set in order to use and methods. 39 | /// 40 | protected string LocalizationSourceName { get; set; } 41 | 42 | /// 43 | /// Gets localization source. 44 | /// It's valid if is set. 45 | /// 46 | protected ILocalizationSource LocalizationSource 47 | { 48 | get 49 | { 50 | if (LocalizationSourceName == null) 51 | { 52 | throw new AbpException("Must set LocalizationSourceName before, in order to get LocalizationSource"); 53 | } 54 | 55 | if (_localizationSource == null || _localizationSource.Name != LocalizationSourceName) 56 | { 57 | _localizationSource = LocalizationManager.GetSource(LocalizationSourceName); 58 | } 59 | 60 | return _localizationSource; 61 | } 62 | } 63 | private ILocalizationSource _localizationSource; 64 | public IObjectMapper ObjectMapper { get; set; } 65 | 66 | public PopupBase() 67 | { 68 | LocalizationSourceName = MatoMusicConsts.LocalizationSourceName; 69 | ObjectMapper = NullObjectMapper.Instance; 70 | LocalizationManager = NullLocalizationManager.Instance; 71 | } 72 | 73 | 74 | /// 75 | /// Gets localized string for given key name and current language. 76 | /// 77 | /// Key name 78 | /// Localized string 79 | protected virtual string L(string name) 80 | { 81 | return LocalizationSource.GetString(name); 82 | } 83 | 84 | /// 85 | /// Gets localized string for given key name and current language with formatting strings. 86 | /// 87 | /// Key name 88 | /// Format arguments 89 | /// Localized string 90 | protected virtual string L(string name, params object[] args) 91 | { 92 | return LocalizationSource.GetString(name, args); 93 | } 94 | 95 | /// 96 | /// Gets localized string for given key name and specified culture information. 97 | /// 98 | /// Key name 99 | /// culture information 100 | /// Localized string 101 | protected virtual string L(string name, CultureInfo culture) 102 | { 103 | return LocalizationSource.GetString(name, culture); 104 | } 105 | 106 | /// 107 | /// Gets localized string for given key name and current language with formatting strings. 108 | /// 109 | /// Key name 110 | /// culture information 111 | /// Format arguments 112 | /// Localized string 113 | protected virtual string L(string name, CultureInfo culture, params object[] args) 114 | { 115 | return LocalizationSource.GetString(name, culture, args); 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/MatoMusic/Common/PopupSize.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace MatoMusic 3 | { 4 | static class PopupSize 5 | { 6 | // examples for fixed sizes 7 | public static Size Tiny => new Size(100, 100); 8 | 9 | public static Size Small => new Size(300, 300); 10 | 11 | // examples for relative to screen sizes 12 | public static Size Medium => new Size(0.7 * (DeviceDisplay.MainDisplayInfo.Width / DeviceDisplay.MainDisplayInfo.Density), 0.6 * (DeviceDisplay.MainDisplayInfo.Height / DeviceDisplay.MainDisplayInfo.Density)); 13 | 14 | public static Size Large => new Size(0.9 * (DeviceDisplay.MainDisplayInfo.Width / DeviceDisplay.MainDisplayInfo.Density), 0.8 * (DeviceDisplay.MainDisplayInfo.Height / DeviceDisplay.MainDisplayInfo.Density)); 15 | } 16 | } -------------------------------------------------------------------------------- /src/MatoMusic/Controls/MenuCell.xaml: -------------------------------------------------------------------------------- 1 | 4 | 7 | 8 | 9 | 10 | 11 | 18 | 19 | 20 | 30 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/MatoMusic/Controls/MenuCell.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MatoMusic.Core.Models; 3 | using Microsoft.Maui.Controls; 4 | 5 | namespace MatoMusic 6 | { 7 | public partial class MenuCell : ViewCell 8 | { 9 | public MenuCell() 10 | { 11 | InitializeComponent(); 12 | } 13 | 14 | 15 | public static readonly BindableProperty ContentTextProperty = 16 | BindableProperty.Create(nameof(ContentText), 17 | typeof(string), typeof(MenuCell), 18 | string.Empty, propertyChanged: ContentTextPropertyChanged); 19 | 20 | private static void ContentTextPropertyChanged(BindableObject bindable, object oldValue, object newValue) 21 | { 22 | (bindable as MenuCell).LabelContentText.Text = newValue as string; 23 | } 24 | 25 | public string ContentText 26 | { 27 | get { return (string)GetValue(ContentTextProperty); } 28 | set { SetValue(ContentTextProperty, value); } 29 | } 30 | 31 | public static readonly BindableProperty IconTextProperty = 32 | BindableProperty.Create(nameof(IconText), 33 | typeof(string), typeof(MenuCell), 34 | string.Empty, propertyChanged: IconTextPropertyChanged); 35 | 36 | private static void IconTextPropertyChanged(BindableObject bindable, object oldValue, object newValue) 37 | { 38 | (bindable as MenuCell).LabelIconText.Text = newValue as string; 39 | } 40 | 41 | public string IconText 42 | { 43 | get { return (string)GetValue(IconTextProperty); } 44 | set { SetValue(IconTextProperty, value); } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/MatoMusic/Controls/MusicGroupHeaderView.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/MatoMusic/Controls/MusicGroupHeaderView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MatoMusic.Core.Models; 3 | using Microsoft.Maui.Controls; 4 | 5 | 6 | namespace MatoMusic 7 | { 8 | public partial class MusicGroupHeaderView: ContentView 9 | { 10 | public MusicGroupHeaderView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/MatoMusic/Controls/MusicMiniView.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 48 | 55 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 77 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /src/MatoMusic/Controls/MusicMiniView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.Dependency; 3 | using MatoMusic.Core.Helper; 4 | using MatoMusic.Core.Models; 5 | using MatoMusic.ViewModels; 6 | using Microsoft.Maui.Controls; 7 | 8 | 9 | namespace MatoMusic 10 | { 11 | public partial class MusicMiniView : ContentViewBase 12 | { 13 | public MusicMiniViewViewModel MusicMiniViewViewModel => IocManager.Instance.Resolve(); 14 | public MusicMiniView() 15 | { 16 | InitializeComponent(); 17 | BindingContext=this.MusicMiniViewViewModel; 18 | } 19 | 20 | private async void TapGestureRecognizer_OnTapped(object sender, EventArgs e) 21 | { 22 | var page = "NowPlayingPage"; 23 | var route = $"///{page}"; 24 | await Shell.Current.GoToAsync(route); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/MatoMusic/Controls/PlayingMotionView.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 25 | 26 | 27 | 35 | 36 | 37 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/MatoMusic/Converter/AlbumArtConverter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui.Controls; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace MatoMusic.Converter 10 | { 11 | public class AlbumArtConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | return (value as ImageSource) == null ? "albumart_placeholder.png" : value; 16 | } 17 | 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MatoMusic/Converter/Bool2StringConverter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui.Controls; 2 | using System; 3 | using System.Globalization; 4 | 5 | namespace MatoMusic.Converter 6 | { 7 | public class Bool2StringConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | try 12 | { 13 | if (string.IsNullOrEmpty((string)parameter)) 14 | { 15 | parameter = "是|否"; 16 | } 17 | var str1 = (parameter as string).Split('|')[0]; 18 | var str2 = (parameter as string).Split('|')[1]; 19 | 20 | if (value is bool) 21 | { 22 | return (bool)value ? str1 : str2; 23 | } 24 | else 25 | { 26 | string status = value.ToString().ToUpper(); 27 | if (status.Equals("TRUE")) 28 | { 29 | return str1; 30 | } 31 | else 32 | { 33 | return str2; 34 | } 35 | } 36 | } 37 | catch (Exception ex) 38 | { 39 | return string.Empty; 40 | } 41 | 42 | } 43 | 44 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 45 | { 46 | throw new NotImplementedException(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/MatoMusic/Converter/DecimalDigitVisibleConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Microsoft.Maui.Controls; 4 | 5 | namespace MatoMusic.Converter 6 | { 7 | internal class DecimalDigitVisibleConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | var decDigitLength = (int)value; 12 | var digitIndex = System.Convert.ToInt32(parameter); 13 | 14 | return digitIndex < decDigitLength; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/MatoMusic/Converter/IntegerDigitVisibleConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Microsoft.Maui.Controls; 4 | 5 | namespace MatoMusic.Converter 6 | { 7 | internal class IntegerDigitVisibleConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | var intDigitLength = (int)value; 12 | var digitIndex = System.Convert.ToInt32(parameter); 13 | 14 | return digitIndex < intDigitLength; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/MatoMusic/Converter/IsValid2BoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Microsoft.Maui.Controls; 9 | 10 | namespace MatoMusic.Converter 11 | { 12 | public class IsValid2BoolConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | var result = false; 17 | 18 | if (value != null) 19 | { 20 | if (value is string) 21 | { 22 | result = 23 | !string.IsNullOrEmpty(value as string); 24 | } 25 | else if (value is IList) 26 | { 27 | result = 28 | (value as IList).Count != 0; 29 | } 30 | else 31 | { 32 | result = true; 33 | } 34 | } 35 | else 36 | { 37 | result = false; 38 | } 39 | return !result; 40 | } 41 | 42 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 43 | { 44 | throw new NotImplementedException(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/MatoMusic/Converter/SecondsToTimeSpanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Microsoft.Maui.Controls; 4 | 5 | namespace MatoMusic.Converter 6 | { 7 | public class SecondsToTimeSpanConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | 12 | var time = new TimeSpan(); 13 | var result = string.Empty; 14 | var d = (double)value; 15 | if (d < 0) 16 | { 17 | return time.ToString(@"mm\:ss"); 18 | } 19 | time = TimeSpan.FromSeconds(d); 20 | result = time.ToString(time.TotalHours >= 1.0 ? @"hh\:mm\:ss" : @"mm\:ss"); 21 | return result; 22 | } 23 | 24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | TimeSpan ts = (TimeSpan)value; 27 | return ts.TotalSeconds; 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/MatoMusic/Converter/SliderMaxValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Microsoft.Maui.Controls; 4 | 5 | namespace MatoMusic.Converter 6 | { 7 | public class SliderMaxValueConverter : IValueConverter 8 | { 9 | public SliderMaxValueConverter() 10 | { 11 | } 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | var val = (double)value; 15 | if (val <= 0) 16 | { 17 | val = double.MaxValue; 18 | } 19 | return val; 20 | } 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | return !(bool)value; 24 | } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/MatoMusic/Converter/True2FalseConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Microsoft.Maui.Controls; 4 | 5 | namespace MatoMusic.Converter 6 | { 7 | public class True2FalseConverter : IValueConverter 8 | { 9 | public True2FalseConverter() 10 | { 11 | 12 | } 13 | 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | return !(bool)value; 17 | } 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | return !(bool)value; 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/MatoMusic/MatoMusic.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0-ios;net8.0-android34.0 5 | $(TargetFrameworks);net8.0-windows10.0.22621.0 6 | 7 | 8 | Exe 9 | MatoMusic 10 | true 11 | true 12 | enable 13 | 14 | 15 | MatoMusic 16 | 17 | 18 | com.companyname.matomusic 19 | d5fedd16-9c40-45f4-8fa0-92eba02d4d0a 20 | 21 | 22 | 1.0 23 | 1 24 | 25 | 14.2 26 | 14.0 27 | 21.0 28 | 10.0.17763.0 29 | 10.0.17763.0 30 | 6.5 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/MatoMusic/MatoMusicModule.cs: -------------------------------------------------------------------------------- 1 | using Abp.Modules; 2 | using Abp.Reflection.Extensions; 3 | using MatoMusic.Core; 4 | using MatoMusic.Core.Services; 5 | using MatoMusic.EntityFrameworkCore; 6 | using MatoMusic.ViewModels; 7 | 8 | namespace MatoMusic 9 | { 10 | [DependsOn( 11 | typeof(MatoMusicCoreModule), 12 | typeof(MatoMusicEntityFrameworkCoreModule))] 13 | public class MatoMusicModule : AbpModule 14 | { 15 | public override void Initialize() 16 | { 17 | IocManager.RegisterAssemblyByConvention(typeof(MatoMusicModule).GetAssembly()); 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/MatoMusic/MauiProgram.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui; 2 | using Microsoft.Maui.Hosting; 3 | using Microsoft.Maui.Controls.Compatibility; 4 | using Microsoft.Maui.Controls.Hosting; 5 | using MatoMusic.Core; 6 | using CommunityToolkit.Maui; 7 | 8 | namespace MatoMusic 9 | { 10 | public static class MauiProgram 11 | { 12 | public static MauiApp CreateMauiApp() 13 | { 14 | var builder = MauiApp.CreateBuilder(); 15 | builder 16 | .UseMatoMusic() 17 | .UseMauiApp() 18 | .UseMauiCommunityToolkit() 19 | .ConfigureFonts(fonts => 20 | { 21 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); 22 | fonts.AddFont("FontAwesome.ttf", "FontAwesome"); 23 | }); 24 | return builder.Build(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Content.PM; 3 | using Android.OS; 4 | using Android.Runtime; 5 | using Microsoft.Maui; 6 | 7 | namespace MatoMusic 8 | { 9 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)] 10 | public class MainActivity : MauiAppCompatActivity 11 | { 12 | public MainActivity() 13 | { 14 | AndroidEnvironment.UnhandledExceptionRaiser += UnhandledException; 15 | AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; 16 | } 17 | protected override void OnCreate(Bundle savedInstanceState) 18 | { 19 | base.OnCreate(savedInstanceState); 20 | Platform.Init(this, savedInstanceState); 21 | 22 | } 23 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults) 24 | { 25 | 26 | Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); 27 | 28 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 29 | } 30 | 31 | private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) 32 | { 33 | 34 | } 35 | 36 | private void UnhandledException(object sender, RaiseThrowableEventArgs e) 37 | { 38 | 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Android/MainApplication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.App; 3 | using Android.Runtime; 4 | using Microsoft.Maui; 5 | using Microsoft.Maui.Hosting; 6 | 7 | namespace MatoMusic 8 | { 9 | [Application] 10 | public class MainApplication : MauiApplication 11 | { 12 | public MainApplication(IntPtr handle, JniHandleOwnership ownership) 13 | : base(handle, ownership) 14 | { 15 | } 16 | 17 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #512BD4 4 | #2B0B98 5 | #2B0B98 6 | -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/MacCatalyst/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | using Microsoft.Maui; 3 | using Microsoft.Maui.Hosting; 4 | 5 | namespace MatoMusic.Platforms.MacCatalyst 6 | { 7 | [Register("AppDelegate")] 8 | public class AppDelegate : MauiUIApplicationDelegate 9 | { 10 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 11 | } 12 | } -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/MacCatalyst/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UIRequiredDeviceCapabilities 11 | 12 | arm64 13 | 14 | UISupportedInterfaceOrientations 15 | 16 | UIInterfaceOrientationPortrait 17 | UIInterfaceOrientationLandscapeLeft 18 | UIInterfaceOrientationLandscapeRight 19 | 20 | UISupportedInterfaceOrientations~ipad 21 | 22 | UIInterfaceOrientationPortrait 23 | UIInterfaceOrientationPortraitUpsideDown 24 | UIInterfaceOrientationLandscapeLeft 25 | UIInterfaceOrientationLandscapeRight 26 | 27 | XSAppIconAssets 28 | Assets.xcassets/appicon.appiconset 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/MacCatalyst/Program.cs: -------------------------------------------------------------------------------- 1 | using UIKit; 2 | 3 | namespace MatoMusic.Platforms.MacCatalyst 4 | { 5 | public class Program 6 | { 7 | // This is the main entry point of the application. 8 | static void Main(string[] args) 9 | { 10 | // if you want to use a different Application Delegate class from "AppDelegate" 11 | // you can specify it here. 12 | UIApplication.Main(args, null, typeof(AppDelegate)); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui; 2 | using Microsoft.Maui.Hosting; 3 | using Microsoft.UI.Xaml; 4 | using Windows.ApplicationModel; 5 | 6 | // To learn more about WinUI, the WinUI project structure, 7 | // and more about our project templates, see: http://aka.ms/winui-project-info. 8 | 9 | namespace MatoMusic.WinUI 10 | { 11 | /// 12 | /// Provides application-specific behavior to supplement the default Application class. 13 | /// 14 | public partial class App : MauiWinUIApplication 15 | { 16 | /// 17 | /// Initializes the singleton application object. This is the first line of authored code 18 | /// executed, and as such is the logical equivalent of main() or WinMain(). 19 | /// 20 | public App() 21 | { 22 | this.InitializeComponent(); 23 | } 24 | 25 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 26 | 27 | protected override void OnLaunched(LaunchActivatedEventArgs args) 28 | { 29 | base.OnLaunched(args); 30 | 31 | Platform.OnLaunched(args); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Platforms/Windows/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/Assets/SplashScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Platforms/Windows/Assets/SplashScreen.png -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Platforms/Windows/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Platforms/Windows/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Platforms/Windows/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Platforms/Windows/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Platforms/Windows/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Platforms/Windows/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | MatoMusic 16 | Microsoft 17 | Assets\appiconStoreLogo.png 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 39 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/Windows/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | true/PM 12 | PerMonitorV2, PerMonitor 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | using Microsoft.Maui; 3 | using Microsoft.Maui.Hosting; 4 | 5 | namespace MatoMusic 6 | { 7 | [Register("AppDelegate")] 8 | public class AppDelegate : MauiUIApplicationDelegate 9 | { 10 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 11 | } 12 | } -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSRequiresIPhoneOS 6 | 7 | UIDeviceFamily 8 | 9 | 1 10 | 2 11 | 12 | UIRequiredDeviceCapabilities 13 | 14 | arm64 15 | 16 | UISupportedInterfaceOrientations 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationLandscapeLeft 20 | UIInterfaceOrientationLandscapeRight 21 | 22 | UISupportedInterfaceOrientations~ipad 23 | 24 | UIInterfaceOrientationPortrait 25 | UIInterfaceOrientationPortraitUpsideDown 26 | UIInterfaceOrientationLandscapeLeft 27 | UIInterfaceOrientationLandscapeRight 28 | 29 | XSAppIconAssets 30 | Assets.xcassets/appicon.appiconset 31 | MinimumOSVersion 32 | 14.2 33 | CFBundleIdentifier 34 | com.Mato.MatoPlayer 35 | UILaunchStoryboardName 36 | LaunchScreen 37 | CFBundleShortVersionString 38 | 2.0 39 | UIBackgroundModes 40 | 41 | audio 42 | 43 | UIMainStoryboardFile 44 | LaunchScreen 45 | NSAppleMusicUsageDescription 46 | 允许这一操作将让你播放Apple Music中的所有音乐,获取音乐专辑封面等内容。 47 | UIStatusBarStyle 48 | UIStatusBarStyleLightContent 49 | UIViewControllerBasedStatusBarAppearance 50 | 51 | 52 | XSLaunchImageAssets 53 | Assets.xcassets/LaunchImage.launchimage 54 | CFBundleExecutable 55 | 56 | CFBundleVersion 57 | 130 58 | CFBundleName 59 | 番茄播放器 60 | CFBundleDevelopmentRegion 61 | zh_CN 62 | CFBundleLocalizations 63 | 64 | zh_CN 65 | zh_TW 66 | en 67 | 68 | UIAppFonts 69 | 70 | FontAwesome.ttf 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/iOS/Program.cs: -------------------------------------------------------------------------------- 1 | using UIKit; 2 | 3 | namespace MatoMusic { 4 | public class Program 5 | { 6 | // This is the main entry point of the application. 7 | static void Main(string[] args) 8 | { 9 | // if you want to use a different Application Delegate class from "AppDelegate" 10 | // you can specify it here. 11 | UIApplication.Main(args, null, typeof(AppDelegate)); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/MatoMusic/Platforms/iOS/Resources/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/MatoMusic/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Windows Machine": { 4 | "commandName": "MsixPackage", 5 | "nativeDebugging": false 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/MatoMusic/Resources/AppIcon/appicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/MatoMusic/Resources/AppIcon/appiconfg.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Fonts/FontAwesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Resources/Fonts/FontAwesome.ttf -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Resources/Fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Fonts/OpenSans-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Resources/Fonts/OpenSans-Semibold.ttf -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Fonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Resources/Fonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Images/albumart_placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Resources/Images/albumart_placeholder.png -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Images/cd2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Resources/Images/cd2.png -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Images/headphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Resources/Images/headphone.png -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Images/microphone2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jevonsflash/MatoMusic/14a4f42a793ba75b839c88cfe103c228cb458d9a/src/MatoMusic/Resources/Images/microphone2.png -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Raw/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories). Deployment of the asset to your application 3 | is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. 4 | 5 | 6 | 7 | These files will be deployed with you package and will be accessible using Essentials: 8 | 9 | async Task LoadMauiAsset() 10 | { 11 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); 12 | using var reader = new StreamReader(stream); 13 | 14 | var contents = reader.ReadToEnd(); 15 | } 16 | -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Splash/splash.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/MatoMusic/Resources/Styles/Colors.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | 7 | #512BD4 8 | #DFD8F7 9 | #2B0B98 10 | White 11 | Black 12 | #E1E1E1 13 | #C8C8C8 14 | #ACACAC 15 | #919191 16 | #6E6E6E 17 | #404040 18 | #212121 19 | #141414 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | #F7B548 35 | #FFD590 36 | #FFE5B9 37 | #28C2D1 38 | #7BDDEF 39 | #C3F2F4 40 | #3E8EED 41 | #72ACF1 42 | #A7CBF6 43 | 44 | -------------------------------------------------------------------------------- /src/MatoMusic/Services/NavigationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Abp; 8 | using Abp.Dependency; 9 | using Abp.Domain.Services; 10 | using Castle.MicroKernel; 11 | using CommunityToolkit.Maui.Views; 12 | using MatoMusic.Core; 13 | using Microsoft.Maui.Controls; 14 | 15 | namespace MatoMusic.Services 16 | { 17 | public class NavigationService : AbpServiceBase, ISingletonDependency 18 | { 19 | private readonly IIocManager iocManager; 20 | 21 | private INavigation mainPageNavigation => mainShell.Navigation; 22 | private Shell mainShell => Shell.Current; 23 | 24 | public NavigationService( 25 | IIocManager iocManager 26 | ) 27 | { 28 | this.iocManager = iocManager; 29 | LocalizationSourceName = MatoMusicConsts.LocalizationSourceName; 30 | 31 | } 32 | 33 | public async Task PushAsync(string pageName, object[] args = null) 34 | { 35 | var page = GetPageInstance(pageName, args); 36 | await mainPageNavigation.PushAsync(page); 37 | } 38 | 39 | public async Task PushModalAsync(string pageName, object[] args = null) 40 | { 41 | var page = GetPageInstance(pageName, args); 42 | await mainPageNavigation.PushModalAsync(page); 43 | } 44 | 45 | public async Task PushAsync(Page page) 46 | { 47 | await mainPageNavigation.PushAsync(page); 48 | } 49 | 50 | public async Task PushModalAsync(Page page) 51 | { 52 | await mainPageNavigation.PushModalAsync(page); 53 | } 54 | 55 | public async Task PopAsync() 56 | { 57 | await mainPageNavigation.PopAsync(); 58 | } 59 | 60 | public async Task PopToRootAsync() 61 | { 62 | await mainPageNavigation.PopToRootAsync(); 63 | } 64 | 65 | 66 | public async Task GoPageAsync(string obj) 67 | { 68 | var route = $"///{obj}"; 69 | await mainShell.GoToAsync(route); 70 | } 71 | 72 | public async Task ShowPopupAsync(Popup popupPage) 73 | { 74 | await Shell.Current.CurrentPage.ShowPopupAsync(popupPage); 75 | } 76 | public async Task HidePopupAsync(Popup popupPage) 77 | { 78 | popupPage.Close(); 79 | } 80 | private Page GetPageInstance(string obj, object[] args, IList barItem = null) 81 | { 82 | Page result = null; 83 | var namespacestr = "MatoMusic"; 84 | Type pageType = Type.GetType(namespacestr + "." + obj, false); 85 | if (pageType != null) 86 | { 87 | try 88 | { 89 | var ctorInfo = pageType.GetConstructors() 90 | .Select(m => new 91 | { 92 | Method = m, 93 | Params = m.GetParameters(), 94 | }).Where(c => c.Params.Length == args.Length) 95 | .FirstOrDefault(); 96 | if (ctorInfo==null) 97 | { 98 | throw new Exception("找不到对应的构造函数"); 99 | } 100 | 101 | var argsDict = new Arguments(); 102 | 103 | for (int i = 0; i < ctorInfo.Params.Length; i++) 104 | { 105 | var arg = ctorInfo.Params[i]; 106 | argsDict.Add(arg.Name, args[i]); 107 | } 108 | 109 | var pageObj = iocManager.IocContainer.Resolve(pageType, argsDict) as Page; 110 | 111 | if (barItem != null && barItem.Count > 0) 112 | { 113 | foreach (var toolbarItem in barItem) 114 | { 115 | pageObj.ToolbarItems.Add(toolbarItem); 116 | } 117 | } 118 | result = pageObj; 119 | } 120 | catch (Exception e) 121 | { 122 | Debug.WriteLine(e.Message); 123 | } 124 | } 125 | return result; 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/MatoMusic/Styles/CommonResourceDictionary.xaml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 2.0 9 | 10 10 | 28 11 | 22 12 | 18 13 | 14 | 18 | 19 | 28 | 37 | 38 | 46 | 47 | 57 | 58 | 66 | 67 | 71 | 72 | 77 | 78 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/MatoMusic/Styles/CommonResourceDictionary.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace MatoMusic.Styles; 2 | 3 | public partial class CommonResourceDictionary : ResourceDictionary 4 | { 5 | public CommonResourceDictionary() 6 | { 7 | InitializeComponent(); 8 | } 9 | } -------------------------------------------------------------------------------- /src/MatoMusic/Styles/DarkTheme.xaml: -------------------------------------------------------------------------------- 1 | 2 | 7 | #181818 8 | White 9 | #222326 10 | #DFD8F7 11 | Teal 12 | #A5A5A5 13 | #FFFFFF 14 | #000000 15 | 16 | -------------------------------------------------------------------------------- /src/MatoMusic/Styles/DarkTheme.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace MatoMusic.Styles; 2 | 3 | public partial class DarkTheme : ResourceDictionary 4 | { 5 | public DarkTheme() 6 | { 7 | InitializeComponent(); 8 | } 9 | } -------------------------------------------------------------------------------- /src/MatoMusic/Styles/LightTheme.xaml: -------------------------------------------------------------------------------- 1 | 2 | 7 | White 8 | #181818 9 | #DFD8F7 10 | #828386 11 | Teal 12 | #A5A5A5 13 | #FFFFFF 14 | #000000 15 | 16 | -------------------------------------------------------------------------------- /src/MatoMusic/Styles/LightTheme.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace MatoMusic.Styles; 2 | 3 | public partial class LightTheme : ResourceDictionary 4 | { 5 | public LightTheme() 6 | { 7 | InitializeComponent(); 8 | } 9 | } -------------------------------------------------------------------------------- /src/MatoMusic/ViewModels/MusicCollectionPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using MatoMusic.Core; 8 | using MatoMusic.Core.Models; 9 | using MatoMusic.Core.ViewModel; 10 | 11 | 12 | namespace MatoMusic.ViewModel 13 | { 14 | public class MusicCollectionPageViewModel : ViewModelBase 15 | { 16 | //private OnlineMusicManager _onlineMusicManager; 17 | 18 | public MusicCollectionPageViewModel(MusicCollectionInfo musicsCollectionInfo) 19 | { 20 | Init(musicsCollectionInfo); 21 | } 22 | 23 | public MusicCollectionPageViewModel(MusicCollectionInfo musicsCollectionInfo, List menus) 24 | { 25 | Init(musicsCollectionInfo, menus); 26 | } 27 | 28 | private async void Init(MusicCollectionInfo musicsCollectionInfo, List menus = null) 29 | { 30 | this.MusicsCollectionInfo = musicsCollectionInfo; 31 | this.MusicCollectionArtPath = musicsCollectionInfo?.AlbumArtPath; 32 | 33 | if (menus != null) 34 | { 35 | Menus = menus; 36 | 37 | } 38 | else 39 | { 40 | Menus = new List() 41 | { 42 | 43 | new MenuCellInfo() {Title = L("Play"), Code = "Play", Icon = ""}, 44 | new MenuCellInfo() {Title = L("AddToQueue2"), Code = "AddMusicCollectionToQueue", Icon = ""}, 45 | new MenuCellInfo() {Title = L("AddTo"), Code = "AddMusicCollectionToPlaylist", Icon = ""}, 46 | }; 47 | } 48 | } 49 | 50 | private MusicCollectionInfo _musicsCollectionInfo; 51 | public MusicCollectionInfo MusicsCollectionInfo 52 | { 53 | get { return _musicsCollectionInfo; } 54 | set 55 | { 56 | _musicsCollectionInfo = value; 57 | base.RaisePropertyChanged(); 58 | } 59 | } 60 | 61 | private List _menus; 62 | 63 | public List Menus 64 | { 65 | get { return _menus; } 66 | set 67 | { 68 | _menus = value; 69 | RaisePropertyChanged(); 70 | } 71 | } 72 | 73 | private string _musicCollectionArtPath; 74 | 75 | public string MusicCollectionArtPath 76 | { 77 | get { return _musicCollectionArtPath; } 78 | set 79 | { 80 | _musicCollectionArtPath = value; 81 | RaisePropertyChanged(); 82 | } 83 | } 84 | 85 | 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/MatoMusic/ViewModels/MusicFunctionPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Abp.Dependency; 8 | using MatoMusic.Core; 9 | using MatoMusic.Core.Helper; 10 | using MatoMusic.Core.Models; 11 | using MatoMusic.Core.ViewModel; 12 | using MatoMusic.Infrastructure.Common; 13 | using Microsoft.Maui.Controls; 14 | 15 | namespace MatoMusic.ViewModels 16 | { 17 | public class MusicFunctionPageViewModel : ViewModelBase 18 | { 19 | public MusicFunctionPageViewModel(IBasicInfo musicInfo, IList mainMenuCellInfos) 20 | { 21 | this.CurrentInfo = musicInfo; 22 | this.MainMenuCellInfos = mainMenuCellInfos; 23 | this.PropertyChanged += MusicFunctionPageViewModel_PropertyChanged; 24 | this.FavouriteCommand = new Command(FavouriteAction,CanFavouriteAction); 25 | } 26 | 27 | private bool CanFavouriteAction(object obj) 28 | { 29 | return CurrentInfo is MusicInfo; 30 | } 31 | 32 | private void FavouriteAction(object obj) 33 | { 34 | var musicInfo = CurrentInfo as MusicInfo; 35 | if (musicInfo != null) 36 | { 37 | musicInfo.IsFavourite = !musicInfo.IsFavourite; 38 | if (musicInfo.IsFavourite) 39 | { 40 | CommonHelper.ShowMsg("我最喜爱"); 41 | 42 | } 43 | } 44 | } 45 | 46 | private void MusicFunctionPageViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) 47 | { 48 | if (e.PropertyName == nameof(CurrentMenuCellInfo)) 49 | { 50 | // 51 | } 52 | } 53 | 54 | private IBasicInfo _musicInfo; 55 | public IBasicInfo CurrentInfo 56 | { 57 | get { return _musicInfo; } 58 | set 59 | { 60 | _musicInfo = value; 61 | base.RaisePropertyChanged(); 62 | } 63 | } 64 | 65 | 66 | private IList _mainMenuCellInfos; 67 | 68 | public IList MainMenuCellInfos 69 | { 70 | get 71 | { 72 | if (_mainMenuCellInfos == null) 73 | { 74 | _mainMenuCellInfos = new List(); 75 | } 76 | return _mainMenuCellInfos; 77 | } 78 | set 79 | { 80 | _mainMenuCellInfos = value; 81 | base.RaisePropertyChanged(); 82 | 83 | 84 | } 85 | } 86 | 87 | private MenuCellInfo _currentMenuCellInfo; 88 | 89 | public MenuCellInfo CurrentMenuCellInfo 90 | { 91 | get 92 | { 93 | if (_currentMenuCellInfo == null) 94 | { 95 | //_currentMenuCellInfo = MainMenuCellInfos[1]; 96 | } 97 | return _currentMenuCellInfo; 98 | } 99 | set 100 | { 101 | _currentMenuCellInfo = value; 102 | base.RaisePropertyChanged(); 103 | } 104 | } 105 | public Command FavouriteCommand { get; set; } 106 | 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/MatoMusic/ViewModels/MusicMiniViewViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using System.ComponentModel; 4 | using Microsoft.Maui.Controls; 5 | using MatoMusic.Core; 6 | using MatoMusic.Infrastructure; 7 | using MatoMusic.Core.Models; 8 | using MatoMusic.Core.ViewModel; 9 | using MatoMusic.Core.Helper; 10 | using Abp.Dependency; 11 | using MatoMusic.Core.Services; 12 | using MatoMusic.Core.Interfaces; 13 | 14 | namespace MatoMusic.ViewModels 15 | { 16 | public class MusicMiniViewViewModel : MusicRelatedViewModel 17 | { 18 | public MusicMiniViewViewModel() 19 | { 20 | } 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/MatoMusic/ViewModels/NowPlayingPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.Dependency; 3 | using MatoMusic.Core.Helper; 4 | using MatoMusic.Core.Interfaces; 5 | using MatoMusic.Core.Services; 6 | using MatoMusic.Core.ViewModel; 7 | using Microsoft.Maui.Controls; 8 | 9 | namespace MatoMusic.ViewModels 10 | { 11 | public class NowPlayingPageViewModel : MusicRelatedViewModel 12 | { 13 | 14 | private readonly IocManager iocManager; 15 | public NowPlayingPageViewModel(IocManager iocManager) 16 | { 17 | SwitchPannelCommand = new Command(SwitchPannelAction, c => true); 18 | PlayAllCommand = new Command(PlayAllAction, c => true); 19 | IsLrcPanel = false; 20 | this.iocManager=iocManager; 21 | } 22 | 23 | 24 | private void SwitchPannelAction(object obj) 25 | { 26 | IsLrcPanel = !IsLrcPanel; 27 | } 28 | 29 | 30 | 31 | private bool _isLrcPanel; 32 | 33 | public bool IsLrcPanel 34 | { 35 | get { return _isLrcPanel; } 36 | set 37 | { 38 | if (_isLrcPanel != value) 39 | { 40 | _isLrcPanel = value; 41 | RaisePropertyChanged(); 42 | 43 | 44 | } 45 | } 46 | } 47 | 48 | 49 | private void PlayAllAction(object obj) 50 | { 51 | iocManager.Resolve().PlayAllCommand.Execute(obj); 52 | } 53 | 54 | public Command SwitchPannelCommand { get; set; } 55 | public Command PlayAllCommand { get; private set; } 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/MatoMusic/ViewModels/PlaylistEntryPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.Specialized; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Collections.ObjectModel; 9 | using MatoMusic.Core; 10 | using MatoMusic.Core.Models; 11 | using MatoMusic.Core.Models.Entities; 12 | using Abp.Dependency; 13 | using MatoMusic.Core.Interfaces; 14 | 15 | namespace MatoMusic.ViewModel 16 | { 17 | public class PlaylistEntryPageViewModel : MusicCollectionPageViewModel, ITransientDependency 18 | { 19 | public PlaylistEntryPageViewModel(PlaylistInfo playlist) : base(playlist) 20 | { 21 | MusicsCollectionInfo = playlist; 22 | Init(); 23 | 24 | } 25 | public PlaylistEntryPageViewModel(PlaylistInfo playlist, List menus) : base(playlist, menus) 26 | { 27 | MusicsCollectionInfo = playlist; 28 | Init(); 29 | } 30 | public async void Init() 31 | { 32 | 33 | var musics = await MusicInfoManager.GetPlaylistEntry(MusicsCollectionInfo.Id); 34 | MusicsCollectionInfo.Musics=new ObservableCollection(musics); 35 | MusicsCollectionInfo.Musics.CollectionChanged += Musics_CollectionChanged; 36 | this.PropertyChanged += PlaylistEntryPageViewModel_PropertyChanged; 37 | } 38 | 39 | private async void PlaylistEntryPageViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) 40 | { 41 | if (e.PropertyName == nameof(MusicsCollectionInfo)) 42 | { 43 | var model = this.MusicsCollectionInfo as PlaylistInfo; 44 | var entity = ObjectMapper.Map(model); 45 | await MusicInfoManager.UpdatePlaylist(entity); 46 | 47 | } 48 | } 49 | 50 | public void DeleteAction(object obj) 51 | { 52 | var musicInfo = obj as MusicInfo; 53 | this.MusicsCollectionInfo.Musics.Remove(musicInfo); 54 | } 55 | 56 | private void Musics_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) 57 | { 58 | if (e.Action == NotifyCollectionChangedAction.Move) 59 | { 60 | var oldIndex = e.OldStartingIndex; 61 | var newIndex = e.NewStartingIndex; 62 | MusicInfoManager.ReorderPlaylist(MusicsCollectionInfo.Musics[oldIndex], MusicsCollectionInfo.Musics[newIndex], MusicsCollectionInfo.Id); 63 | } 64 | else if (e.Action == NotifyCollectionChangedAction.Remove) 65 | { 66 | MusicInfoManager.DeletePlaylistEntry(e.OldItems[0] as MusicInfo, MusicsCollectionInfo.Id); 67 | } 68 | 69 | 70 | } 71 | 72 | public IMusicInfoManager MusicInfoManager => IocManager.Instance.Resolve(); 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/MatoMusic/ViewModels/PlaylistFunctionPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Abp.Dependency; 7 | using MatoMusic.Common; 8 | using MatoMusic.Core.Helper; 9 | using MatoMusic.Core.Models; 10 | using MatoMusic.Core.ViewModel; 11 | 12 | namespace MatoMusic.ViewModel 13 | { 14 | public class PlaylistFunctionPageViewModel: ViewModelBase 15 | { 16 | public PlaylistFunctionPageViewModel() 17 | { 18 | this.SubmitCommand = new Command(new Action(SubmitAction)); 19 | this.PlaylistInfo = new PlaylistInfo() { IsHidden = false, IsRemovable = true, Title = L("NewPlaylist") }; 20 | } 21 | 22 | public PlaylistFunctionPageViewModel(PlaylistInfo playlistInfo) 23 | { 24 | this.SubmitCommand = new Command(new Action(SubmitAction)); 25 | this.PlaylistInfo = playlistInfo; 26 | } 27 | private PlaylistInfo _playlistInfo; 28 | public PlaylistInfo PlaylistInfo 29 | { 30 | get { return _playlistInfo; } 31 | set 32 | { 33 | _playlistInfo = value; 34 | base.RaisePropertyChanged(); 35 | } 36 | } 37 | private void SubmitAction(object obj) 38 | { 39 | //MusicInfoServer.Current.CreatePlaylist(PlaylistInfo); 40 | } 41 | 42 | public Command SubmitCommand { get; set; } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/LibraryPages/AlbumPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using Abp.Dependency; 5 | using Abp.Localization; 6 | using MatoMusic.Common; 7 | using MatoMusic.Core; 8 | using MatoMusic.Core.Helper; 9 | using MatoMusic.Core.Models; 10 | using MatoMusic.Infrastructure.Common; 11 | using MatoMusic.Services; 12 | using MatoMusic.ViewModels; 13 | using Microsoft.Maui.Controls; 14 | 15 | 16 | namespace MatoMusic 17 | { 18 | 19 | public partial class AlbumPage : ContentPageBase, ITransientDependency 20 | { 21 | private readonly MusicFunctionManager musicFunctionManager; 22 | 23 | 24 | public AlbumPage(LibraryPageViewModel libraryPageViewModel, 25 | MusicFunctionManager musicFunctionManager) 26 | { 27 | this.musicFunctionManager = musicFunctionManager; 28 | InitializeComponent(); 29 | this.BindingContext = libraryPageViewModel; 30 | } 31 | 32 | protected override async void OnAppearing() 33 | { 34 | base.OnAppearing(); 35 | await (this.BindingContext as LibraryPageViewModel).Init(); 36 | } 37 | 38 | 39 | private async void ListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 40 | { 41 | if (e.SelectedItem is ArtistInfo) 42 | { 43 | var artistInfo = e.SelectedItem as ArtistInfo; 44 | await navigationService.PushAsync("MusicCollectionPage", new object[] { artistInfo }); 45 | 46 | } 47 | else if (e.SelectedItem is AlbumInfo) 48 | { 49 | var albumInfo = e.SelectedItem as AlbumInfo; 50 | await navigationService.PushAsync("MusicCollectionPage", new object[] { albumInfo }); 51 | } 52 | (sender as ListView).SelectedItem = null; 53 | } 54 | 55 | private void MusicListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 56 | { 57 | var musicInfo = e.SelectedItem as MusicInfo; 58 | if (musicInfo != null) 59 | { 60 | (this.BindingContext as LibraryPageViewModel).ChangeMusic(musicInfo); 61 | } 62 | } 63 | 64 | 65 | private void _musicFunctionPage_OnFinished(object sender, MusicFunctionEventArgs e) 66 | { 67 | musicFunctionManager.OnMusicFunctionFinished(e); 68 | } 69 | 70 | private async void AlbumMoreButton_OnClicked(object sender, EventArgs e) 71 | { 72 | 73 | var _mainMenuCellInfos = new List() 74 | { 75 | 76 | new MenuCellInfo() {Title = string.Format("{0}{1}",L("PlayThis"),L("Albums")), Code = "Play", Icon = ""}, 77 | new MenuCellInfo() {Title = L("AddToQueue2"), Code = "AddMusicCollectionToQueue", Icon = ""}, 78 | new MenuCellInfo() {Title = L("AddTo"), Code = "AddMusicCollectionToPlaylist", Icon = ""}, 79 | new MenuCellInfo() {Title = L("AddToFavourite"), Code = "AddToFavourite", Icon = ""} 80 | 81 | }; 82 | var musicInfo = (sender as BindableObject).BindingContext; 83 | 84 | var _musicFunctionPage = new MusicFunctionPage(musicInfo as IBasicInfo, _mainMenuCellInfos); 85 | _musicFunctionPage.OnFinished += _musicFunctionPage_OnFinished; 86 | 87 | await navigationService.ShowPopupAsync(_musicFunctionPage); 88 | 89 | } 90 | 91 | 92 | private async void SearchButton_OnClicked(object sender, EventArgs e) 93 | { 94 | //await navigationService.GoPageAsync("SearchPage"); 95 | } 96 | 97 | } 98 | 99 | } 100 | 101 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/LibraryPages/ArtistPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using Abp.Dependency; 5 | using Abp.Localization; 6 | using MatoMusic.Common; 7 | using MatoMusic.Core; 8 | using MatoMusic.Core.Helper; 9 | using MatoMusic.Core.Models; 10 | using MatoMusic.Infrastructure.Common; 11 | using MatoMusic.Services; 12 | using MatoMusic.ViewModels; 13 | using Microsoft.Maui.Controls; 14 | 15 | 16 | namespace MatoMusic 17 | { 18 | 19 | public partial class ArtistPage : ContentPageBase, ITransientDependency 20 | { 21 | private readonly MusicFunctionManager musicFunctionManager; 22 | 23 | 24 | public ArtistPage(LibraryPageViewModel libraryPageViewModel, 25 | MusicFunctionManager musicFunctionManager) 26 | { 27 | this.musicFunctionManager = musicFunctionManager; 28 | InitializeComponent(); 29 | this.BindingContext = libraryPageViewModel; 30 | } 31 | 32 | protected override async void OnAppearing() 33 | { 34 | base.OnAppearing(); 35 | await (this.BindingContext as LibraryPageViewModel).Init(); 36 | } 37 | 38 | 39 | private async void ListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 40 | { 41 | if (e.SelectedItem is ArtistInfo) 42 | { 43 | var artistInfo = e.SelectedItem as ArtistInfo; 44 | await navigationService.PushAsync("MusicCollectionPage", new object[] { artistInfo }); 45 | 46 | } 47 | else if (e.SelectedItem is AlbumInfo) 48 | { 49 | var albumInfo = e.SelectedItem as AlbumInfo; 50 | await navigationService.PushAsync("MusicCollectionPage", new object[] { albumInfo }); 51 | } 52 | (sender as ListView).SelectedItem = null; 53 | } 54 | 55 | private void MusicListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 56 | { 57 | var musicInfo = e.SelectedItem as MusicInfo; 58 | if (musicInfo != null) 59 | { 60 | (this.BindingContext as LibraryPageViewModel).ChangeMusic(musicInfo); 61 | } 62 | } 63 | 64 | private void _musicFunctionPage_OnFinished(object sender, MusicFunctionEventArgs e) 65 | { 66 | musicFunctionManager.OnMusicFunctionFinished(e); 67 | } 68 | 69 | private async void ArtistMoreButton_OnClicked(object sender, EventArgs e) 70 | { 71 | var _mainMenuCellInfos = new List() 72 | { 73 | 74 | new MenuCellInfo() {Title = string.Format("{0}{1}",L("PlayThis"),L("Artists")), Code = "Play", Icon = ""}, 75 | new MenuCellInfo() {Title = L("AddToQueue2"), Code = "AddMusicCollectionToQueue", Icon = ""}, 76 | new MenuCellInfo() {Title = L("AddTo"), Code = "AddMusicCollectionToPlaylist", Icon = ""}, 77 | new MenuCellInfo() {Title = L("AddToFavourite"), Code = "AddToFavourite", Icon = ""} 78 | 79 | }; 80 | var musicInfo = (sender as BindableObject).BindingContext; 81 | 82 | var _musicFunctionPage = new MusicFunctionPage(musicInfo as IBasicInfo, _mainMenuCellInfos); 83 | _musicFunctionPage.OnFinished += _musicFunctionPage_OnFinished; 84 | 85 | await navigationService.ShowPopupAsync(_musicFunctionPage); 86 | } 87 | 88 | private async void SearchButton_OnClicked(object sender, EventArgs e) 89 | { 90 | //await navigationService.GoPageAsync("SearchPage"); 91 | } 92 | 93 | } 94 | 95 | } 96 | 97 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/LibraryPages/MusicPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using Abp.Dependency; 5 | using Abp.Localization; 6 | using MatoMusic.Common; 7 | using MatoMusic.Core; 8 | using MatoMusic.Core.Helper; 9 | using MatoMusic.Core.Models; 10 | using MatoMusic.Infrastructure.Common; 11 | using MatoMusic.Services; 12 | using MatoMusic.ViewModels; 13 | using Microsoft.Maui.Controls; 14 | 15 | 16 | namespace MatoMusic 17 | { 18 | 19 | public partial class MusicPage : ContentPageBase, ITransientDependency 20 | { 21 | private readonly MusicFunctionManager musicFunctionManager; 22 | 23 | 24 | public MusicPage(LibraryPageViewModel libraryPageViewModel, 25 | MusicFunctionManager musicFunctionManager) 26 | { 27 | this.musicFunctionManager = musicFunctionManager; 28 | InitializeComponent(); 29 | this.BindingContext = libraryPageViewModel; 30 | } 31 | 32 | protected override async void OnAppearing() 33 | { 34 | base.OnAppearing(); 35 | await (this.BindingContext as LibraryPageViewModel).Init(); 36 | } 37 | 38 | 39 | private async void ListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 40 | { 41 | if (e.SelectedItem is ArtistInfo) 42 | { 43 | var artistInfo = e.SelectedItem as ArtistInfo; 44 | await navigationService.PushAsync("MusicCollectionPage", new object[] { artistInfo }); 45 | 46 | } 47 | else if (e.SelectedItem is AlbumInfo) 48 | { 49 | var albumInfo = e.SelectedItem as AlbumInfo; 50 | await navigationService.PushAsync("MusicCollectionPage", new object[] { albumInfo }); 51 | } 52 | (sender as ListView).SelectedItem = null; 53 | } 54 | 55 | private void MusicListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 56 | { 57 | var musicInfo = e.SelectedItem as MusicInfo; 58 | if (musicInfo != null) 59 | { 60 | (this.BindingContext as LibraryPageViewModel).ChangeMusic(musicInfo); 61 | } 62 | } 63 | 64 | private async void MusicMoreButton_OnClicked(object sender, EventArgs e) 65 | { 66 | var musicInfo = (sender as BindableObject).BindingContext; 67 | var _mainMenuCellInfos = new List() 68 | { 69 | new MenuCellInfo() {Title = L("AddTo"), Code = "AddToPlaylist", Icon = ""}, 70 | new MenuCellInfo() {Title = L("PlayNext"), Code = "NextPlay", Icon = ""}, 71 | new MenuCellInfo() {Title = L("AddToQueue2"), Code = "AddToQueue", Icon = ""}, 72 | new MenuCellInfo() 73 | { 74 | Title = (musicInfo as MusicInfo).Artist, 75 | Code = "GoArtistPage", 76 | Icon = "" 77 | }, 78 | new MenuCellInfo() 79 | { 80 | Title = (musicInfo as MusicInfo).AlbumTitle, 81 | Code = "GoAlbumPage", 82 | Icon = "" 83 | }, 84 | 85 | 86 | }; 87 | var _musicFunctionPage = new MusicFunctionPage(musicInfo as IBasicInfo, _mainMenuCellInfos); 88 | _musicFunctionPage.OnFinished += _musicFunctionPage_OnFinished; 89 | 90 | await navigationService.ShowPopupAsync(_musicFunctionPage); 91 | 92 | } 93 | 94 | private void _musicFunctionPage_OnFinished(object sender, MusicFunctionEventArgs e) 95 | { 96 | musicFunctionManager.OnMusicFunctionFinished(e); 97 | } 98 | 99 | private async void SearchButton_OnClicked(object sender, EventArgs e) 100 | { 101 | //await navigationService.GoPageAsync("SearchPage"); 102 | } 103 | 104 | } 105 | 106 | } 107 | 108 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using Abp.Dependency; 2 | using MatoMusic.Core.Services; 3 | 4 | namespace MatoMusic; 5 | 6 | public partial class MainPage : Shell, ITransientDependency 7 | { 8 | private readonly IocManager iocManager; 9 | 10 | public MainPage(IocManager iocManager) 11 | { 12 | InitializeComponent(); 13 | this.iocManager = iocManager; 14 | this.Init(); 15 | Loaded += MainPage_Loaded; 16 | } 17 | 18 | private async void MainPage_Loaded(object sender, EventArgs e) 19 | { 20 | var musicRelatedViewModel = iocManager.Resolve(); 21 | await musicRelatedViewModel.InitAll(); 22 | } 23 | 24 | private void Init() 25 | { 26 | var nowPlayingPage = iocManager.Resolve(); 27 | var queuePage = iocManager.Resolve(); 28 | var playlistPage = iocManager.Resolve(); 29 | this.NowPlayingPageShellContent.Content = nowPlayingPage; 30 | this.QueuePageShellContent.Content = queuePage; 31 | this.PlaylistPageShellContent.Content = playlistPage; 32 | 33 | var musicPage = iocManager.Resolve(); 34 | var albumPage = iocManager.Resolve(); 35 | var artistPage = iocManager.Resolve(); 36 | 37 | this.MusicPageShellContent.Content = musicPage; 38 | this.ArtistPageShellContent.Content = artistPage; 39 | this.AlbumPageShellContent.Content = albumPage; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /src/MatoMusic/Views/MusicFunctionPage.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 37 | 41 | 42 | 43 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/MusicFunctionPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Abp.Dependency; 4 | using CommunityToolkit.Maui.Views; 5 | using MatoMusic.Common; 6 | using MatoMusic.Core; 7 | using MatoMusic.Core.Models; 8 | using MatoMusic.Infrastructure.Common; 9 | using MatoMusic.ViewModels; 10 | using Microsoft.Maui.Controls; 11 | 12 | 13 | namespace MatoMusic 14 | { 15 | public partial class MusicFunctionPage : PopupBase, ITransientDependency 16 | { 17 | public event EventHandler OnFinished; 18 | 19 | public MusicFunctionPage() 20 | { 21 | 22 | InitializeComponent(); 23 | } 24 | public MusicFunctionPage(IBasicInfo objInfo, IList menus) 25 | { 26 | InitializeComponent(); 27 | 28 | this.ObjInfo = objInfo; 29 | this.Menus = menus; 30 | this.BindingContext = new MusicFunctionPageViewModel(ObjInfo, Menus); 31 | if (ObjInfo is MusicInfo) 32 | { 33 | //this.FavouritLayout.IsVisible = true; 34 | } 35 | } 36 | 37 | private IBasicInfo _objInfo; 38 | 39 | public IBasicInfo ObjInfo 40 | { 41 | get { return _objInfo; } 42 | set { _objInfo = value; } 43 | } 44 | 45 | 46 | private IList _menus; 47 | 48 | public IList Menus 49 | { 50 | get { return _menus; } 51 | set { _menus = value; } 52 | } 53 | 54 | 55 | private void ListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 56 | { 57 | 58 | OnFinished?.Invoke(this, new MusicFunctionEventArgs(_objInfo, e.SelectedItem as MenuCellInfo)); 59 | this.Close(); 60 | } 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/PlaylistChoosePage.xaml: -------------------------------------------------------------------------------- 1 |  8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 26 | 27 | 29 | 34 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/PlaylistChoosePage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Abp.Dependency; 3 | using CommunityToolkit.Maui.Views; 4 | using MatoMusic.Common; 5 | using MatoMusic.Core.Helper; 6 | using MatoMusic.Core.Interfaces; 7 | using MatoMusic.Core.Models; 8 | using MatoMusic.Core.Models.Entities; 9 | using Microsoft.Maui.Controls; 10 | 11 | 12 | namespace MatoMusic 13 | { 14 | 15 | 16 | public partial class PlaylistChoosePage : PopupBase, ITransientDependency 17 | { 18 | private PlaylistFunctionPage _editPlaylistFunctionPage; 19 | private readonly IMusicInfoManager musicInfoManager; 20 | 21 | public event EventHandler OnFinished; 22 | public PlaylistChoosePage(IMusicInfoManager musicInfoManager) 23 | { 24 | this.musicInfoManager=musicInfoManager; 25 | 26 | InitializeComponent(); 27 | Init(); 28 | } 29 | 30 | private async void Init() 31 | { 32 | var restul = await musicInfoManager.GetPlaylistInfo(); 33 | if (restul.Count == 0 || !restul.Any(c => c.Title == "我最喜爱")) 34 | { 35 | var model = new PlaylistInfo() { Id = 0, Title = "我最喜爱", IsHidden = false, IsRemovable = false }; 36 | var entity = ObjectMapper.Map(model); 37 | await musicInfoManager.CreatePlaylist(entity); 38 | } 39 | this.BindingContext = await musicInfoManager.GetPlaylist(); 40 | } 41 | 42 | private void ListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 43 | { 44 | var playlist = e.SelectedItem as Playlist; 45 | if (playlist != null) 46 | { 47 | this.OnFinished?.Invoke(this, playlist); 48 | 49 | } 50 | 51 | } 52 | 53 | private async void CreateButton_OnClicked(object sender, EventArgs e) 54 | { 55 | _editPlaylistFunctionPage = new PlaylistFunctionPage(null); 56 | _editPlaylistFunctionPage.OnFinished += _editPlaylistFunctionPage_OnFinished; 57 | await navigationService.ShowPopupAsync(_editPlaylistFunctionPage); 58 | } 59 | 60 | private async void _editPlaylistFunctionPage_OnFinished(object sender, CommonFunctionEventArgs e) 61 | { 62 | var playlistInfo = e.Info as PlaylistInfo; 63 | 64 | if (playlistInfo != null && playlistInfo.Title != "我最喜爱" && !string.IsNullOrEmpty(playlistInfo.Title)) 65 | { 66 | var restul = await musicInfoManager.GetPlaylistInfo(); 67 | if (!restul.Any(c => c.Title == playlistInfo.Title)) 68 | { 69 | if (e.Code == "Create") 70 | { 71 | var entity = ObjectMapper.Map(playlistInfo); 72 | 73 | if (await musicInfoManager.CreatePlaylist(entity)) 74 | { 75 | 76 | CommonHelper.ShowMsg(string.Format("{0} {1}", L("Msg_HasCreated"), playlistInfo.Title)); 77 | 78 | } 79 | else 80 | { 81 | CommonHelper.ShowMsg(string.Format("{0} {1}", L("Msg_AddFailed"), playlistInfo.Title)); 82 | 83 | } 84 | 85 | } 86 | Init(); 87 | await navigationService.HidePopupAsync(_editPlaylistFunctionPage); 88 | } 89 | else 90 | { 91 | CommonHelper.ShowMsg(string.Format("{0} {1}", L("Msg_AlreadyExists"), playlistInfo.Title)); 92 | } 93 | } 94 | else 95 | { 96 | CommonHelper.ShowMsg(string.Format(L("Msg_Nameillegal"))); 97 | 98 | } 99 | 100 | } 101 | 102 | 103 | 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/PlaylistFunctionPage.xaml: -------------------------------------------------------------------------------- 1 |  7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 26 | 27 | 29 | 33 | 34 | 35 | 36 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/PlaylistFunctionPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using Abp.Dependency; 2 | using CommunityToolkit.Maui.Views; 3 | using MatoMusic.Common; 4 | using MatoMusic.Core.Models; 5 | using MatoMusic.ViewModel; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.ComponentModel; 9 | using System.Linq; 10 | using System.Runtime.CompilerServices; 11 | using System.Text; 12 | using System.Threading.Tasks; 13 | using System.Windows.Input; 14 | 15 | 16 | namespace MatoMusic 17 | { 18 | 19 | 20 | public partial class PlaylistFunctionPage : PopupBase, ITransientDependency 21 | { 22 | private bool _isEdit = false; 23 | public event EventHandler OnFinished; 24 | 25 | public PlaylistFunctionPage(PlaylistInfo info) 26 | { 27 | InitializeComponent(); 28 | if (info != null) 29 | { 30 | _isEdit = true; 31 | this.BindingContext = new PlaylistFunctionPageViewModel(new PlaylistInfo() 32 | { 33 | AlbumArt = info.AlbumArt, 34 | AlbumArtPath = info.AlbumArtPath, 35 | Artist = info.Artist, 36 | GroupHeader = info.GroupHeader, 37 | Id = info.Id, 38 | IsHidden = info.IsHidden, 39 | IsRemovable = info.IsRemovable, 40 | Musics = info.Musics, 41 | PlaylistArt = info.PlaylistArt, 42 | Title =info.Title, 43 | 44 | }); 45 | this.LabelCreate.Text = L("EditPlaylist"); 46 | } 47 | else 48 | { 49 | _isEdit = false; 50 | this.BindingContext = new PlaylistFunctionPageViewModel(); 51 | this.LabelCreate.Text = L("AddPlaylist"); 52 | } 53 | } 54 | 55 | 56 | private void SubmitButtonButton_OnClicked(object sender, EventArgs e) 57 | { 58 | var playlistFunctionPageViewModel = this.BindingContext as PlaylistFunctionPageViewModel; 59 | 60 | if (OnFinished != null && playlistFunctionPageViewModel != null) 61 | OnFinished(this, new CommonFunctionEventArgs(playlistFunctionPageViewModel.PlaylistInfo, _isEdit ? "Edit" : "Create")); 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/PlaylistPage.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 33 | 36 | 42 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/MatoMusic/Views/QueuePage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Abp.Dependency; 4 | using Abp.Localization; 5 | using MatoMusic.Common; 6 | using MatoMusic.Core; 7 | using MatoMusic.Core.Helper; 8 | using MatoMusic.Core.Models; 9 | using MatoMusic.Infrastructure.Common; 10 | using MatoMusic.Services; 11 | using MatoMusic.ViewModels; 12 | using Microsoft.Maui.Controls; 13 | 14 | 15 | namespace MatoMusic 16 | { 17 | public partial class QueuePage : ContentPageBase, ITransientDependency 18 | { 19 | private readonly MusicFunctionManager musicFunctionManager; 20 | 21 | public QueuePage( 22 | QueuePageViewModel queuePageViewModel, 23 | MusicFunctionManager musicFunctionManager) 24 | { 25 | this.musicFunctionManager = musicFunctionManager; 26 | InitializeComponent(); 27 | this.BindingContext = queuePageViewModel; 28 | } 29 | 30 | 31 | 32 | private void ListView_OnItemSelected(object sender, SelectedItemChangedEventArgs e) 33 | { 34 | //MusicRelatedViewModel.Current.ChangeMusic(e.SelectedItem as MusicInfo); 35 | 36 | } 37 | private async void MusicMoreButton_OnClicked(object sender, EventArgs e) 38 | { 39 | var musicInfo = (sender as BindableObject).BindingContext; 40 | var _mainMenuCellInfos = new List() 41 | { 42 | new MenuCellInfo() {Title = L("Remove"), Code = "Delete", Icon = ""}, 43 | new MenuCellInfo() {Title = L("AddTo"), Code = "AddToPlaylist", Icon = ""}, 44 | new MenuCellInfo() {Title = L("PlayNext"), Code = "NextPlay", Icon = ""}, 45 | //new MenuCellInfo() {Title = L("AddToQueue2"), Code = "AddToQueue", Icon = ""}, 46 | new MenuCellInfo() 47 | { 48 | Title = (musicInfo as MusicInfo).Artist, 49 | Code = "GoArtistPage", 50 | Icon = "" 51 | }, 52 | new MenuCellInfo() 53 | { 54 | Title = (musicInfo as MusicInfo).AlbumTitle, 55 | Code = "GoAlbumPage", 56 | Icon = "" 57 | }, 58 | 59 | 60 | }; 61 | var _musicFunctionPage = new MusicFunctionPage(musicInfo as IBasicInfo, _mainMenuCellInfos); 62 | _musicFunctionPage.OnFinished += _musicFunctionPage_OnFinished; 63 | 64 | await navigationService.ShowPopupAsync(_musicFunctionPage); 65 | 66 | } 67 | 68 | private void _musicFunctionPage_OnFinished(object sender, MusicFunctionEventArgs e) 69 | { 70 | if (e.MenuCellInfo.Code == "Delete") 71 | { 72 | var musicInfo = e.MusicInfo; 73 | var queuePageViewModel = this.BindingContext as QueuePageViewModel; 74 | if (queuePageViewModel != null) 75 | queuePageViewModel.DeleteAction(musicInfo); 76 | } 77 | musicFunctionManager.OnMusicFunctionFinished(e); 78 | } 79 | 80 | 81 | private async void Button_OnClicked(object sender, EventArgs e) 82 | { 83 | await navigationService.GoPageAsync("LibraryMainPage"); 84 | } 85 | 86 | private void FavouriteButton_OnClicked(object sender, EventArgs e) 87 | { 88 | var musicInfo = (sender as BindableObject)?.BindingContext as MusicInfo; 89 | if (musicInfo != null) 90 | { 91 | musicInfo.IsFavourite = !musicInfo.IsFavourite; 92 | if (musicInfo.IsFavourite) 93 | { 94 | CommonHelper.ShowMsg("我最喜爱"); 95 | 96 | } 97 | } 98 | } 99 | } 100 | } 101 | --------------------------------------------------------------------------------