Skip to content

Commit

Permalink
New Release!
Browse files Browse the repository at this point in the history
Fixed problems on Jukebox Mode. Now the app reports correctly (most) of
the front-end events.
Added playlist shuffle.
  • Loading branch information
Carlos Perez committed Jul 13, 2022
1 parent ec644ac commit b18663a
Show file tree
Hide file tree
Showing 14 changed files with 226 additions and 84 deletions.
6 changes: 3 additions & 3 deletions SonicLairXbox/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void UnregisterObserver(INotificationObserver observer)
}
}

public void NotifyObservers(string action, string value = "")
public void NotifyObservers(string action, string value = null)
{
try
{
Expand All @@ -63,9 +63,9 @@ public void NotifyObservers(string action, string value = "")
}

}
catch(Exception)
catch(Exception e)
{
Debug.WriteLine("Whoops?");
Debug.WriteLine(e.Message);
}
}

Expand Down
1 change: 1 addition & 0 deletions SonicLairXbox/Assets/Icons/shuffle-primary.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions SonicLairXbox/Assets/Icons/shuffle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 15 additions & 5 deletions SonicLairXbox/Infrastructure/ExtensionMethods.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

using Windows.Foundation;
Expand All @@ -11,6 +12,19 @@ namespace SonicLairXbox.Infrastructure
{
public static class ExtensionMethods
{
private static Random rng = new Random();
public static void Shuffle<T>(this List<T> list)
{
int n = list.Count;
while (n > 1)
{
n--;
int k = rng.Next(n + 1);
T value = list[k];
list[k] = list[n];
list[n] = value;
}
}
public static ScrollViewer GetScrollViewer(this DependencyObject element)
{
if (element is ScrollViewer)
Expand All @@ -23,11 +37,7 @@ public static ScrollViewer GetScrollViewer(this DependencyObject element)
var child = VisualTreeHelper.GetChild(element, i);

var result = GetScrollViewer(child);
if (result == null)
{
continue;
}
else
if (result != null)
{
return result;
}
Expand Down
35 changes: 24 additions & 11 deletions SonicLairXbox/Layout.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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:local="using:SonicLairXbox"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{StaticResource BackgroundColor}"
mc:Ignorable="d">
Expand Down Expand Up @@ -42,10 +41,13 @@
Grid.Column="2"
HorizontalAlignment="Right"
Source="/Assets/Icons/smartphone.svg"
Visibility="{x:Bind Model.Connected}" />
Visibility="{x:Bind Model.Connected, Mode=OneWay}" />
</Grid>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Grid Name="gr_menu" Margin="0,0,20,20">
<Grid
Name="gr_menu"
Margin="0,0,20,20"
Padding="15">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
Expand All @@ -67,6 +69,7 @@
<StackPanel
Height="40"
Margin="0,10,0,10"
Padding="0,0,10,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Image
Expand All @@ -76,7 +79,8 @@
<TextBlock
VerticalAlignment="Center"
FontSize="30"
FontWeight="Thin">
FontWeight="Thin"
Visibility="{x:Bind Model.SidebarFocused, Mode=OneWay}">
Home
</TextBlock>
</StackPanel>
Expand All @@ -93,6 +97,7 @@
<StackPanel
Height="40"
Margin="0,10,0,10"
Padding="0,0,10,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Image
Expand All @@ -102,7 +107,8 @@
<TextBlock
VerticalAlignment="Center"
FontSize="30"
FontWeight="Thin">
FontWeight="Thin"
Visibility="{x:Bind Model.SidebarFocused, Mode=OneWay}">
Search
</TextBlock>
</StackPanel>
Expand All @@ -119,6 +125,7 @@
<StackPanel
Height="40"
Margin="0,10,0,10"
Padding="0,0,10,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Image
Expand All @@ -128,7 +135,8 @@
<TextBlock
VerticalAlignment="Center"
FontSize="30"
FontWeight="Thin">
FontWeight="Thin"
Visibility="{x:Bind Model.SidebarFocused, Mode=OneWay}">
Playlists
</TextBlock>
</StackPanel>
Expand All @@ -145,6 +153,7 @@
<StackPanel
Height="40"
Margin="0,10,0,10"
Padding="0,0,10,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Image
Expand All @@ -154,7 +163,8 @@
<TextBlock
VerticalAlignment="Center"
FontSize="30"
FontWeight="Thin">
FontWeight="Thin"
Visibility="{x:Bind Model.SidebarFocused, Mode=OneWay}">
Account
</TextBlock>
</StackPanel>
Expand All @@ -171,6 +181,7 @@
<StackPanel
Height="40"
Margin="0,10,0,10"
Padding="0,0,10,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Image
Expand All @@ -180,7 +191,8 @@
<TextBlock
VerticalAlignment="Center"
FontSize="30"
FontWeight="Thin">
FontWeight="Thin"
Visibility="{x:Bind Model.SidebarFocused, Mode=OneWay}">
Jukebox
</TextBlock>
</StackPanel>
Expand All @@ -197,6 +209,7 @@
<StackPanel
Height="40"
Margin="0,10,0,10"
Padding="0,0,10,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Image
Expand All @@ -206,7 +219,8 @@
<TextBlock
VerticalAlignment="Center"
FontSize="30"
FontWeight="Thin">
FontWeight="Thin"
Visibility="{x:Bind Model.SidebarFocused, Mode=OneWay}">
Playing
</TextBlock>
</StackPanel>
Expand All @@ -220,6 +234,5 @@
Width="{x:Bind Model.Width, Mode=OneWay}"
Height="{x:Bind Model.Height, Mode=OneWay}" />
</StackPanel>

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

0 comments on commit b18663a

Please sign in to comment.