Commit 2f6ff49d authored by Martin Finkel's avatar Martin Finkel

update libvlcsharp + fixup backward nav + handle ItemDeleted

parent aedb7794
......@@ -38,38 +38,38 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="LibVLCSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LibVLCSharp.0.8.1\lib\net40\LibVLCSharp.dll</HintPath>
<Reference Include="LibVLCSharp, Version=3.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\LibVLCSharp.3.0.3\lib\net40\LibVLCSharp.dll</HintPath>
</Reference>
<Reference Include="LibVLCSharp.Forms, Version=0.8.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LibVLCSharp.Forms.0.8.1\lib\netstandard2.0\LibVLCSharp.Forms.dll</HintPath>
<Reference Include="LibVLCSharp.Forms, Version=3.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\LibVLCSharp.Forms.3.0.3\lib\netstandard2.0\LibVLCSharp.Forms.dll</HintPath>
</Reference>
<Reference Include="LibVLCSharp.Forms.Platforms.WPF, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LibVLCSharp.Forms.WPF.0.8.1\lib\net47\LibVLCSharp.Forms.Platforms.WPF.dll</HintPath>
<Reference Include="LibVLCSharp.Forms.Platforms.WPF, Version=3.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\LibVLCSharp.Forms.WPF.3.0.3\lib\net47\LibVLCSharp.Forms.Platforms.WPF.dll</HintPath>
</Reference>
<Reference Include="LibVLCSharp.WPF, Version=0.8.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LibVLCSharp.WPF.0.8.1\lib\net461\LibVLCSharp.WPF.dll</HintPath>
<Reference Include="LibVLCSharp.WPF, Version=3.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\LibVLCSharp.WPF.3.0.3\lib\net461\LibVLCSharp.WPF.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.168.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
<HintPath>..\..\packages\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="OpenTK.GLControl, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.GLControl.1.1.2349.61993\lib\NET40\OpenTK.GLControl.dll</HintPath>
<HintPath>..\..\packages\OpenTK.GLControl.1.1.2349.61993\lib\NET40\OpenTK.GLControl.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Net" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
<HintPath>..\..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
......@@ -86,19 +86,19 @@
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
<Reference Include="WpfLightToolkit, Version=1.0.0.27, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\WpfLightToolkit.1.0.1\lib\net45\WpfLightToolkit.dll</HintPath>
<HintPath>..\..\packages\WpfLightToolkit.1.0.1\lib\net45\WpfLightToolkit.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.3.4.0.1008975\lib\netstandard2.0\Xamarin.Forms.Core.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\netstandard2.0\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.3.4.0.1008975\lib\netstandard2.0\Xamarin.Forms.Platform.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\netstandard2.0\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.WPF, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.Platform.WPF.3.4.0.1008975\lib\net45\Xamarin.Forms.Platform.WPF.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.Platform.WPF.3.4.0.1008975\lib\net45\Xamarin.Forms.Platform.WPF.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.3.4.0.1008975\lib\netstandard2.0\Xamarin.Forms.Xaml.dll</HintPath>
<HintPath>..\..\packages\Xamarin.Forms.3.4.0.1008975\lib\netstandard2.0\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
......@@ -148,25 +148,25 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LocalNetwork\LocalNetwork\LocalNetwork.csproj">
<ProjectReference Include="..\LocalNetwork\LocalNetwork.csproj">
<Project>{afae9423-fd4a-452a-a7d1-e8b28519a68f}</Project>
<Name>LocalNetwork</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
</Target>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\VideoLAN.LibVLC.Windows.3.0.6\build\VideoLAN.LibVLC.Windows.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\VideoLAN.LibVLC.Windows.3.0.6\build\VideoLAN.LibVLC.Windows.targets'))" />
<Error Condition="!Exists('..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.props'))" />
<Error Condition="!Exists('..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets'))" />
<Error Condition="!Exists('..\..\packages\VideoLAN.LibVLC.Windows.3.0.6\build\VideoLAN.LibVLC.Windows.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\VideoLAN.LibVLC.Windows.3.0.6\build\VideoLAN.LibVLC.Windows.targets'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.props'))" />
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets'))" />
</Target>
<Import Project="..\packages\VideoLAN.LibVLC.Windows.3.0.6\build\VideoLAN.LibVLC.Windows.targets" Condition="Exists('..\packages\VideoLAN.LibVLC.Windows.3.0.6\build\VideoLAN.LibVLC.Windows.targets')" />
<Import Project="..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets')" />
<Import Project="..\..\packages\VideoLAN.LibVLC.Windows.3.0.6\build\VideoLAN.LibVLC.Windows.targets" Condition="Exists('..\..\packages\VideoLAN.LibVLC.Windows.3.0.6\build\VideoLAN.LibVLC.Windows.targets')" />
<Import Project="..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.3.4.0.1008975\build\Xamarin.Forms.targets')" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LibVLCSharp" version="0.8.1" targetFramework="net47" />
<package id="LibVLCSharp.Forms" version="0.8.1" targetFramework="net47" />
<package id="LibVLCSharp.Forms.WPF" version="0.8.1" targetFramework="net47" />
<package id="LibVLCSharp.WPF" version="0.8.1" targetFramework="net47" />
<package id="LibVLCSharp" version="3.0.3" targetFramework="net47" />
<package id="LibVLCSharp.Forms" version="3.0.3" targetFramework="net47" />
<package id="LibVLCSharp.Forms.WPF" version="3.0.3" targetFramework="net47" />
<package id="LibVLCSharp.WPF" version="3.0.3" targetFramework="net47" />
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net47" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net47" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net47" />
......
......@@ -10,7 +10,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LibVLCSharp.Forms" Version="0.8.1" />
<PackageReference Include="LibVLCSharp.Forms" Version="3.0.3" />
<PackageReference Include="Xamarin.Forms" Version="3.4.0.1008975" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -8,6 +8,7 @@ using Xamarin.Forms;
using LocalNetwork.Models;
using LibVLCSharp.Shared;
using System.Collections.Generic;
using System.Linq;
namespace LocalNetwork.ViewModels
{
......@@ -19,6 +20,9 @@ namespace LocalNetwork.ViewModels
List<MediaDiscoverer> _mediaDiscoverers = new List<MediaDiscoverer>();
Item _directory;
/// <summary>
/// Constructor for initial root screen
/// </summary>
public ItemsViewModel()
{
Title = "Local Network";
......@@ -30,6 +34,10 @@ namespace LocalNetwork.ViewModels
InitializeMediaDiscoverers();
}
/// <summary>
/// Directory constructor
/// </summary>
/// <param name="item">The current directory</param>
public ItemsViewModel(Item item)
{
_directory = item;
......@@ -40,7 +48,15 @@ namespace LocalNetwork.ViewModels
async Task<MediaParsedStatus> ExecuteParseItemsCommand()
{
// adding previously parsed medias if directory parsed
foreach (var media in _directory.Media.SubItems)
{
Items.Add(new Item(media));
}
_directory.Media.SubItems.ItemAdded += MediaList_ItemAdded;
_directory.Media.SubItems.ItemDeleted += MediaList_ItemDeleted;
return await _directory.Media.Parse(MediaParseOptions.ParseNetwork);
}
......@@ -52,9 +68,7 @@ namespace LocalNetwork.ViewModels
IsBusy = true;
try
{
Items.Clear();
{
DiscoverNetworkShares();
await Task.Delay(1000);
......@@ -75,17 +89,22 @@ namespace LocalNetwork.ViewModels
{
var discoverer = new MediaDiscoverer(_libVLC, md.Name);
discoverer.MediaList.ItemAdded += MediaList_ItemAdded;
discoverer.MediaList.ItemDeleted += MediaList_ItemDeleted;
_mediaDiscoverers.Add(discoverer);
}
}
void MediaList_ItemDeleted(object sender, MediaListItemDeletedEventArgs e)
{
var itemToDelete = Items.FirstOrDefault(i => i.Media == e.Media);
if (itemToDelete != null)
Items.Remove(itemToDelete);
}
void MediaList_ItemAdded(object sender, MediaListItemAddedEventArgs e) => Items.Add(new Item(e.Media));
void InitializeLibVLC()
{
if (_libVLC != null)
throw new Exception();
Core.Initialize();
_libVLC = new LibVLC("--verbose=2");
......
......@@ -2,18 +2,18 @@
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LocalNetwork.Views.ItemsPage"
Title="{Binding Title}"
Title="{Binding Title}"
x:Name="BrowseItemsPage">
<StackLayout>
<ListView x:Name="ItemsListView"
ItemsSource="{Binding Items}"
VerticalOptions="FillAndExpand"
HasUnevenRows="true"
RefreshCommand="{Binding LoadItemsCommand}"
IsPullToRefreshEnabled="true"
IsRefreshing="{Binding IsBusy, Mode=OneWay}"
CachingStrategy="RecycleElement"
ItemSelected="OnItemSelected">
ItemsSource="{Binding Items}"
VerticalOptions="FillAndExpand"
HasUnevenRows="true"
RefreshCommand="{Binding LoadItemsCommand}"
IsPullToRefreshEnabled="true"
IsRefreshing="{Binding IsBusy, Mode=OneWay}"
CachingStrategy="RecycleElement"
ItemSelected="OnItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
......
......@@ -53,7 +53,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocalNetwork", "LocalNetwor
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LocalNetwork", "LocalNetwork", "{E181D755-40DE-4814-A5E0-FFBF9891B1E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalNetwork.WPF", "LocalNetwork.WPF\LocalNetwork.WPF.csproj", "{06A07159-DCBB-447F-8EB1-DBBB63B2B5B2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalNetwork.WPF", "LocalNetwork\LocalNetwork.WPF\LocalNetwork.WPF.csproj", "{06A07159-DCBB-447F-8EB1-DBBB63B2B5B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment