Skip to content

Commit

Permalink
1.3.0 First basic bookmarks UI!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
rgwood committed Dec 27, 2020
1 parent 6cbe291 commit 784b2d8
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ReiTunes/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="2b3c53fd-b804-4e1e-b26c-cae302ea1108"
Publisher="CN=Reilly Wood"
Version="1.2.7.0" />
Version="1.3.0.0" />

<mp:PhoneIdentity PhoneProductId="2b3c53fd-b804-4e1e-b26c-cae302ea1108" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
7 changes: 7 additions & 0 deletions ReiTunes/ReiTunes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
<Compile Include="Services\WhatsNewDisplayService.cs" />
<Compile Include="ViewModels\PlayerViewModel.cs" />
<Compile Include="FileReader.cs" />
<Compile Include="Views\LibraryItemInfo.xaml.cs">
<DependentUpon>LibraryItemInfo.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Player.xaml.cs">
<DependentUpon>Player.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -233,6 +236,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\LibraryItemInfo.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Player.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
33 changes: 33 additions & 0 deletions ReiTunes/Views/LibraryItemInfo.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<ContentDialog
x:Class="ReiTunes.Views.LibraryItemInfo"
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:ReiTunes.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{x:Bind _item.Name}"
DefaultButton="Secondary"
IsPrimaryButtonEnabled="False"
SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
SecondaryButtonText="Cool"
mc:Ignorable="d">

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="{x:Bind _item.Name}" />

<ListView x:Name="BookmarksView" Grid.Row="1">
<ListView.ItemContainerTransitions>
<TransitionCollection />
</ListView.ItemContainerTransitions>
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Position}" TextWrapping="Wrap" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</ContentDialog>
34 changes: 34 additions & 0 deletions ReiTunes/Views/LibraryItemInfo.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using ReiTunes.Configuration;
using ReiTunes.Core;
using Windows.UI.Xaml.Controls;

// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace ReiTunes.Views {

public sealed partial class LibraryItemInfo : ContentDialog {
private readonly LibraryItem _item;
private PlayerViewModel _viewModel;

public LibraryItemInfo(LibraryItem item) {
this.InitializeComponent();
_item = item;

foreach (var bookmark in _item.Bookmarks) {
BookmarksView.Items.Add(bookmark);
}

_viewModel = ServiceLocator.Current.GetService<PlayerViewModel>();
}

private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) {
var selected = BookmarksView.SelectedItem as Bookmark;

if (selected != null) {
if (_viewModel.CurrentlyPlayingItem == _item) {
_viewModel.MediaPlayer.PlaybackSession.Position = selected.Position;
}
}
}
}
}
5 changes: 3 additions & 2 deletions ReiTunes/Views/Player.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,9 @@
Text="Copy URL" />
<MenuFlyoutItem
x:Name="WorldMenuItem"
Click="ShowRecentEvents"
Text="Show recent events (WIP)" />
Click="ShowItemInfo"
Icon="Zoom"
Text="Show Info" />
<MenuFlyoutItem
x:Name="DeleteMenuItem"
Click="DeleteMenuItem_Click"
Expand Down
9 changes: 9 additions & 0 deletions ReiTunes/Views/Player.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,15 @@ private void libraryDataGrid_Sorting(object sender, Microsoft.Toolkit.Uwp.UI.Con
//}
}

private async void ShowItemInfo(object sender, RoutedEventArgs e) {
var item = (sender as FrameworkElement).DataContext as LibraryItem;

if (item != null) {
var dialog = new LibraryItemInfo(item);
await dialog.ShowAsync();
}
}

private async void ShowRecentEvents(object sender, RoutedEventArgs e) {
var recentEventsDialog = new RecentEventsContentDialog(ViewModel.GetRecentEvents());
await recentEventsDialog.ShowAsync();
Expand Down

0 comments on commit 784b2d8

Please sign in to comment.