Skip to content

Commit

Permalink
Исправил отображениек треков.
Browse files Browse the repository at this point in the history
Изменил дизайн слайдера звука.
Исправил другие некоторые ошибки.
  • Loading branch information
MaKrotos committed Nov 30, 2024
1 parent 25bd0db commit 598c191
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 78 deletions.
2 changes: 1 addition & 1 deletion VK UI3 (Package)/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<Identity
Name="FDW.VKM"
Publisher="CN=FDW"
Version="0.2.1.1" />
Version="0.2.1.2" />

<mp:PhoneIdentity PhoneProductId="b7c1f34e-9025-4935-9d7a-7d0a632a368d" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
83 changes: 25 additions & 58 deletions VK UI3/Controllers/AudioPlayer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,63 +147,27 @@
Background="Transparent">
<FontIcon FontSize="14" Glyph="&#xE995;" />
<Button.Flyout>
<Flyout>
<Slider
x:Name="SoundSlider"
Grid.Column="2"
Width="150"
VerticalAlignment="Center"
Minimum="0"
Orientation="Horizontal"
PointerEntered="SoundSlider_PointerEntered"
PointerExited="SoundSlider_PointerExited"
StepFrequency="1"
ValueChanged="SoundSlider_ValueChanged"
Value="{x:Bind simpleAudioBind, Mode=TwoWay}">
<Slider.Template>
<ControlTemplate TargetType="Slider">
<Grid>
<VisualStateManager.VisualStateGroups>
<!-- Оставьте эту часть без изменений, чтобы сохранить оригинальное поведение слайдера -->
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid
Height="4"
Background="{TemplateBinding Background}"
CornerRadius="2" />
<Grid x:Name="HorizontalTemplate" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid
x:Name="HorizontalTrack"
Height="4"
Margin="0,0,-10,0"
Background="{TemplateBinding Foreground}"
CornerRadius="2" />
<Rectangle
x:Name="HorizontalDecreaseRect"
Height="4"
Fill="Transparent" />
<Thumb
x:Name="HorizontalThumb"
Grid.Column="1"
Width="10"
Height="10"
Background="Transparent"
CornerRadius="10">
<ToolTipService.ToolTip>
<ToolTip Content="{TemplateBinding Value}" />
</ToolTipService.ToolTip>
</Thumb>
</Grid>
</Grid>
</Grid>
</ControlTemplate>
</Slider.Template>
</Slider>
<Flyout >
<Grid Margin="-15" Height="27">
<Slider

Margin="10,-1,10,0"
x:Name="SoundSlider"
Grid.Column="2"
Width="150"
VerticalAlignment="Top"
Minimum="0"
Background="AliceBlue"
Orientation="Horizontal"
PointerEntered="SoundSlider_PointerEntered"
PointerExited="SoundSlider_PointerExited"
StepFrequency="1"
ValueChanged="SoundSlider_ValueChanged"
Value="{x:Bind simpleAudioBind, Mode=TwoWay}">


</Slider>
</Grid>
</Flyout>
</Button.Flyout>

Expand Down Expand Up @@ -246,6 +210,7 @@
x:Name="VolumeSlider"
Grid.Column="1"
Margin="8,0,8,0"

HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Maximum="{x:Bind TrackDuration, Mode=TwoWay}"
Expand All @@ -255,7 +220,9 @@
StepFrequency="1"
ThumbToolTipValueConverter="{StaticResource SecondsToTimeConverter}"
ValueChanged="VolumeSlider_ValueChanged"
Value="{x:Bind TrackPosition, Mode=TwoWay}" />
Value="{x:Bind TrackPosition, Mode=TwoWay}" >

</Slider>
<TextBlock
Grid.Column="2"
VerticalAlignment="Center"
Expand Down
2 changes: 1 addition & 1 deletion VK UI3/Controllers/AudioPlayer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ private void PlaybackSession_BufferedRangesChanged(MediaPlaybackSession sender,
var a = (int)Math.Round(sender.NaturalDuration.TotalSeconds);
var b = TrackDataThis.audio.Duration;

if (Math.Abs(a - b) > 3)
if (Math.Abs(a - b) > 5)
{
PlayTrack();
}
Expand Down
14 changes: 9 additions & 5 deletions VK UI3/Controls/LinksController.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private void PlaylistControl_Unloaded(object sender, RoutedEventArgs e)

private async void Grid_PointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
{

try
{
if (link.Meta.ContentType == null)
Expand Down Expand Up @@ -218,11 +218,15 @@ private async void Grid_PointerPressed(object sender, Microsoft.UI.Xaml.Input.Po
}
catch (Exception ex)
{
Process.Start(new ProcessStartInfo
try
{
FileName = link.Url,
UseShellExecute = true
});
Process.Start(new ProcessStartInfo
{
FileName = link.Url,
UseShellExecute = true
});
}
catch { }
}
}

Expand Down
17 changes: 12 additions & 5 deletions VK UI3/Controls/TrackControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,19 @@ private void TrackControl_DataContextChanged(FrameworkElement sender, DataContex

dataTrack = (DataContext as ExtendedAudio);
string? newLink = "";
if (dataTrack.audio.Album != null && dataTrack.audio.Album.Thumb != null)
if (dataTrack.audio.Thumb != null)
{
newLink =
dataTrack.audio.Thumb.Photo270 ??
dataTrack.audio.Thumb.Photo300 ??
dataTrack.audio.Thumb.Photo600 ??
dataTrack.audio.Thumb.Photo34 ??
"";
}


if (dataTrack.audio.Album != null && dataTrack.audio.Album.Thumb != null && newLink.Equals(""))
newLink =
dataTrack.audio.Thumb.Photo270 ??
dataTrack.audio.Thumb.Photo300 ??
dataTrack.audio.Thumb.Photo600 ??
dataTrack.audio.Thumb.Photo34 ??

dataTrack.audio.Album.Thumb.Photo270 ??
dataTrack.audio.Album.Thumb.Photo300 ??
Expand Down
2 changes: 1 addition & 1 deletion VkNet/Model/Attachments/Audio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public class Audio : MediaAttachment, IGroupUpdate
public AudioChartInfo AudioChartInfo { get; set; }

[JsonProperty("thumb")]
public AudioCover Thumb { get; set; }
public AudioCover? Thumb { get; set; }



Expand Down
14 changes: 7 additions & 7 deletions VkNet/Model/Audio/AudioCover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,43 @@ public class AudioCover
/// Uri обложки с максимальным размером 34x34.
/// </summary>
[JsonProperty("photo_34")]
public string Photo34 { get; set; }
public string? Photo34 { get; set; }

/// <summary>
/// Uri обложки с максимальным размером 68x68.
/// </summary>
[JsonProperty("photo_68")]
public string Photo68 { get; set; }
public string? Photo68 { get; set; }

/// <summary>
/// Uri обложки с максимальным размером 135x135.
/// </summary>
[JsonProperty("photo_135")]
public string Photo135 { get; set; }
public string? Photo135 { get; set; }

/// <summary>
/// Uri обложки с максимальным размером 270x270.
/// </summary>
[JsonProperty("photo_270")]
public string Photo270 { get; set; }
public string? Photo270 { get; set; }

/// <summary>
/// Uri обложки с максимальным размером 300x300.
/// </summary>
[JsonProperty("photo_300")]
public string Photo300 { get; set; }
public string? Photo300 { get; set; }

/// <summary>
/// Uri обложки с максимальным размером 600x600.
/// </summary>
[JsonProperty("photo_600")]
public string Photo600 { get; set; }
public string? Photo600 { get; set; }

/// <summary>
/// Uri обложки с максимальным размером 1200x1200.
/// </summary>
[JsonProperty("photo_1200")]
public string Photo1200 { get; set; }
public string? Photo1200 { get; set; }

/// <summary>
/// Ширина изображения обложки.
Expand Down

0 comments on commit 598c191

Please sign in to comment.