Skip to content

Commit

Permalink
CoreChanged: 补充艺术家分割功能
Browse files Browse the repository at this point in the history
  • Loading branch information
Miaoyww committed Aug 28, 2024
1 parent 5c4da9e commit 22652c4
Show file tree
Hide file tree
Showing 8 changed files with 643 additions and 0 deletions.
12 changes: 12 additions & 0 deletions NonsPlayer.Core/Contracts/Managers/IConfigManagers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using ATL;
using NonsPlayer.Core.Resources;
using System.Text.Json;
using System.Text;

namespace NonsPlayer.Core.Contracts.Managers;

public interface IConfigManager
{
void Load();
void Save();
}
1 change: 1 addition & 0 deletions NonsPlayer.Core/Models/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

55 changes: 55 additions & 0 deletions NonsPlayer/Dialogs/ArtistSeparator.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<Page
x:Class="NonsPlayer.Dialogs.ArtistSeparator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dialogs="using:NonsPlayer.Dialogs"
mc:Ignorable="d"
Width="500">
<Page.Resources>
<DataTemplate x:Name="SepTemplate" x:DataType="dialogs:SeparatorModel">
<Grid Width="150" VerticalAlignment="Center">
<TextBox Text="{x:Bind Text, Mode=TwoWay}"
BorderThickness="0"
Margin="0,0,20,0"
FontSize="22"
HorizontalAlignment="Left" />
<Button Command="{x:Bind Command}"
CommandParameter="{x:Bind Text, Mode=OneWay}"
HorizontalAlignment="Right"
Padding="10,5,10,5">
<FontIcon Glyph="&#xE738;" FontSize="14" />
</Button>
</Grid>
</DataTemplate>
</Page.Resources>
<Grid>

<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="0,0,0,10">
<Grid Margin="0,0,10,0"
HorizontalAlignment="Left">
<GridView
x:Name="SeparatorViews"
SelectionMode="None"
ItemTemplate="{StaticResource SepTemplate}"
ItemsSource="{x:Bind Models,Mode=OneWay}">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid MaximumRowsOrColumns="1"
Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</Grid>
</Grid>
<Grid Grid.Row="1">
<Button x:Name="AddNewButton"
Command="{x:Bind AddCommand}" />
</Grid>
</Grid>
</Page>
63 changes: 63 additions & 0 deletions NonsPlayer/Dialogs/ArtistSeparator.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using NonsPlayer.Core.Services;
using NonsPlayer.Helpers;
using System.Collections.ObjectModel;

namespace NonsPlayer.Dialogs;

[INotifyPropertyChanged]
public sealed partial class ArtistSeparator : Page
{
public ObservableCollection<SeparatorModel> Models = new();

public ArtistSeparator()
{
InitializeComponent();
Init();
AddNewButton.Content = "AddNew".GetLocalized();
this.Tag = Models;
}

private void Init()
{
Models.Clear();
foreach (string s in ConfigManager.Instance.Settings.LocalArtistSep)
{
Models.Add(new SeparatorModel { Text = s, Command = DelSepCommand });
}
}

[RelayCommand]
public void DelSep(string content)
{
var itemsToRemove = new List<SeparatorModel>();
foreach (SeparatorModel separatorModel in Models)
{
if (separatorModel.Text.Equals(content))
{
itemsToRemove.Add(separatorModel);
}
}

foreach (var item in itemsToRemove)
{
Models.Remove(item);
}
}

[RelayCommand]
public void Add()
{
Models.Add(new SeparatorModel { Command = DelSepCommand });
}
}

[INotifyPropertyChanged]
public partial class SeparatorModel
{
[ObservableProperty] private string text;
public IRelayCommand Command;
}
220 changes: 220 additions & 0 deletions NonsPlayer/Dialogs/LocalProperties.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
<Page
x:Class="NonsPlayer.Dialogs.LocalProperties"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:converters="using:NonsPlayer.Converters"
mc:Ignorable="d"
Width="500">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="0,0,0,30">
<Grid Margin="0,0,10,0"
HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="TitleTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.9" />
<TextBox Grid.Row="1"
Width="220"
FontSize="14"
Text="{x:Bind Title, Mode=TwoWay}" />
</Grid>
<Grid HorizontalAlignment="Right"
Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="ArtistTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.8" />
<TextBox Grid.Row="1"
Width="220"
Text="{x:Bind Artist, Mode=TwoWay}" />
</Grid>
</Grid>
<Grid Grid.Row="1" Margin="0,0,0,10">
<Grid Margin="0,0,10,0"
HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="AlbumTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.9" />
<TextBox Grid.Row="1"
Width="220"
FontSize="14"
Text="{x:Bind Album, Mode=TwoWay}" />
</Grid>
<Grid HorizontalAlignment="Right"
Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="AlbumArtistsTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.8" />
<TextBox Grid.Row="1"
Text="{x:Bind AlbumArtists, Mode=TwoWay}"
Width="220" />
</Grid>
</Grid>
<Grid Grid.Row="2" Margin="0,0,0,10">
<Grid Margin="0,0,10,0"
HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="TrackNumberTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.9" />
<NumberBox Grid.Row="1"
Width="220"
FontSize="14"
PreviewKeyDown="OnPreviewKeyDown"
Text="{x:Bind TrackNumber, Mode=TwoWay}" />
</Grid>
<Grid HorizontalAlignment="Right"
Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="GenreTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.8" />
<TextBox Grid.Row="1"
Text="{x:Bind Genre, Mode=TwoWay}"
Width="220" />
</Grid>
</Grid>
<Grid Grid.Row="3" Margin="0,0,0,10">
<Grid Margin="0,0,10,0"
HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="DateTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.9" />
<NumberBox Grid.Row="1"
Width="220"
FontSize="14"
PreviewKeyDown="OnPreviewKeyDown"
Text="{x:Bind Date, Mode=TwoWay}" />
</Grid>
<Grid HorizontalAlignment="Right"
Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="DurationTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.8" />
<TextBlock Grid.Row="1"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Text="{x:Bind Duration, Mode=OneWay}"
Width="220" />
</Grid>
</Grid>
<Grid Grid.Row="4" Margin="0,0,0,10">
<Grid Margin="0,0,10,0"
HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="BitRateTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.9" />
<TextBlock Grid.Row="1"
Style="{StaticResource CommonTextStyle}"
Width="220"
FontSize="14"
Text="{x:Bind BitRate, Mode=OneWay}" />
</Grid>
<Grid HorizontalAlignment="Right"
Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="CodecTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.8" />
<TextBlock Grid.Row="1"
Style="{StaticResource CommonTextStyle}"
Text="{x:Bind Codec, Mode=OneWay}"
FontSize="14"
Width="220" />
</Grid>
</Grid>
<Grid Grid.Row="5" Margin="0,0,0,10">
<Grid Margin="0,0,10,0"
HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="FileSizeTextBlock"
Style="{StaticResource CommonTextStyle}"
FontSize="14"
Opacity="0.9" />
<TextBlock Grid.Row="1"
Style="{StaticResource CommonTextStyle}"
Width="220"
FontSize="14"
Text="{x:Bind FileSize, Mode=OneWay}" />
</Grid>
</Grid>
<Grid Grid.Row="6" Margin="0,20,0,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
x:Name="FilePathTextBlock"
Text="File Path"
Style="{StaticResource CommonTextStyle}"
FontSize="14" />
<HyperlinkButton Grid.Row="1"
Content="{x:Bind FilePath, Mode=OneWay}"
Padding="0"
Command="{x:Bind OpenFilePathCommand}"/>

</Grid>
</Grid>
</Grid>
</Page>
Loading

0 comments on commit 22652c4

Please sign in to comment.