Skip to content

Commit

Permalink
Allow video's contextmenu to be more specific on moving video
Browse files Browse the repository at this point in the history
  • Loading branch information
dukemiller committed Dec 3, 2017
1 parent c5b7e25 commit 8d2229f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions youtube-center/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<classes:DateConverter x:Key="DateConverter" />
<classes:ViewsConverter x:Key="ViewsConverter"/>
<classes:VisibilityConverter x:Key="VisibilityConverter"/>
<classes:WatchedConverter x:Key="WatchedConverter"/>

<DataTemplate DataType="{x:Type vmComponents:HomeViewModel}">
<components:Home />
Expand Down
13 changes: 13 additions & 0 deletions youtube-center/Classes/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,17 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
throw new NotImplementedException();
}
}

public class WatchedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return System.Convert.ToBoolean(value) ? "Mark as unwatched" : "Mark as watched";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
4 changes: 2 additions & 2 deletions youtube-center/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
8 changes: 4 additions & 4 deletions youtube-center/Views/Components/Video.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
</UserControl.InputBindings>
<DockPanel Width="300" >
<DockPanel.ContextMenu>
<ContextMenu DataContext="{Binding Source={StaticResource Locator}, Path=Home}">
<MenuItem Header="Watch on youtube" Command="{Binding ContextCommand}" CommandParameter="youtube" />
<MenuItem Header="Watch with streamlink" Command="{Binding ContextCommand}" CommandParameter="streamlink" />
<MenuItem Header="Mark as watched" Command="{Binding ContextCommand}" CommandParameter="mark" />
<ContextMenu>
<MenuItem Header="Watch on youtube" Command="{Binding Source={StaticResource Locator}, Path=Home.ContextCommand}" CommandParameter="youtube" />
<MenuItem Header="Watch with streamlink" Command="{Binding Source={StaticResource Locator}, Path=Home.ContextCommand}" CommandParameter="streamlink" />
<MenuItem Header="{Binding Watched, Converter={StaticResource WatchedConverter}}" Command="{Binding Source={StaticResource Locator}, Path=Home.ContextCommand}" CommandParameter="mark" />
</ContextMenu>
</DockPanel.ContextMenu>
<DockPanel DockPanel.Dock="Bottom" Margin="4" HorizontalAlignment="Stretch">
Expand Down

0 comments on commit 8d2229f

Please sign in to comment.