-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
343 additions
and
4 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
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,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<UserControl | ||
x:Class="VK_UI3.Controls.Blocks.ListPlaylists" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:VK_UI3.Controls.Blocks" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:custom="using:VK_UI3.Controls" | ||
Margin="10" | ||
mc:Ignorable="d"> | ||
<UserControl.Resources> | ||
|
||
</UserControl.Resources> | ||
<UserControl.Shadow> | ||
<ThemeShadow /> | ||
</UserControl.Shadow> | ||
|
||
<Grid Height="Auto" x:Name="gridCh"> | ||
<GridView ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.HorizontalScrollMode="Enabled" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible" x:Name="gridV" SelectionMode="None" ItemsSource="{x:Bind playlists, Mode=OneWay}"> | ||
<GridView.ItemsPanel> | ||
<ItemsPanelTemplate> | ||
<ItemsWrapGrid Orientation="Vertical" MaximumRowsOrColumns="1" /> | ||
</ItemsPanelTemplate> | ||
</GridView.ItemsPanel> | ||
<GridView.ItemTemplate> | ||
<DataTemplate> | ||
<custom:PlaylistControl | ||
x:Name="trControl" | ||
FocusVisualPrimaryBrush="Transparent" | ||
FocusVisualSecondaryThickness="0" | ||
></custom:PlaylistControl> | ||
</DataTemplate> | ||
</GridView.ItemTemplate> | ||
</GridView> | ||
</Grid> | ||
</UserControl> |
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,58 @@ | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Controls.Primitives; | ||
using Microsoft.UI.Xaml.Data; | ||
using Microsoft.UI.Xaml.Input; | ||
using Microsoft.UI.Xaml.Media; | ||
using Microsoft.UI.Xaml.Navigation; | ||
using MusicX.Core.Models; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using VK_UI3.Helpers; | ||
using VK_UI3.VKs; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
|
||
// To learn more about WinUI, the WinUI project structure, | ||
// and more about our project templates, see: http://aka.ms/winui-project-info. | ||
|
||
namespace VK_UI3.Controls.Blocks | ||
{ | ||
public sealed partial class ListPlaylists : UserControl | ||
{ | ||
public ListPlaylists() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
DataContextChanged += RecommsPlaylistBlock_DataContextChanged; | ||
} | ||
ObservableCollection<Playlist> playlists = new(); | ||
|
||
private void RecommsPlaylistBlock_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) | ||
{ | ||
try | ||
{ | ||
if (DataContext is not Block block) | ||
return; | ||
|
||
var pl = (DataContext as Block).Playlists; | ||
|
||
|
||
foreach (var item in pl) | ||
{ | ||
playlists.Add(item); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
AppCenterHelper.SendCrash(ex); | ||
|
||
|
||
} | ||
} | ||
} | ||
} |
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,88 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<UserControl CornerRadius="8" | ||
|
||
PointerEntered="UserControl_PointerEntered" | ||
PointerExited="UserControl_PointerExited" | ||
PointerPressed="UserControl_PointerPressed" | ||
x:Class="VK_UI3.Controls.PlaylistControl" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:VK_UI3.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
Width="200" | ||
|
||
Height="250" | ||
mc:Ignorable="d"> | ||
|
||
<UserControl.ContextFlyout> | ||
<MenuFlyout x:Name="flyOutm"> | ||
<MenuFlyoutItem x:Name="AddRemove" Text="Добавить к себе" Click="AddRemove_Click" Icon="Add" /> | ||
|
||
</MenuFlyout> | ||
</UserControl.ContextFlyout> | ||
|
||
|
||
<UserControl.Shadow> | ||
<ThemeShadow /> | ||
</UserControl.Shadow> | ||
<StackPanel Padding="10" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" | ||
> | ||
|
||
<Grid Width="180" Height="180" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" CornerRadius="8"> | ||
<Grid.Resources> | ||
<!-- Анимация прозрачности от 0 до 1 --> | ||
<Storyboard x:Name="FadeInAnimationGridPlayIcon"> | ||
<DoubleAnimation Storyboard.TargetName="btnGrid" | ||
Storyboard.TargetProperty="Opacity" | ||
To="1" Duration="0:0:0.25"/> | ||
</Storyboard> | ||
<!-- Анимация прозрачности от 1 до 0 --> | ||
<Storyboard x:Name="FadeOutAnimationGridPlayIcon"> | ||
<DoubleAnimation Storyboard.TargetName="btnGrid" | ||
Storyboard.TargetProperty="Opacity" | ||
To="0" Duration="0:0:0.25"/> | ||
</Storyboard> | ||
</Grid.Resources> | ||
|
||
|
||
<Image x:Name="Cover" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="UniformToFill" /> | ||
|
||
|
||
<Grid Padding="10"> | ||
|
||
|
||
<SymbolIcon Symbol="List" VerticalAlignment="Bottom" HorizontalAlignment="Left" | ||
Width="24" Height="24" | ||
/> | ||
<Grid Opacity="0" x:Name="btnGrid" Width="50" CornerRadius="100" Height="50" Background="{ThemeResource SystemControlBackgroundAltMediumHighBrush}" VerticalAlignment="Bottom" HorizontalAlignment="Right"> | ||
<Button Click="Button_Click" Translation="0,0,24" Opacity="1" Width="50" CornerRadius="50" Height="50" HorizontalAlignment="Center" VerticalAlignment="Center" > | ||
<FontIcon x:Name="PlayPause" Glyph="" | ||
|
||
|
||
|
||
HorizontalAlignment="Center" VerticalAlignment="Center" | ||
/> | ||
</Button> | ||
</Grid> | ||
</Grid> | ||
|
||
|
||
|
||
|
||
</Grid> | ||
<StackPanel Orientation="Vertical" HorizontalAlignment="Left"> | ||
<TextBlock x:Name="Title" TextWrapping="Wrap" | ||
FontSize="14" | ||
|
||
FontFamily="{StaticResource VKSansMedium}" | ||
Margin="0,8,0,4"/> | ||
<TextBlock x:Name="Subtitle" TextWrapping="Wrap" | ||
Opacity="0.6" | ||
FontSize="12" | ||
|
||
FontFamily="{StaticResource VKSansRegular}" /> | ||
</StackPanel> | ||
</StackPanel> | ||
</UserControl> |
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,133 @@ | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Input; | ||
using MusicX.Core.Models; | ||
using System; | ||
using VK_UI3.Controllers; | ||
using VK_UI3.DB; | ||
using VK_UI3.Helpers.Animations; | ||
using VK_UI3.Views; | ||
using VK_UI3.VKs; | ||
using VK_UI3.VKs.IVK; | ||
using Windows.Media.Playlists; | ||
using Playlist = MusicX.Core.Models.Playlist; | ||
|
||
// To learn more about WinUI, the WinUI project structure, | ||
// and more about our project templates, see: http://aka.ms/winui-project-info. | ||
|
||
namespace VK_UI3.Controls | ||
{ | ||
public sealed partial class PlaylistControl : UserControl | ||
{ | ||
public PlaylistControl() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
AnimationsChangeFontIcon = new AnimationsChangeFontIcon(PlayPause, this.DispatcherQueue); | ||
animationsChangeImage = new AnimationsChangeImage(Cover, this.DispatcherQueue); | ||
|
||
DataContextChanged += RecommsPlaylist_DataContextChanged; | ||
|
||
this.Loading += RecommsPlaylist_Loading; | ||
} | ||
|
||
|
||
public void AddRemove_Click(object sender, RoutedEventArgs e) | ||
{ | ||
|
||
|
||
} | ||
|
||
private void RecommsPlaylist_Loading(FrameworkElement sender, object args) | ||
{ | ||
|
||
} | ||
AnimationsChangeFontIcon AnimationsChangeFontIcon; | ||
AnimationsChangeImage animationsChangeImage; | ||
|
||
MusicX.Core.Models.Playlist _PlayList { get; set; } | ||
private void RecommsPlaylist_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) | ||
{ | ||
if (DataContext == null) return; | ||
var Data = DataContext; | ||
|
||
|
||
AnimationsChangeFontIcon.ChangeFontIconWithAnimation("\uF5B0"); | ||
animationsChangeImage.ChangeImageWithAnimation((DataContext as Playlist).Cover); | ||
if ((DataContext as Playlist).MainArtists != null && (DataContext as Playlist).MainArtists.Count != 0) | ||
Subtitle.Text = (DataContext as Playlist).MainArtists[0].Name; | ||
Title.Text = (DataContext as Playlist).Title; | ||
_PlayList = (DataContext as Playlist); | ||
} | ||
bool entered; | ||
private void UserControl_PointerEntered(object sender, PointerRoutedEventArgs e) | ||
{ | ||
entered = true; | ||
|
||
// Symbol symbol = dataTrack.PlayThis ? Symbol.Pause : Symbol.Play; | ||
/* | ||
if (GridPlayIcon.Opacity != 0) | ||
{ | ||
changeIconPlayBTN.ChangeSymbolIconWithAnimation(symbol); | ||
} | ||
else | ||
{ | ||
PlayBTN.Symbol = symbol; | ||
} | ||
*/ | ||
|
||
FadeOutAnimationGridPlayIcon.Pause(); | ||
FadeInAnimationGridPlayIcon.Begin(); | ||
} | ||
|
||
private void UserControl_PointerExited(object sender, PointerRoutedEventArgs e) | ||
{ | ||
FadeInAnimationGridPlayIcon.Pause(); | ||
FadeOutAnimationGridPlayIcon.Begin(); | ||
|
||
} | ||
|
||
private void UserControl_PointerPressed(object sender, PointerRoutedEventArgs e) | ||
{ | ||
if (e.GetCurrentPoint(sender as UIElement).Properties.IsLeftButtonPressed) | ||
{ | ||
if (iVKGetAudio == null) | ||
MainView.OpenPlayList(_PlayList); | ||
else | ||
{ | ||
MainView.OpenPlayList(iVKGetAudio); | ||
} | ||
} | ||
} | ||
|
||
|
||
IVKGetAudio iVKGetAudio = null; | ||
|
||
private void Button_Click(object sender, RoutedEventArgs e) | ||
{ | ||
AnimationsChangeFontIcon.ChangeFontIconWithAnimation("\uE916"); | ||
iVKGetAudio = new PlayListVK(_PlayList, this.DispatcherQueue); | ||
|
||
|
||
|
||
EventHandler handler = null; | ||
handler = (sender, e) => { | ||
this.DispatcherQueue.TryEnqueue(async () => | ||
{ | ||
if (iVKGetAudio.listAudio.Count == 0) | ||
{ | ||
AnimationsChangeFontIcon.ChangeFontIconWithAnimation("\uF5B0"); | ||
return; | ||
} | ||
|
||
iVKGetAudio.currentTrack = 0; | ||
AudioPlayer.PlayList(iVKGetAudio); | ||
AnimationsChangeFontIcon.ChangeFontIconWithAnimation("\uE769"); | ||
// Îòñîåäèíèòü îáðàáîò÷èê ñîáûòèé ïîñëå âûïîëíåíèÿ Navigate | ||
iVKGetAudio.onListUpdate -= handler; | ||
}); | ||
}; | ||
iVKGetAudio.onListUpdate += handler; | ||
} | ||
} | ||
} |
Oops, something went wrong.