-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from maxinglo/develop
[WIP] [Feat] 完善PlayListPage
- Loading branch information
Showing
13 changed files
with
416 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/HyPlayer.App/ViewModels/Converters/ArtistListToStringConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Microsoft.UI.Xaml.Media; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using HyPlayer.NeteaseProvider.Models; | ||
using Microsoft.UI.Xaml.Data; | ||
using HyPlayer.PlayCore.Abstraction.Models.Containers; | ||
|
||
namespace HyPlayer.ViewModels.Converters | ||
{ | ||
internal class ArtistListToStringConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, string language) | ||
{ | ||
if (value is List<PersonBase> artistList) | ||
{ | ||
return string.Join("、", artistList.Select(t => t.Name)); | ||
} | ||
return string.Empty; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/HyPlayer.App/ViewModels/Converters/BoolToStringConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Microsoft.UI.Xaml.Data; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace HyPlayer.ViewModels.Converters | ||
{ | ||
public class BoolToStringConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, string language) | ||
{ | ||
var texts = ((string)parameter).Split('|'); | ||
return (bool)value ? texts[1] : texts[0]; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/HyPlayer.App/ViewModels/Converters/TimeStampToDateConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Microsoft.UI.Xaml.Data; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace HyPlayer.ViewModels.Converters | ||
{ | ||
class TimeStampToDateConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, | ||
object parameter, string language) | ||
{ | ||
if (value is not long timeStamp) return null; | ||
var localDateTime = (new DateTime(1970, 1, 1).AddMilliseconds(timeStamp)).ToLocalTime(); | ||
var now = DateTime.Now; | ||
var timeSpan = now - localDateTime; | ||
if (timeSpan.TotalDays <= 1) | ||
{ | ||
if (timeSpan.TotalHours >= 1) | ||
{ | ||
return $"{(int)timeSpan.TotalHours} 小时之前"; | ||
}if (timeSpan.TotalMinutes >= 1) | ||
{ | ||
return $"{(int)timeSpan.TotalMinutes} 分钟之前"; | ||
} | ||
{ | ||
return "刚刚"; | ||
} | ||
} | ||
else | ||
{ | ||
return localDateTime.ToString("yyyy-MM-dd"); | ||
} | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, | ||
object parameter, string language) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.