├── .gitignore
├── .vs
├── CloudMusic
│ └── v15
│ │ └── .suo
├── DMSKIN-CODE
│ └── v15
│ │ └── .suo
├── ProjectSettings.json
├── VSWorkspaceState.json
└── slnx.sqlite
├── DMSkin.CloudMusic
├── .vs
│ └── DMSkin.CloudMusic
│ │ └── v15
│ │ └── .suo
├── DMSkin.CloudMusic.sln
├── DMSkin.CloudMusic
│ ├── API
│ │ ├── MP3Info.cs
│ │ ├── PageManager.cs
│ │ └── PlayManager.cs
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Controls
│ │ ├── IconButton.cs
│ │ └── ImageRadioButton.cs
│ ├── Converters
│ │ └── EnumToBooleanConverter.cs
│ ├── DMSkin.CloudMusic.csproj
│ ├── DMSkin.CloudMusic.csproj.user
│ ├── Font
│ │ └── Roboto-Light.ttf
│ ├── Image
│ │ ├── Logo
│ │ │ ├── head.jpg
│ │ │ ├── ic_launcher.png
│ │ │ └── icon.ico
│ │ ├── tg.png
│ │ ├── th.png
│ │ ├── tt.png
│ │ └── tu.png
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Model
│ │ ├── LeftMenu.cs
│ │ └── Music.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── Style
│ │ ├── Button.xaml
│ │ ├── Color.xaml
│ │ ├── DMScrollViewer.xaml
│ │ ├── DMSlider.xaml
│ │ ├── Expander.xaml
│ │ ├── Path.xaml
│ │ ├── ProgressBar.xaml
│ │ └── RadioButton.xaml
│ ├── View
│ │ ├── PageCloudMusic.xaml
│ │ ├── PageCloudMusic.xaml.cs
│ │ ├── PageCollection.xaml
│ │ ├── PageCollection.xaml.cs
│ │ ├── PageDownLoad.xaml
│ │ ├── PageDownLoad.xaml.cs
│ │ ├── PageEmpty.xaml
│ │ ├── PageEmpty.xaml.cs
│ │ ├── PageLocalMusic.xaml
│ │ └── PageLocalMusic.xaml.cs
│ ├── ViewModel
│ │ ├── Base
│ │ │ └── MusicViewModelBase.cs
│ │ ├── MainWindowViewModel.cs
│ │ ├── PageCloudMusicViewModel.cs
│ │ └── PageLocalMusicViewModel.cs
│ └── packages.config
├── DMSkin.Core
│ ├── Common
│ │ ├── Base64.cs
│ │ ├── Execute.cs
│ │ ├── HTTP.cs
│ │ └── UINT.cs
│ ├── Converters
│ │ ├── BoolToVisibilityConverter.cs
│ │ ├── CompareToVisibilityConverter.cs
│ │ ├── EnumToBooleanConverter.cs
│ │ ├── EnumToVisibilityConverter.cs
│ │ ├── SecondToStringConverter.cs
│ │ └── TimeSpanToStringConverter.cs
│ ├── DMSkin.Core.csproj
│ ├── MVVM
│ │ ├── DelegateCommand.cs
│ │ └── ViewModelBase.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── TaskManager.cs
│ └── WIN32
│ │ ├── DesktopAPI.cs
│ │ └── Native.cs
└── DMSkin.WPF
│ ├── Controls
│ ├── DMButton.cs
│ ├── DMCheckBox.cs
│ ├── DMLinkButton.cs
│ ├── DMNumericBox.cs
│ ├── DMRadioButton.cs
│ ├── DMScrollBar.cs
│ ├── DMScrollViewer.cs
│ ├── DMSystemButton.cs
│ ├── DMSystemCloseButton.cs
│ ├── DMSystemMaxButton.cs
│ ├── DMSystemMinButton.cs
│ ├── DMTabItem.cs
│ ├── DMTextBox.cs
│ ├── DMThumb.cs
│ ├── ElasticWrapPanel.cs
│ └── VirtualizingWrapPanel .cs
│ ├── DMSkin.WPF.csproj
│ ├── DMSkinComplexWindow.cs
│ ├── DMSkinSimpleWindow.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── ShadowWindow.xaml
│ ├── ShadowWindow.xaml.cs
│ └── Styles
│ ├── Animation.xaml
│ ├── DMButton.xaml
│ ├── DMCheckBox.xaml
│ ├── DMContextMenu.xaml
│ ├── DMDataGrid.xaml
│ ├── DMIcon.xaml
│ ├── DMImage.xaml
│ ├── DMItemsControl.xaml
│ ├── DMListBox.xaml
│ ├── DMRadioButton.xaml
│ ├── DMResizeGrip.xaml
│ ├── DMScrollViewer.xaml
│ ├── DMSkin.xaml
│ ├── DMSkinSimpleWindow.xaml
│ ├── DMSlider.xaml
│ ├── DMTabControl.xaml
│ ├── DMTextBox.xaml
│ ├── DMToolTip.xaml
│ └── DMTreeView.xaml
├── README.md
└── Screenshot
├── demo.png
├── demo1000.jpg
├── demo1001.png
└── demo1002.png
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015/2017 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # Visual Studio 2017 auto generated files
33 | Generated\ Files/
34 |
35 | # MSTest test Results
36 | [Tt]est[Rr]esult*/
37 | [Bb]uild[Ll]og.*
38 |
39 | # NUNIT
40 | *.VisualState.xml
41 | TestResult.xml
42 |
43 | # Build Results of an ATL Project
44 | [Dd]ebugPS/
45 | [Rr]eleasePS/
46 | dlldata.c
47 |
48 | # Benchmark Results
49 | BenchmarkDotNet.Artifacts/
50 |
51 | # .NET Core
52 | project.lock.json
53 | project.fragment.lock.json
54 | artifacts/
55 | **/Properties/launchSettings.json
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_i.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *.log
81 | *.vspscc
82 | *.vssscc
83 | .builds
84 | *.pidb
85 | *.svclog
86 | *.scc
87 |
88 | # Chutzpah Test files
89 | _Chutzpah*
90 |
91 | # Visual C++ cache files
92 | ipch/
93 | *.aps
94 | *.ncb
95 | *.opendb
96 | *.opensdf
97 | *.sdf
98 | *.cachefile
99 | *.VC.db
100 | *.VC.VC.opendb
101 |
102 | # Visual Studio profiler
103 | *.psess
104 | *.vsp
105 | *.vspx
106 | *.sap
107 |
108 | # Visual Studio Trace Files
109 | *.e2e
110 |
111 | # TFS 2012 Local Workspace
112 | $tf/
113 |
114 | # Guidance Automation Toolkit
115 | *.gpState
116 |
117 | # ReSharper is a .NET coding add-in
118 | _ReSharper*/
119 | *.[Rr]e[Ss]harper
120 | *.DotSettings.user
121 |
122 | # JustCode is a .NET coding add-in
123 | .JustCode
124 |
125 | # TeamCity is a build add-in
126 | _TeamCity*
127 |
128 | # DotCover is a Code Coverage Tool
129 | *.dotCover
130 |
131 | # AxoCover is a Code Coverage Tool
132 | .axoCover/*
133 | !.axoCover/settings.json
134 |
135 | # Visual Studio code coverage results
136 | *.coverage
137 | *.coveragexml
138 |
139 | # NCrunch
140 | _NCrunch_*
141 | .*crunch*.local.xml
142 | nCrunchTemp_*
143 |
144 | # MightyMoose
145 | *.mm.*
146 | AutoTest.Net/
147 |
148 | # Web workbench (sass)
149 | .sass-cache/
150 |
151 | # Installshield output folder
152 | [Ee]xpress/
153 |
154 | # DocProject is a documentation generator add-in
155 | DocProject/buildhelp/
156 | DocProject/Help/*.HxT
157 | DocProject/Help/*.HxC
158 | DocProject/Help/*.hhc
159 | DocProject/Help/*.hhk
160 | DocProject/Help/*.hhp
161 | DocProject/Help/Html2
162 | DocProject/Help/html
163 |
164 | # Click-Once directory
165 | publish/
166 |
167 | # Publish Web Output
168 | *.[Pp]ublish.xml
169 | *.azurePubxml
170 | # Note: Comment the next line if you want to checkin your web deploy settings,
171 | # but database connection strings (with potential passwords) will be unencrypted
172 | *.pubxml
173 | *.publishproj
174 |
175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
176 | # checkin your Azure Web App publish settings, but sensitive information contained
177 | # in these scripts will be unencrypted
178 | PublishScripts/
179 |
180 | # NuGet Packages
181 | *.nupkg
182 | # The packages folder can be ignored because of Package Restore
183 | [Pp]ackages/
184 | # except build/, which is used as an MSBuild target.
185 | !**/[Pp]ackages/build/
186 | # Uncomment if necessary however generally it will be regenerated when needed
187 | #!**/[Pp]ackages/repositories.config
188 | # NuGet v3's project.json files produces more ignorable files
189 | *.nuget.props
190 | *.nuget.targets
191 |
192 | # Microsoft Azure Build Output
193 | csx/
194 | *.build.csdef
195 |
196 | # Microsoft Azure Emulator
197 | ecf/
198 | rcf/
199 |
200 | # Windows Store app package directories and files
201 | AppPackages/
202 | BundleArtifacts/
203 | Package.StoreAssociation.xml
204 | _pkginfo.txt
205 | *.appx
206 |
207 | # Visual Studio cache files
208 | # files ending in .cache can be ignored
209 | *.[Cc]ache
210 | # but keep track of directories ending in .cache
211 | !*.[Cc]ache/
212 |
213 | # Others
214 | ClientBin/
215 | ~$*
216 | *~
217 | *.dbmdl
218 | *.dbproj.schemaview
219 | *.jfm
220 | *.pfx
221 | *.publishsettings
222 | orleans.codegen.cs
223 |
224 | # Including strong name files can present a security risk
225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
226 | #*.snk
227 |
228 | # Since there are multiple workflows, uncomment next line to ignore bower_components
229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
230 | #bower_components/
231 |
232 | # RIA/Silverlight projects
233 | Generated_Code/
234 |
235 | # Backup & report files from converting an old project file
236 | # to a newer Visual Studio version. Backup files are not needed,
237 | # because we have git ;-)
238 | _UpgradeReport_Files/
239 | Backup*/
240 | UpgradeLog*.XML
241 | UpgradeLog*.htm
242 | ServiceFabricBackup/
243 | *.rptproj.bak
244 |
245 | # SQL Server files
246 | *.mdf
247 | *.ldf
248 | *.ndf
249 |
250 | # Business Intelligence projects
251 | *.rdl.data
252 | *.bim.layout
253 | *.bim_*.settings
254 | *.rptproj.rsuser
255 |
256 | # Microsoft Fakes
257 | FakesAssemblies/
258 |
259 | # GhostDoc plugin setting file
260 | *.GhostDoc.xml
261 |
262 | # Node.js Tools for Visual Studio
263 | .ntvs_analysis.dat
264 | node_modules/
265 |
266 | # Visual Studio 6 build log
267 | *.plg
268 |
269 | # Visual Studio 6 workspace options file
270 | *.opt
271 |
272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
273 | *.vbw
274 |
275 | # Visual Studio LightSwitch build output
276 | **/*.HTMLClient/GeneratedArtifacts
277 | **/*.DesktopClient/GeneratedArtifacts
278 | **/*.DesktopClient/ModelManifest.xml
279 | **/*.Server/GeneratedArtifacts
280 | **/*.Server/ModelManifest.xml
281 | _Pvt_Extensions
282 |
283 | # Paket dependency manager
284 | .paket/paket.exe
285 | paket-files/
286 |
287 | # FAKE - F# Make
288 | .fake/
289 |
290 | # JetBrains Rider
291 | .idea/
292 | *.sln.iml
293 |
294 | # CodeRush
295 | .cr/
296 |
297 | # Python Tools for Visual Studio (PTVS)
298 | __pycache__/
299 | *.pyc
300 |
301 | # Cake - Uncomment if you are using it
302 | # tools/**
303 | # !tools/packages.config
304 |
305 | # Tabs Studio
306 | *.tss
307 |
308 | # Telerik's JustMock configuration file
309 | *.jmconfig
310 |
311 | # BizTalk build output
312 | *.btp.cs
313 | *.btm.cs
314 | *.odx.cs
315 | *.xsd.cs
316 |
317 | # OpenCover UI analysis results
318 | OpenCover/
319 |
320 | # Azure Stream Analytics local run output
321 | ASALocalRun/
322 |
323 | # MSBuild Binary and Structured Log
324 | *.binlog
325 |
326 | # NVidia Nsight GPU debugger configuration file
327 | *.nvuser
328 |
329 | # MFractors (Xamarin productivity tool) working folder
330 | .mfractor/
331 |
--------------------------------------------------------------------------------
/.vs/CloudMusic/v15/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/.vs/CloudMusic/v15/.suo
--------------------------------------------------------------------------------
/.vs/DMSKIN-CODE/v15/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/.vs/DMSKIN-CODE/v15/.suo
--------------------------------------------------------------------------------
/.vs/ProjectSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "CurrentProjectSetting": null
3 | }
--------------------------------------------------------------------------------
/.vs/VSWorkspaceState.json:
--------------------------------------------------------------------------------
1 | {
2 | "ExpandedNodes": [
3 | "",
4 | "\\DMSkin.CloudMusic"
5 | ],
6 | "SelectedNode": "\\DMSkin.CloudMusic\\DMSkin.CloudMusic.sln",
7 | "PreviewInSolutionExplorer": false
8 | }
--------------------------------------------------------------------------------
/.vs/slnx.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/.vs/slnx.sqlite
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/.vs/DMSkin.CloudMusic/v15/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/DMSkin.CloudMusic/.vs/DMSkin.CloudMusic/v15/.suo
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29409.12
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DMSkin.CloudMusic", "DMSkin.CloudMusic\DMSkin.CloudMusic.csproj", "{DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DMSkin.Core", "DMSkin.Core\DMSkin.Core.csproj", "{13DA6558-356B-47B9-96F2-FE4D5457CB02}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DMSkin.WPF", "DMSkin.WPF\DMSkin.WPF.csproj", "{168352B1-6A0C-4C9C-8A32-68B512DA3CFC}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Debug|x86 = Debug|x86
16 | Release|Any CPU = Release|Any CPU
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}.Debug|x86.ActiveCfg = Debug|Any CPU
23 | {DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}.Debug|x86.Build.0 = Debug|Any CPU
24 | {DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}.Release|x86.ActiveCfg = Release|Any CPU
27 | {DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}.Release|x86.Build.0 = Release|Any CPU
28 | {13DA6558-356B-47B9-96F2-FE4D5457CB02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {13DA6558-356B-47B9-96F2-FE4D5457CB02}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {13DA6558-356B-47B9-96F2-FE4D5457CB02}.Debug|x86.ActiveCfg = Debug|x86
31 | {13DA6558-356B-47B9-96F2-FE4D5457CB02}.Debug|x86.Build.0 = Debug|x86
32 | {13DA6558-356B-47B9-96F2-FE4D5457CB02}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {13DA6558-356B-47B9-96F2-FE4D5457CB02}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {13DA6558-356B-47B9-96F2-FE4D5457CB02}.Release|x86.ActiveCfg = Release|x86
35 | {13DA6558-356B-47B9-96F2-FE4D5457CB02}.Release|x86.Build.0 = Release|x86
36 | {168352B1-6A0C-4C9C-8A32-68B512DA3CFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 | {168352B1-6A0C-4C9C-8A32-68B512DA3CFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 | {168352B1-6A0C-4C9C-8A32-68B512DA3CFC}.Debug|x86.ActiveCfg = Debug|x86
39 | {168352B1-6A0C-4C9C-8A32-68B512DA3CFC}.Debug|x86.Build.0 = Debug|x86
40 | {168352B1-6A0C-4C9C-8A32-68B512DA3CFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
41 | {168352B1-6A0C-4C9C-8A32-68B512DA3CFC}.Release|Any CPU.Build.0 = Release|Any CPU
42 | {168352B1-6A0C-4C9C-8A32-68B512DA3CFC}.Release|x86.ActiveCfg = Release|x86
43 | {168352B1-6A0C-4C9C-8A32-68B512DA3CFC}.Release|x86.Build.0 = Release|x86
44 | EndGlobalSection
45 | GlobalSection(SolutionProperties) = preSolution
46 | HideSolutionNode = FALSE
47 | EndGlobalSection
48 | GlobalSection(ExtensibilityGlobals) = postSolution
49 | SolutionGuid = {CC408E6C-0979-44C7-ADCA-2A615DE3CFC2}
50 | EndGlobalSection
51 | EndGlobal
52 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/API/MP3Info.cs:
--------------------------------------------------------------------------------
1 | using Shell32;
2 | using System;
3 | using System.Diagnostics;
4 |
5 | namespace DMSkin.CloudMusic
6 | {
7 | ///
8 | /// Windows Shell32.dll を参照し、データを取得するためのクラス
9 | ///
10 | public class MP3Info
11 | {
12 | public string trackName; // トラック名
13 | public string Artist; // アーティスト名
14 | public string Album; // アルバム名
15 | public string time; // 時間
16 |
17 | public MP3Info()
18 | {
19 | trackName = null;
20 | Artist = null;
21 | Album = null;
22 | time = null;
23 | }
24 |
25 | ///
26 | /// MP3 の情報を取得します。
27 | ///
28 | public bool GetMP3Info(string myDirectory, string myFile)
29 | {
30 | Folder folder = null;
31 | FolderItem folderItem;
32 |
33 | try
34 | {
35 | Type wShell = Type.GetTypeFromProgID("Shell.Application");
36 | object wshInstance = Activator.CreateInstance(wShell);
37 |
38 | folder = (Folder)wShell.InvokeMember("NameSpace",
39 | System.Reflection.BindingFlags.InvokeMethod,
40 | null,
41 | wshInstance,
42 | new object[] { myDirectory }
43 | );
44 |
45 | folderItem = folder.ParseName(myFile);
46 | }
47 | catch
48 | {
49 | return false;
50 | }
51 |
52 | //////////////////////////////////////////////////////////
53 | // Shell COM を 叩いて情報開示
54 | //////////////////////////////////////////////////////////
55 | trackName = folder.GetDetailsOf(folderItem, 21);
56 | Artist = folder.GetDetailsOf(folderItem, 20);
57 | Album = folder.GetDetailsOf(folderItem, 14);
58 | time = folder.GetDetailsOf(folderItem, 27);
59 |
60 | Debug.WriteLine(folder.GetDetailsOf(folderItem, 21)); // [DEBUG] trackName
61 | Debug.WriteLine(folder.GetDetailsOf(folderItem, 20)); // [DEBUG] Artist
62 | Debug.WriteLine(folder.GetDetailsOf(folderItem, 14)); // [DEBUG] Album
63 | Debug.WriteLine(folder.GetDetailsOf(folderItem, 27)); // [DEBUG] Time
64 |
65 | return true;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/API/PageManager.cs:
--------------------------------------------------------------------------------
1 | using DMSkin.CloudMusic.View;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Controls;
8 |
9 | namespace DMSkin.CloudMusic.API
10 | {
11 | ///
12 | /// 页面管理器
13 | ///
14 | public class PageManager
15 | {
16 | #region 本地音乐
17 | private static PageLocalMusic pageLocalMusic;
18 | ///
19 | /// 本地音乐
20 | ///
21 | public static PageLocalMusic PageLocalMusic
22 | {
23 | get
24 | {
25 | if (pageLocalMusic == null)
26 | {
27 | //只会被构造一次
28 | pageLocalMusic = new PageLocalMusic();
29 | }
30 | return pageLocalMusic;
31 | }
32 | set { pageLocalMusic = value; }
33 | }
34 |
35 | public static Page PageDownLoad = new PageDownLoad();
36 | #endregion
37 |
38 | public static PageEmpty PageEmpty = new PageEmpty();
39 |
40 | public static PageCloudMusic PageCloudMusic = new PageCloudMusic();
41 |
42 | public static PageCollection PageCollection = new PageCollection();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/API/PlayManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Net;
4 | using System.Threading.Tasks;
5 | using System.Windows.Media;
6 | using DMSkin.CloudMusic.Model;
7 | using DMSkin.Core.Common;
8 |
9 | namespace DMSkin.CloudMusic.API
10 | {
11 | class PlayManager
12 | {
13 | public static PlayState State { get; internal set; }
14 |
15 | internal static void Play(Music music)
16 | {
17 | State = PlayState.Play;
18 | if (music.Url.Contains("http"))
19 | {
20 | if (!File.Exists(music.FileName))
21 | {
22 | Task.Run(() =>
23 | {
24 | music.DownLoad = true;
25 | using (WebClient wb = new WebClient())
26 | {
27 | wb.DownloadFile(music.Url, music.FileName);
28 | }
29 | music.DownLoad = false;
30 | music.Url = music.FileName;
31 | Open(music);
32 | });
33 | return;
34 | }
35 | else
36 | {
37 | music.Url = music.FileName;
38 | }
39 | }
40 | Open(music);
41 | }
42 |
43 | public static void Open(Music music)
44 | {
45 | Execute.OnUIThread(() =>
46 | {
47 | player.Open(new Uri(music.Url, UriKind.RelativeOrAbsolute));
48 | player.Play();
49 | });
50 | }
51 |
52 | public static MediaPlayer player;
53 | }
54 |
55 | public enum PlayState
56 | {
57 | Play,
58 | Pause,
59 | Stop
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/App.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 | 微软雅黑,SimSun
12 |
13 | 微软雅黑
14 |
15 |
16 |
17 |
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 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using DMSkin.Core.Common;
2 | using System.Windows;
3 |
4 | namespace DMSkin.CloudMusic
5 | {
6 | public partial class App : Application
7 | {
8 | protected override void OnStartup(StartupEventArgs e)
9 | {
10 | base.OnStartup(e);
11 |
12 | Execute.InitializeWithDispatcher();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Controls/IconButton.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 System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Media;
10 |
11 | namespace DMSkin.CloudMusic.Controls
12 | {
13 | public class IconButton : RadioButton
14 | {
15 | public CornerRadius CornerRadius
16 | {
17 | get { return (CornerRadius)GetValue(CornerRadiusProperty); }
18 | set { SetValue(CornerRadiusProperty, value); }
19 | }
20 | public static readonly DependencyProperty CornerRadiusProperty =
21 | DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(IconButton), new PropertyMetadata(null));
22 |
23 |
24 | ///
25 | /// 图标
26 | ///
27 | [Description("图标"), Category("DMSkin")]
28 | public Geometry Icon
29 | {
30 | get { return (Geometry)GetValue(IconProperty); }
31 | set { SetValue(IconProperty, value); }
32 | }
33 | public static readonly DependencyProperty IconProperty =
34 | DependencyProperty.Register("Icon", typeof(Geometry), typeof(IconButton), new PropertyMetadata(null));
35 |
36 |
37 |
38 | ///
39 | /// 图标宽度
40 | ///
41 | public double IconWidth
42 | {
43 | get { return (double)GetValue(IconWidthProperty); }
44 | set { SetValue(IconWidthProperty, value); }
45 | }
46 | public static readonly DependencyProperty IconWidthProperty =
47 | DependencyProperty.Register("IconWidth", typeof(double), typeof(IconButton), new PropertyMetadata(12.0));
48 |
49 |
50 |
51 | ///
52 | /// 图标高度
53 | ///
54 | public double IconHeight
55 | {
56 | get { return (double)GetValue(IconHeightProperty); }
57 | set { SetValue(IconHeightProperty, value); }
58 | }
59 | public static readonly DependencyProperty IconHeightProperty =
60 | DependencyProperty.Register("IconHeight", typeof(double), typeof(IconButton), new PropertyMetadata(12.0));
61 |
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Controls/ImageRadioButton.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Media;
8 |
9 | namespace DMSkin.CloudMusic.Controls
10 | {
11 | public class ImageRadioButton:RadioButton
12 | {
13 | public Geometry Image
14 | {
15 | get { return (Geometry)GetValue(ImageProperty); }
16 | set { SetValue(ImageProperty, value); }
17 | }
18 |
19 | public static readonly DependencyProperty ImageProperty =
20 | DependencyProperty.Register("Image", typeof(Geometry), typeof(ImageRadioButton));
21 |
22 |
23 |
24 | public double ImageWidth
25 | {
26 | get { return (double)GetValue(ImageWidthProperty); }
27 | set { SetValue(ImageWidthProperty, value); }
28 | }
29 |
30 | public static readonly DependencyProperty ImageWidthProperty =
31 | DependencyProperty.Register("ImageWidth", typeof(double), typeof(ImageRadioButton),new PropertyMetadata(15.0));
32 |
33 | public double ImageHeight
34 | {
35 | get { return (double)GetValue(ImageHeightProperty); }
36 | set { SetValue(ImageHeightProperty, value); }
37 | }
38 |
39 | public static readonly DependencyProperty ImageHeightProperty =
40 | DependencyProperty.Register("ImageHeight", typeof(double), typeof(ImageRadioButton),new PropertyMetadata(15.0));
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Converters/EnumToBooleanConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Data;
7 |
8 | namespace DMSkin.CloudMusic.Converters
9 | {
10 | public class EnumToBooleanConverter : IValueConverter
11 | {
12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
13 | {
14 | if (value == null||value.ToString()!=parameter.ToString())
15 | {
16 | return false;
17 | }
18 | return true;
19 | }
20 |
21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
22 | {
23 | return value != null && value.Equals(true) ? parameter : Binding.DoNothing;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/DMSkin.CloudMusic.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {DCBE7342-5F9A-46C8-B8F8-BACDC35DD51A}
8 | WinExe
9 | DMSkin.CloudMusic
10 | DMSkin.CloudMusic
11 | v4.5
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 | Image\Logo\icon.ico
38 |
39 |
40 |
41 | ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | 4.0
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | MSBuild:Compile
62 | Designer
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | PageCollection.xaml
76 |
77 |
78 | PageDownLoad.xaml
79 |
80 |
81 | PageEmpty.xaml
82 |
83 |
84 | PageCloudMusic.xaml
85 |
86 |
87 | PageLocalMusic.xaml
88 |
89 |
90 | MSBuild:Compile
91 | Designer
92 |
93 |
94 | App.xaml
95 | Code
96 |
97 |
98 |
99 |
100 | MainWindow.xaml
101 | Code
102 |
103 |
104 | Designer
105 | MSBuild:Compile
106 |
107 |
108 | Designer
109 | MSBuild:Compile
110 |
111 |
112 | MSBuild:Compile
113 | Designer
114 |
115 |
116 | MSBuild:Compile
117 | Designer
118 |
119 |
120 | MSBuild:Compile
121 | Designer
122 |
123 |
124 | MSBuild:Compile
125 | Designer
126 |
127 |
128 | Designer
129 | MSBuild:Compile
130 |
131 |
132 | MSBuild:Compile
133 | Designer
134 |
135 |
136 | Designer
137 | MSBuild:Compile
138 |
139 |
140 | Designer
141 | MSBuild:Compile
142 |
143 |
144 | Designer
145 | MSBuild:Compile
146 |
147 |
148 | MSBuild:Compile
149 | Designer
150 |
151 |
152 | Designer
153 | MSBuild:Compile
154 |
155 |
156 |
157 |
158 | Code
159 |
160 |
161 | True
162 | True
163 | Resources.resx
164 |
165 |
166 | True
167 | Settings.settings
168 | True
169 |
170 |
171 | ResXFileCodeGenerator
172 | Resources.Designer.cs
173 |
174 |
175 |
176 |
177 | SettingsSingleFileGenerator
178 | Settings.Designer.cs
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 | {50A7E9B0-70EF-11D1-B75A-00A0C90564FE}
201 | 1
202 | 0
203 | 0
204 | tlbimp
205 | False
206 | True
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 | {13da6558-356b-47b9-96f2-fe4d5457cb02}
215 | DMSkin.Core
216 |
217 |
218 | {168352b1-6a0c-4c9c-8a32-68b512da3cfc}
219 | DMSkin.WPF
220 |
221 |
222 |
223 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/DMSkin.CloudMusic.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ProjectFiles
5 |
6 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Font/Roboto-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/DMSkin.CloudMusic/DMSkin.CloudMusic/Font/Roboto-Light.ttf
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/Logo/head.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/Logo/head.jpg
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/Logo/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/Logo/ic_launcher.png
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/Logo/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/Logo/icon.ico
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/tg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/tg.png
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/th.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/th.png
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/tt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/tt.png
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/tu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/944095635/DMSkin-CloudMusic/264da6ce5786a51684cb6800f77ba38fb2b30653/DMSkin.CloudMusic/DMSkin.CloudMusic/Image/tu.png
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace DMSkin.CloudMusic
2 | {
3 | public partial class MainWindow
4 | {
5 | public MainWindow()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Model/LeftMenu.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 DMSkin.CloudMusic.Model
8 | {
9 | public enum LeftMenu
10 | {
11 | ///
12 | /// 空页面
13 | ///
14 | Empty,
15 | Home,
16 | ///
17 | /// 发现音乐
18 | ///
19 | FindMusic,
20 | ///
21 | /// 本地音乐
22 | ///
23 | LocalMusic,
24 | DownLoad,
25 | ///
26 | /// 云盘音乐
27 | ///
28 | CloudMusic,
29 | ///
30 | /// 我的收藏
31 | ///
32 | Collection
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Model/Music.cs:
--------------------------------------------------------------------------------
1 | using DMSkin.Core.MVVM;
2 | using System;
3 |
4 | namespace DMSkin.CloudMusic.Model
5 | {
6 | public class Music:ViewModelBase
7 | {
8 | private string index;
9 |
10 | ///
11 | /// 序号
12 | ///
13 | public string Index
14 | {
15 | get { return index; }
16 | set
17 | {
18 | index = value;
19 | OnPropertyChanged("Index");
20 | }
21 | }
22 |
23 | private string url;
24 | ///
25 | /// 路径
26 | ///
27 | public string Url
28 | {
29 | get { return url; }
30 | set
31 | {
32 | url = value;
33 | OnPropertyChanged("Url");
34 | }
35 | }
36 |
37 |
38 |
39 | private string title;
40 |
41 | ///
42 | /// 标题
43 | ///
44 | public string Title
45 | {
46 | get { return title; }
47 | set
48 | {
49 | title = value;
50 | OnPropertyChanged("Title");
51 | }
52 | }
53 |
54 | private double size;
55 |
56 | ///
57 | /// 体积
58 | ///
59 | public double Size
60 | {
61 | get { return size; }
62 | set
63 | {
64 | size = value;
65 | OnPropertyChanged("Size");
66 | }
67 | }
68 |
69 | ///
70 | /// 体积-MB
71 | ///
72 | public string SizeStr
73 | {
74 | get {
75 | return HumanReadableFilesize(size);
76 | }
77 | }
78 |
79 | private String HumanReadableFilesize(double size)
80 | {
81 | String[] units = new String[] { "B", "KB", "MB", "GB", "TB", "PB" };
82 | double mod = 1024.0;
83 | int i = 0;
84 | while (size >= mod)
85 | {
86 | size /= mod;
87 | i++;
88 | }
89 | return Math.Round(size,2) + units[i];
90 | }
91 |
92 | private string album;
93 |
94 | ///
95 | /// 专辑
96 | ///
97 | public string Album
98 | {
99 | get { return album; }
100 | set
101 | {
102 | album = value;
103 | OnPropertyChanged("Album");
104 | }
105 | }
106 |
107 |
108 | private string artist;
109 |
110 | ///
111 | /// 作者
112 | ///
113 | public string Artist
114 | {
115 | get { return artist; }
116 | set
117 | {
118 | artist = value;
119 | OnPropertyChanged("Artist");
120 | }
121 | }
122 |
123 |
124 | private string timeStr;
125 |
126 | ///
127 | ///
128 | ///
129 | public string TimeStr
130 | {
131 | get { return timeStr; }
132 | set
133 | {
134 | timeStr = value;
135 | OnPropertyChanged("TimeStr");
136 | }
137 | }
138 |
139 | public string FileName { get; internal set; }
140 |
141 |
142 | private bool download;
143 |
144 | ///
145 | /// 是否在下载
146 | ///
147 | public bool DownLoad
148 | {
149 | get { return download; }
150 | set
151 | {
152 | download = value;
153 | OnPropertyChanged("DownLoad");
154 | }
155 | }
156 |
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("DMSkin.CloudMusic")]
11 | [assembly: AssemblyDescription("944095635")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("944095635")]
14 | [assembly: AssemblyProduct("DMSkin.CloudMusic")]
15 | [assembly: AssemblyCopyright("Copyright © 2018")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.3")]
55 | [assembly: AssemblyFileVersion("1.0.0.3")]
56 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DMSkin.CloudMusic.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DMSkin.CloudMusic.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DMSkin.CloudMusic.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Style/Color.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Style/ProgressBar.xaml:
--------------------------------------------------------------------------------
1 |
4 |
64 |
65 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/Style/RadioButton.xaml:
--------------------------------------------------------------------------------
1 |
5 |
63 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
93 |
94 |
95 |
96 |
97 |
106 |
107 |
113 |
114 |
115 |
127 |
128 |
129 |
130 |
131 |
132 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageCloudMusic.xaml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
30 |
34 |
41 |
45 |
46 |
47 |
48 |
49 |
53 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
78 |
85 |
91 |
92 |
101 |
102 |
108 |
109 |
110 |
111 |
112 |
113 |
130 |
131 |
132 |
133 |
134 |
139 |
143 |
147 |
151 |
155 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
174 |
180 |
185 |
190 |
191 |
192 |
193 |
194 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageCloudMusic.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace DMSkin.CloudMusic.View
4 | {
5 | public partial class PageCloudMusic : Page
6 | {
7 | public PageCloudMusic()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageCollection.xaml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
19 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
43 |
50 |
56 |
57 |
61 |
65 |
71 |
72 |
73 |
77 |
78 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
98 |
105 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageCollection.xaml.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.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace DMSkin.CloudMusic.View
17 | {
18 | ///
19 | /// PageCollection.xaml 的交互逻辑
20 | ///
21 | public partial class PageCollection : Page
22 | {
23 | public PageCollection()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageDownLoad.xaml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
19 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
43 |
50 |
56 |
57 |
61 |
65 |
71 |
72 |
73 |
77 |
78 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
98 |
105 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageDownLoad.xaml.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.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace DMSkin.CloudMusic.View
17 | {
18 | ///
19 | /// PageDownLoad.xaml 的交互逻辑
20 | ///
21 | public partial class PageDownLoad : Page
22 | {
23 | public PageDownLoad()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageEmpty.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageEmpty.xaml.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.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace DMSkin.CloudMusic.View
17 | {
18 | ///
19 | /// PageEmpty.xaml 的交互逻辑
20 | ///
21 | public partial class PageEmpty : Page
22 | {
23 | public PageEmpty()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageLocalMusic.xaml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
30 |
34 |
35 |
42 |
43 |
47 |
51 |
55 |
60 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
82 |
89 |
95 |
96 |
105 |
106 |
112 |
113 |
114 |
115 |
116 |
133 |
134 |
135 |
136 |
137 |
142 |
146 |
150 |
154 |
158 |
162 |
163 |
164 |
165 |
170 |
176 |
181 |
188 |
189 |
190 |
191 |
192 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/View/PageLocalMusic.xaml.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.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace DMSkin.CloudMusic.View
17 | {
18 | ///
19 | /// PageLocalMusic.xaml 的交互逻辑
20 | ///
21 | public partial class PageLocalMusic : Page
22 | {
23 | public PageLocalMusic()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/ViewModel/Base/MusicViewModelBase.cs:
--------------------------------------------------------------------------------
1 | using DMSkin.CloudMusic.API;
2 | using DMSkin.CloudMusic.Model;
3 | using DMSkin.Core.MVVM;
4 | using System.Collections.ObjectModel;
5 | using System.Windows.Input;
6 |
7 | namespace DMSkin.CloudMusic.ViewModel
8 | {
9 | ///
10 | /// 这是播放页面的基类
11 | ///
12 | public class MusicViewModelBase :ViewModelBase
13 | {
14 | #region 选中的音乐
15 | private Music selectedMusic;
16 | ///
17 | /// 选中的音乐
18 | ///
19 | public Music SelectedMusic
20 | {
21 | get { return selectedMusic; }
22 | set
23 | {
24 | selectedMusic = value;
25 | OnPropertyChanged("SelectedMusic");
26 | }
27 | }
28 | #endregion
29 |
30 | #region 播放操作
31 | ///
32 | /// 播放操作
33 | ///
34 | public ICommand PlayCommand
35 | {
36 | get
37 | {
38 | return new DelegateCommand(obj =>
39 | {
40 | if (SelectedMusic != null)
41 | {
42 | PlayManager.Play(SelectedMusic);
43 | }
44 | });
45 | }
46 | }
47 | #endregion
48 |
49 | #region 音乐列表
50 | private ObservableCollection musicList;
51 | ///
52 | /// 音乐列表
53 | ///
54 | public ObservableCollection MusicList
55 | {
56 | get
57 | {
58 | if (musicList == null)
59 | {
60 | musicList = new ObservableCollection();
61 | }
62 | return musicList;
63 | }
64 | set
65 | {
66 | musicList = value;
67 | OnPropertyChanged("MusicList");
68 | }
69 | }
70 | #endregion
71 |
72 | #region 是否显示歌曲列表
73 | private bool displayMusicList;
74 | ///
75 | /// 是否显示歌曲列表
76 | ///
77 | public bool DisplayMusicList
78 | {
79 | get { return displayMusicList; }
80 | set
81 | {
82 | displayMusicList = value;
83 | OnPropertyChanged("DisplayMusicList");
84 | }
85 | }
86 |
87 | public void ShowMusicList(bool show = true)
88 | {
89 | if (MusicList.Count>0)
90 | {
91 | DisplayMusicList = show;
92 | }
93 | else
94 | {
95 | //歌曲列表为空的时候 隐藏 歌曲列表视图
96 | DisplayMusicList = false;
97 | }
98 | }
99 | #endregion
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/ViewModel/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using DMSkin.CloudMusic.API;
2 | using DMSkin.CloudMusic.Model;
3 | using DMSkin.Core.Common;
4 | using DMSkin.Core.MVVM;
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows.Controls;
11 | using System.Windows.Media;
12 |
13 | namespace DMSkin.CloudMusic.ViewModel
14 | {
15 | public class MainWindowViewModel:ViewModelBase
16 | {
17 | #region 初始化
18 | public MainWindowViewModel()
19 | {
20 | //初始化播放器
21 | PlayManager.player = Player;
22 |
23 | //Player.Position
24 |
25 | //Player.NaturalDuration.TimeSpan.TotalSeconds
26 |
27 | Task.Run(async () =>
28 | {
29 | while (true)
30 | {
31 | //每隔900 毫秒更新 一次 播放数据
32 | await Task.Delay(900);
33 | if (PlayManager.State == PlayState.Play)
34 | {
35 | Execute.OnUIThread(()=>
36 | {
37 | //获取当前进度
38 | Position = Player.Position;
39 | if (Player.NaturalDuration.HasTimeSpan)
40 | {
41 | Duration = Player.NaturalDuration.TimeSpan;
42 | }
43 | });
44 | }
45 | }
46 | });
47 | }
48 | #endregion
49 |
50 | #region 页面切换
51 | private Page currentPage = PageManager.PageEmpty;
52 |
53 | ///
54 | /// 当前页面
55 | ///
56 | public Page CurrentPage
57 | {
58 | get { return currentPage; }
59 | set
60 | {
61 | currentPage = value;
62 | OnPropertyChanged("CurrentPage");
63 | }
64 | }
65 |
66 | private LeftMenu selectMenu;
67 | ///
68 | /// 选中的菜单
69 | ///
70 | public LeftMenu SelectMenu
71 | {
72 | get { return selectMenu; }
73 | set
74 | {
75 | selectMenu = value;
76 | switch (selectMenu)
77 | {
78 | case LeftMenu.Home:
79 | CurrentPage = PageManager.PageEmpty;
80 | break;
81 | //跳转到本地音乐
82 | case LeftMenu.LocalMusic:
83 | CurrentPage = PageManager.PageLocalMusic;
84 | break;
85 | case LeftMenu.DownLoad:
86 | CurrentPage = PageManager.PageDownLoad;
87 | break;
88 | case LeftMenu.CloudMusic:
89 | CurrentPage = PageManager.PageCloudMusic;
90 | break;
91 | case LeftMenu.Collection:
92 | CurrentPage = PageManager.PageCollection;
93 | break;
94 | }
95 | OnPropertyChanged("SelectMenu");
96 | }
97 | }
98 |
99 | #endregion
100 |
101 | #region 音乐播放器控制
102 | private MediaPlayer player =new MediaPlayer();
103 | ///
104 | /// 播放器
105 | ///
106 | public MediaPlayer Player
107 | {
108 | get {
109 |
110 | return player;
111 | }
112 | set
113 | {
114 | player = value;
115 | OnPropertyChanged("Player");
116 | }
117 | }
118 |
119 | private TimeSpan position;
120 | ///
121 | /// 播放进度
122 | ///
123 | public TimeSpan Position
124 | {
125 | get { return position; }
126 | set
127 | {
128 | position = value;
129 | OnPropertyChanged("Position");
130 | }
131 | }
132 |
133 | private TimeSpan duration;
134 |
135 | ///
136 | /// 长度
137 | ///
138 | public TimeSpan Duration
139 | {
140 | get { return duration; }
141 | set
142 | {
143 | duration = value;
144 | OnPropertyChanged("Duration");
145 | }
146 | }
147 |
148 | #endregion
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/ViewModel/PageCloudMusicViewModel.cs:
--------------------------------------------------------------------------------
1 | using DMSkin.Core.MVVM;
2 | using System;
3 | using System.Windows.Input;
4 |
5 | namespace DMSkin.CloudMusic.ViewModel
6 | {
7 | public class PageCloudMusicViewModel: MusicViewModelBase
8 | {
9 | public PageCloudMusicViewModel()
10 | {
11 | //这里添加几个 测试的云盘歌曲
12 |
13 | MusicList.Add(new Model.Music()
14 | {
15 | Album = "SoundLift s High State Mix",
16 | Title = "Summer Kisses (SoundLift s High State Mix)",
17 | Artist = "Eric de la Vega",
18 | Size = 4946933,
19 | TimeStr = "05:09",
20 | Index = "01",
21 | Url = "https://raw.githubusercontent.com/944095635/TEST/master/Eric%20de%20la%20Vega%20-%20Summer%20Kisses%20(SoundLift%20s%20High%20State%20Mix)%20Midnight%20Coast.mp3",
22 | FileName = "Summer Kisses.mp3"
23 | });
24 | MusicList.Add(new Model.Music()
25 | {
26 | Album = "变形金刚",
27 | Title = "变形金刚塞伯特传奇",
28 | Artist = "变形金刚",
29 | Size = 641184,
30 | TimeStr = "00:32",
31 | Index = "02",
32 | Url = "https://raw.githubusercontent.com/944095635/TEST/master/Transformers30secsR3.mp3",
33 | FileName = "Transformers30secsR3.mp3"
34 | });
35 |
36 | ShowMusicList();
37 | }
38 |
39 | private double cloudMaxSize = 100;
40 |
41 | ///
42 | /// 最大云盘容量
43 | ///
44 | public double CloudMaxSize
45 | {
46 | get { return cloudMaxSize; }
47 | set
48 | {
49 | cloudMaxSize = value;
50 | OnPropertyChanged("CloudMaxSize");
51 | }
52 | }
53 |
54 | private double cloudSize = 90;
55 |
56 | ///
57 | /// 云盘容量
58 | ///
59 | public double CloudSize
60 | {
61 | get { return cloudSize; }
62 | set
63 | {
64 | cloudSize = value;
65 | OnPropertyChanged("CloudSize");
66 | }
67 | }
68 |
69 |
70 |
71 | ///
72 | /// 测试增加云盘体积
73 | ///
74 | public ICommand AddSizeCommand
75 | {
76 | get
77 | {
78 | return new DelegateCommand(obj =>
79 | {
80 | CloudMaxSize +=Math.Round(new Random().NextDouble() * 10,2);
81 | });
82 | }
83 | }
84 |
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/ViewModel/PageLocalMusicViewModel.cs:
--------------------------------------------------------------------------------
1 | using DMSkin.CloudMusic.Model;
2 | using DMSkin.Core.Common;
3 | using DMSkin.Core.MVVM;
4 | using Newtonsoft.Json;
5 | using System.Collections.Generic;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Threading.Tasks;
9 | using System.Windows.Input;
10 |
11 | namespace DMSkin.CloudMusic.ViewModel
12 | {
13 | public class PageLocalMusicViewModel : MusicViewModelBase
14 | {
15 | public PageLocalMusicViewModel()
16 | {
17 | Read();
18 | }
19 |
20 | ///
21 | /// 读取配置
22 | ///
23 | public void Read()
24 | {
25 | if (File.Exists("LocalMusic.json"))
26 | {
27 | //尝试从 配置文件中读取 上次 增加的 播放列表
28 | string json = File.ReadAllText("LocalMusic.json");
29 | if (!string.IsNullOrEmpty(json))
30 | {
31 | List list = JsonConvert.DeserializeObject>(json);
32 | foreach (var item in list)
33 | {
34 | MusicList.Add(item);
35 | }
36 | //显示歌曲列表
37 | ShowMusicList();
38 | }
39 | }
40 | }
41 |
42 | ///
43 | /// 写入配置
44 | ///
45 | public void Save()
46 | {
47 |
48 | string json = JsonConvert.SerializeObject(MusicList);
49 | File.WriteAllText("LocalMusic.json", json);
50 | }
51 |
52 |
53 | ///
54 | /// 新增文件夹
55 | ///
56 | public ICommand AddFileCommand
57 | {
58 | get
59 | {
60 | return new DelegateCommand(obj =>
61 | {
62 | System.Windows.Forms.FolderBrowserDialog openFileDialog = new System.Windows.Forms.FolderBrowserDialog(); //选择文件夹
63 | if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)//注意,此处一定要手动引入System.Window.Forms空间,否则你如果使用默认的DialogResult会发现没有OK属性
64 | {
65 | //openFileDialog.SelectedPath;
66 | //查找文件夹中的数据
67 |
68 | Task.Run(() =>
69 | {
70 | string[] filelist = Directory.GetFiles(openFileDialog.SelectedPath);
71 | FindMusic(filelist.ToList());
72 | });
73 | }
74 | });
75 | }
76 | }
77 |
78 |
79 | private void FindMusic(List filelist)
80 | {
81 | int index = 1;
82 | List TempList = new List();
83 | foreach (var item in filelist)
84 | {
85 | FileInfo file = new FileInfo(item);
86 |
87 | MP3Info m = new MP3Info();
88 | m.GetMP3Info(file.DirectoryName, file.Name);
89 |
90 | if (file.Extension.Contains(".mp3"))
91 | {
92 | TempList.Add(new Music()
93 | {
94 | Title = m.trackName,
95 | Size = file.Length,
96 | Index = index.ToString(),
97 | Url = file.FullName,
98 | Album = m.Album,
99 | Artist = m.Artist,
100 | TimeStr = m.time
101 | });
102 | index++;
103 | }
104 | }
105 | if (TempList.Count > 0)
106 | {
107 | Execute.OnUIThread(() =>
108 | {
109 | foreach (var item in TempList)
110 | {
111 | if (MusicList.Where(p => p.Title == item.Title).Count() == 0)
112 | {
113 | MusicList.Add(item);
114 | }
115 | }
116 | //显示歌曲列表
117 | ShowMusicList();
118 | //保存找到的歌曲
119 | Save();
120 | });
121 | }
122 | }
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.CloudMusic/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/Common/Base64.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | namespace DMSkin.Core.Commom
5 | {
6 | public sealed class Base64
7 | {
8 | ///
9 | /// Base64加密
10 | ///
11 | /// 加密采用的编码方式
12 | /// 待加密的明文
13 | /// 返回加密的文本
14 | public static string EncodeBase64(Encoding encode, string source)
15 | {
16 | byte[] bytes = encode.GetBytes(source);
17 | try
18 | {
19 | source = Convert.ToBase64String(bytes);
20 | }
21 | catch
22 | {
23 |
24 | }
25 | return source;
26 | }
27 |
28 | ///
29 | /// Base64加密,采用utf8编码方式加密
30 | ///
31 | /// 待加密的明文
32 | /// 加密后的字符串
33 | public static string EncodeBase64(string source)
34 | {
35 | return EncodeBase64(Encoding.UTF8, source);
36 | }
37 |
38 | ///
39 | /// Base64解密
40 | ///
41 | /// 解密采用的编码方式,注意和加密时采用的方式一致
42 | /// 待解密的密文
43 | /// 解密后的字符串
44 | public static string DecodeBase64(Encoding encode, string result)
45 | {
46 | string decode = "";
47 | byte[] bytes = Convert.FromBase64String(result);
48 | try
49 | {
50 | decode = encode.GetString(bytes);
51 | }
52 | catch
53 | {
54 | decode = result;
55 | }
56 | return decode;
57 | }
58 |
59 | ///
60 | /// Base64解密,采用utf8编码方式解密
61 | ///
62 | /// 待解密的密文
63 | /// 解密后的字符串
64 | public static string DecodeBase64(string result)
65 | {
66 | return DecodeBase64(Encoding.UTF8, result);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/Common/Execute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Threading;
3 |
4 | namespace DMSkin.Core.Common
5 | {
6 | public static class Execute
7 | {
8 | private static Action executor = (action, async) => action();
9 | ///
10 | /// 初始化UI调度器
11 | ///
12 | public static void InitializeWithDispatcher()
13 | {
14 | var dispatcher = Dispatcher.CurrentDispatcher;
15 | executor = (action, async) =>
16 | {
17 | //确认是当前的线程
18 | if (dispatcher.CheckAccess())
19 | {
20 | action();
21 | }
22 | else
23 | {
24 | //异步执行
25 | if (async)
26 | {
27 | dispatcher.BeginInvoke(action);
28 | }
29 | else
30 | {
31 | dispatcher.Invoke(action);
32 | }
33 | }
34 | };
35 | }
36 |
37 | ///
38 | /// UI线程中执行方法
39 | ///
40 | public static void OnUIThread(this Action action,bool async = false)
41 | {
42 | executor(action,async);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/Common/UINT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace DMSkin.Core.Common
7 | {
8 | public class UINT
9 | {
10 | ///
11 | /// 将数据转换为
12 | ///
13 | /// 数值
14 | /// 从类型
15 | /// 到类型
16 | /// 小数点后位数
17 | public static string ToSize(UINTYPE fromtype,double size,int count = 2)
18 | {
19 | double temp = size;
20 | double mod = 1024.0;
21 | switch (fromtype)
22 | {
23 | case UINTYPE.KB:
24 | temp = size * mod;
25 | break;
26 | case UINTYPE.MB:
27 | temp = size * mod * mod;
28 | break;
29 | case UINTYPE.GB:
30 | temp = size * mod * mod * mod;
31 | break;
32 | }
33 |
34 | string[] units = new string[] { "B", "KB", "MB", "GB", "TB"};
35 | int i = 0;
36 | while (temp >= mod)
37 | {
38 | temp /= mod;
39 | i++;
40 | }
41 | return Math.Round(temp,count) + units[i];
42 | }
43 | }
44 |
45 | public enum UINTYPE
46 | {
47 | B,
48 | KB,
49 | MB,
50 | GB
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/Converters/BoolToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace DMSkin.Core.Converters
7 | {
8 | ///
9 | /// Bool 转换 为 Visibility
10 | ///
11 | public class BoolToVisibilityConverter : IValueConverter
12 | {
13 | ///
14 | /// 转换函数
15 | ///
16 | /// 只要有值就会被反转 - 相当于取反
17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | if (value is bool b && b)
20 | {
21 | return ConvertFun(Visibility.Visible, parameter);
22 | }
23 | return ConvertFun(Visibility.Collapsed, parameter);
24 | }
25 |
26 | public object ConvertFun(Visibility visibility, object parameter)
27 | {
28 | //有command参数 取反值
29 | if (parameter is string p)//取反值
30 | {
31 | if (visibility == Visibility.Visible)
32 | {
33 | return Visibility.Collapsed;
34 | }
35 | return Visibility.Visible;
36 | }
37 | return visibility;
38 | }
39 |
40 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
41 | {
42 | return value != null && value.Equals(true) ? parameter : Binding.DoNothing;
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/Converters/CompareToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows;
7 | using System.Windows.Data;
8 | using Converts = System.Convert;
9 |
10 | namespace DMSkin.Core.Converters
11 | {
12 | ///
13 | /// 比较数字大小 返回是否显示的转换器
14 | /// 例:当界面尺寸大于某个值的时候显示某些东西。
15 | ///
16 | public class CompareToVisibilityConverter : IValueConverter
17 | {
18 | ///
19 | /// 转换函数
20 | ///
21 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
22 | {
23 | try
24 | {
25 | double v1 = Converts.ToDouble(value);
26 | double v2 = Converts.ToDouble(parameter);
27 | if (v1 > v2)
28 | {
29 | return Visibility.Visible;
30 | }
31 | }
32 | catch (Exception)
33 | {
34 |
35 | }
36 | return Visibility.Collapsed;
37 | }
38 |
39 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
40 | {
41 | return Binding.DoNothing;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/Converters/EnumToBooleanConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace DMSkin.Core.Converters
6 | {
7 | public class EnumToBooleanConverter : IValueConverter
8 | {
9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10 | {
11 | if (value == null||value.ToString()!=parameter.ToString())
12 | {
13 | return false;
14 | }
15 | return true;
16 | }
17 |
18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
19 | {
20 | return value != null && value.Equals(true) ? parameter : Binding.DoNothing;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/Converters/EnumToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace DMSkin.Core.Converters
7 | {
8 | ///
9 | /// 将枚举值 转换为 是否显示
10 | ///
11 | public class EnumToVisibilityConverter : IValueConverter
12 | {
13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
14 | {
15 | if (value == null||value.ToString()!=parameter.ToString())
16 | {
17 | return Visibility.Collapsed;
18 | }
19 | return Visibility.Visible;
20 | }
21 |
22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
23 | {
24 | return value != null && value.Equals(true) ? parameter : Binding.DoNothing;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/Converters/SecondToStringConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Windows.Data;
7 |
8 | namespace DMSkin.Core.Converters
9 | {
10 | ///
11 | /// 将秒数 转换 为时间显示 00:10:00
12 | ///
13 | public class SecondToStringConverter : IValueConverter
14 | {
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | if (value is int offset)
18 | {
19 | var absOffset = Math.Abs(offset);
20 | var hour = ((absOffset / 3600)).ToString();
21 | var minute = ((absOffset - ((absOffset / 3600) * 3600)) / 60).ToString();
22 | var second = ((absOffset - ((absOffset / 3600) * 3600)) % 60).ToString();
23 | return $"{(offset >= 0 ? "" : "-")}{hour.PadLeft(2, '0')}:{minute.PadLeft(2, '0')}:{second.PadLeft(2, '0')}";
24 | }
25 | return value;
26 | }
27 |
28 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
29 | {
30 | var arr = (value as string)?.Split(':');
31 | if (arr?.Length == 2)
32 | {
33 | long hour, minute;
34 | if (Int64.TryParse(arr[0], out hour) && Int64.TryParse(arr[1], out minute))
35 | {
36 | return hour * 3600 + minute * 60;
37 | }
38 | }
39 | return value;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/Converters/TimeSpanToStringConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace DMSkin.Core.Converters
6 | {
7 | ///
8 | /// 将TimeSpan 转换为 00:00
9 | ///
10 | [ValueConversion(typeof(DateTime?), typeof(string))]
11 | public class TimeSpanToStringConverter : IValueConverter
12 | {
13 | #region Implementation of IValueConverter
14 |
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | var date = (TimeSpan)value;
18 | return date.ToString(@"mm\:ss\ ");
19 | }
20 |
21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
22 | {
23 | throw new NotSupportedException();
24 | }
25 | #endregion
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/DMSkin.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {13DA6558-356B-47B9-96F2-FE4D5457CB02}
8 | Library
9 | Properties
10 | DMSkin.Core
11 | DMSkin.Core
12 | v4.0
13 | 512
14 | true
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | false
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 | false
35 |
36 |
37 | true
38 | bin\x86\Debug\
39 | DEBUG;TRACE
40 | full
41 | x86
42 | prompt
43 | MinimumRecommendedRules.ruleset
44 | false
45 |
46 |
47 | bin\x86\Release\
48 | TRACE
49 | true
50 | pdbonly
51 | x86
52 | prompt
53 | MinimumRecommendedRules.ruleset
54 | false
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 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/DMSkin.CloudMusic/DMSkin.Core/MVVM/DelegateCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Input;
3 |
4 | namespace DMSkin.Core.MVVM
5 | {
6 | public class DelegateCommand : ICommand
7 | {
8 | private Action