Skip to content

Commit

Permalink
Fix #1 Basic Wpf UserControl by Ch4rg3r
Browse files Browse the repository at this point in the history
  • Loading branch information
mfkl committed Jul 19, 2018
1 parent 11a72ff commit f52df41
Show file tree
Hide file tree
Showing 28 changed files with 1,243 additions and 3 deletions.
6 changes: 6 additions & 0 deletions LibVLCSharp.WPF.Sample/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
9 changes: 9 additions & 0 deletions LibVLCSharp.WPF.Sample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="LibVLCSharp.WPF.Sample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:LibVLCSharp.WPF.Sample"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
8 changes: 8 additions & 0 deletions LibVLCSharp.WPF.Sample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Windows;

namespace LibVlcSharp.Wpf.Sample
{
public class App : Application
{
}
}
13 changes: 13 additions & 0 deletions LibVLCSharp.WPF.Sample/Controls.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<UserControl x:Class="LibVLCSharp.WPF.Sample.Controls"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:LibVLCSharp.WPF.Sample"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<StackPanel Orientation="Horizontal">
<Button Content="PLAY" x:Name="PlayButton" Height="25" Width="50" VerticalAlignment="Bottom" HorizontalAlignment="Left"></Button>
<Button Content="STOP" x:Name="StopButton" Height="25" Width="50" VerticalAlignment="Bottom" HorizontalAlignment="Left"></Button>
</StackPanel>
</UserControl>
39 changes: 39 additions & 0 deletions LibVLCSharp.WPF.Sample/Controls.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using LibVLCSharp.Shared;

using System.Windows;
using System.Windows.Controls;

namespace LibVLCSharp.WPF.Sample
{
public partial class Controls : UserControl
{
readonly Example1 parent;

public Controls(Example1 Parent)
{
parent = Parent;

InitializeComponent();

PlayButton.Click += PlayButton_Click;
StopButton.Click += StopButton_Click;
}

void StopButton_Click(object sender, RoutedEventArgs e)
{
if (parent.Player.MediaPlayer.IsPlaying)
{
parent.Player.MediaPlayer.Stop();
}
}

void PlayButton_Click(object sender, RoutedEventArgs e)
{
if (!parent.Player.MediaPlayer.IsPlaying)
{
parent.Player.MediaPlayer.Play(new Media(parent.Player.LibVLC,
"http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", Media.FromType.FromLocation));
}
}
}
}
13 changes: 13 additions & 0 deletions LibVLCSharp.WPF.Sample/Example1.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Window x:Class="LibVLCSharp.WPF.Sample.Example1"
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:LibVLCSharp.WPF.Sample"
xmlns:uc="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF"
mc:Ignorable="d"
Title="Example1" Height="450" Width="800">
<Grid>
<uc:VideoView x:Name="Player" Panel.ZIndex="1" />
</Grid>
</Window>
17 changes: 17 additions & 0 deletions LibVLCSharp.WPF.Sample/Example1.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Windows;

namespace LibVLCSharp.WPF.Sample
{
public partial class Example1 : Window
{
readonly Controls _controls;

public Example1()
{
InitializeComponent();

_controls = new Controls(this);
Player.Content = _controls;
}
}
}
18 changes: 18 additions & 0 deletions LibVLCSharp.WPF.Sample/Example2.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Window x:Class="LibVLCSharp.WPF.Sample.Example2"
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:LibVLCSharp.WPF.Sample"
xmlns:uc="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF"
mc:Ignorable="d"
Title="Example2" Height="450" Width="800">
<Grid>
<uc:VideoView x:Name="Player" Panel.ZIndex="1">
<StackPanel Orientation="Horizontal" x:Name="test">
<Button Content="PLAY" Height="25" Width="50" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="PlayButton_Click" />
<Button Content="STOP" Height="25" Width="50" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="StopButton_Click" />
</StackPanel>
</uc:VideoView>
</Grid>
</Window>
42 changes: 42 additions & 0 deletions LibVLCSharp.WPF.Sample/Example2.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using LibVLCSharp.Shared;

using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace LibVLCSharp.WPF.Sample
{
public partial class Example2 : Window
{
public Example2()
{
InitializeComponent();

var label = new Label
{
Content = "TEST",
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Bottom,
Foreground = new SolidColorBrush(Colors.Red)
};
test.Children.Add(label);
}

void StopButton_Click(object sender, RoutedEventArgs e)
{
if (Player.MediaPlayer.IsPlaying)
{
Player.MediaPlayer.Stop();
}
}

void PlayButton_Click(object sender, RoutedEventArgs e)
{
if (!Player.MediaPlayer.IsPlaying)
{
Player.MediaPlayer.Play(new Media(Player.LibVLC,
"http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", Media.FromType.FromLocation));
}
}
}
}
133 changes: 133 additions & 0 deletions LibVLCSharp.WPF.Sample/LibVLCSharp.WPF.Sample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{01CCB934-B77F-4681-86C5-AE4FEE648238}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>LibVLCSharp.WPF.Sample</RootNamespace>
<AssemblyName>LibVLCSharp.WPF.Sample</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="Controls.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Example2.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Example1.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Controls.xaml.cs">
<DependentUpon>Controls.xaml</DependentUpon>
</Compile>
<Compile Include="Example2.xaml.cs">
<DependentUpon>Example2.xaml</DependentUpon>
</Compile>
<Compile Include="Example1.xaml.cs">
<DependentUpon>Example1.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LibVLCSharp.WPF\LibVLCSharp.WPF.csproj">
<Project>{da7a2677-0944-481f-a59b-9128fc54fd5f}</Project>
<Name>LibVLCSharp.WPF</Name>
</ProjectReference>
<ProjectReference Include="..\LibVLCSharp\LibVLCSharp.csproj">
<Project>{d1c3b7c4-713b-46b2-b33a-e9298c819921}</Project>
<Name>LibVLCSharp</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\VideoLAN.LibVLC.Windows.3.0.0-alpha3\build\VideoLAN.LibVLC.Windows.targets" Condition="Exists('..\packages\VideoLAN.LibVLC.Windows.3.0.0-alpha3\build\VideoLAN.LibVLC.Windows.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
</PropertyGroup>
<Error Condition="!Exists('..\packages\VideoLAN.LibVLC.Windows.3.0.0-alpha3\build\VideoLAN.LibVLC.Windows.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\VideoLAN.LibVLC.Windows.3.0.0-alpha3\build\VideoLAN.LibVLC.Windows.targets'))" />
</Target>
</Project>
Loading

0 comments on commit f52df41

Please sign in to comment.