Skip to content

Commit

Permalink
Three main things;
Browse files Browse the repository at this point in the history
* Started adding a customisation window, which pops out with the arrow on the right.
* Fixed a bug or two; mainly to do with how we get the latest track.
* Added a logo!
  • Loading branch information
KieranBond committed Jul 9, 2019
1 parent 8414624 commit 23c93be
Show file tree
Hide file tree
Showing 14 changed files with 226 additions and 35 deletions.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions MiniSpotify/MiniSpotify/EditorWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Window x:Class="MiniSpotify.EditorWindow"
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:local="clr-namespace:MiniSpotify"
mc:Ignorable="d"
Title="Mini-Viewer" Height="110" Width="100"
ResizeMode="NoResize" Topmost="True" BorderBrush="#232322"
Background="#232322" FontFamily="Lato" WindowStyle="None">
<Grid>

</Grid>
</Window>
27 changes: 27 additions & 0 deletions MiniSpotify/MiniSpotify/EditorWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MiniSpotify
{
/// <summary>
/// Interaction logic for EditorWindow.xaml
/// </summary>
public partial class EditorWindow : Window
{
public EditorWindow()
{
InitializeComponent();
}
}
}
11 changes: 9 additions & 2 deletions MiniSpotify/MiniSpotify/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<BitmapImage UriSource=""/>
</Image.Source>
</Image>
<TextBlock Name="TitleText" Margin="92,0,10,61" FontFamily="Lato" FontSize="18" Foreground="White"></TextBlock>
<TextBlock Name="TitleText" Margin="92,0,15,61" FontFamily="Lato" FontSize="18" Foreground="White"></TextBlock>
<ProgressBar Name="SongProgress" Value="0" Width="400" Height="10" Margin="0,84,0,0" Background="#5b5b5b" Foreground="#e2d647" BorderThickness="0"/>
<Button Name="PlaybackButton"
BorderBrush="Black" BorderThickness="0"
Expand Down Expand Up @@ -93,7 +93,14 @@
<ImageBrush ImageSource="Assets/Images/Icons/pause-icon.png" Stretch="Uniform"/>
</Button.Background>
</Button>
<TextBlock Name="ArtistText" Margin="92,20,10,42" FontFamily="Lato Light" Foreground="White" FontSize="14"></TextBlock>
<TextBlock Name="ArtistText" Margin="92,20,15,42" FontFamily="Lato Light" Foreground="White" FontSize="14"></TextBlock>
<Button x:Name="EditorButton"
BorderBrush="Black" BorderThickness="0"
Click="OnClickEditorButton" ClickMode="Press" HorizontalAlignment="Right" Width="5" Height="15" VerticalAlignment="Top" Margin="0,29,5,0">
<Button.Background>
<ImageBrush ImageSource="Assets/Images/Icons/play-icon.png" Stretch="Uniform"/>
</Button.Background>
</Button>
</Grid>
</DockPanel>
</Window>
43 changes: 42 additions & 1 deletion MiniSpotify/MiniSpotify/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,32 @@ public partial class MainWindow : Window
{
private bool m_pinnedToTop = true;

private bool m_editWindowOpen = false;
private double m_editWindowGap = 10;
EditorWindow editWindow;

public MainWindow()
{
InitializeComponent();

editWindow = new EditorWindow();
editWindow.Hide();

APIRequestor.Instance.m_onSongChanged += OnSongChanged;
APIRequestor.Instance.m_onAuthComplete += UpdateUI;
APIRequestor.Instance.m_onAPIPolled += UpdateProgressBar;
APIRequestor.Instance.m_onAPIPolled += UpdateUI;

LocationChanged += UpdateEditWindowPosition;
}

public void UpdateUI(FullTrack a_latestTrack = null)
{
bool playing = APIRequestor.Instance.GetIsPlaying();
UpdatePlayIcon(playing);

float progress = APIRequestor.Instance.GetLatestSongProgress();
UpdateProgressBar(progress);

string artworkURL = APIRequestor.Instance.GetCurrentSongArtwork();
if (string.IsNullOrEmpty(artworkURL))
{
Expand Down Expand Up @@ -114,6 +126,26 @@ public void OnClickPreviousSong(object a_sender, RoutedEventArgs a_args)
{
APIRequestor.Instance.SkipSongPlayback(false);
}

public void OnClickEditorButton(object a_sender, RoutedEventArgs a_args)
{
m_editWindowOpen = !m_editWindowOpen;

if(m_editWindowOpen)
{
editWindow.Show();
double mainWidth = RootWindow.ActualWidth;
double editWindowX = Application.Current.MainWindow.Left + mainWidth;
double editWindowY = Application.Current.MainWindow.Top;
editWindow.Top = editWindowY;
editWindow.Left = editWindowX + m_editWindowGap;
}
else
{
editWindow.Hide();
}
}

private async void UpdateDisplayImage(string a_artworkURL)
{
if (!string.IsNullOrEmpty(a_artworkURL))
Expand Down Expand Up @@ -180,6 +212,15 @@ private void UpdatePlayIcon(bool a_isPlaying)
}
});
}
private void UpdateEditWindowPosition(object sender, EventArgs e)
{
double mainWidth = RootWindow.ActualWidth;
double editWindowX = Application.Current.MainWindow.Left + mainWidth;
double editWindowY = Application.Current.MainWindow.Top;
editWindow.Top = editWindowY;
editWindow.Left = editWindowX + m_editWindowGap;
}


#region Window Bar controls
private void OnClickClose(object sender, RoutedEventArgs e)
Expand Down
35 changes: 26 additions & 9 deletions MiniSpotify/MiniSpotify/MiniSpotify.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
Expand All @@ -26,7 +27,6 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand All @@ -41,7 +41,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
Expand All @@ -62,6 +62,9 @@
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>NoteMW.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down Expand Up @@ -99,10 +102,17 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="EditorWindow.xaml.cs">
<DependentUpon>EditorWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Source\APIRequestor.cs" />
<Compile Include="Source\Helpers\FileHelper.cs" />
<Compile Include="Source\Helpers\LerpEaser.cs" />
<Compile Include="Source\Interfaces\IAPIRequestor.cs" />
<Page Include="EditorWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -150,20 +160,24 @@
</Resource>
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Files\AuthorisePath.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Files\URLPath.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<EmbeddedResource Include="Assets\Files\AuthorisePath.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Assets\Files\URLPath.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\NextSongButton.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Files\ClientSecret.txt" />
<EmbeddedResource Include="Assets\Files\ClientSecret.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Resource Include="NoteMW.ico" />
<Resource Include="NoteM.ico" />
<Resource Include="Assets\Images\Icons\pin-icon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
Expand All @@ -188,6 +202,9 @@
<Resource Include="Assets\Images\Icons\play-icon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Images\Icons\pin-icon-red.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Content Include="Assets\Images\Icons\play-icon.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
Binary file added MiniSpotify/MiniSpotify/NoteM.ico
Binary file not shown.
Binary file added MiniSpotify/MiniSpotify/NoteMW.ico
Binary file not shown.
70 changes: 70 additions & 0 deletions MiniSpotify/MiniSpotify/Properties/app.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
Loading

0 comments on commit 23c93be

Please sign in to comment.