Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
WPF - Add missing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fsobolev committed Oct 6, 2023
1 parent 118f9e3 commit d109e76
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Examples/WPF/Controls/MPVControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@

namespace Nickvision.MPVSharp.Examples.WPF.Controls;

/// <summary>
/// MPV WPF Control.
/// Embedded window is created and MPV window is connected to it (see <see cref="MPVHwndHost"/>).
/// </summary>
public partial class MPVControl : UserControl
{
private Client _client;
private MPVHwndHost _hwndHost;

/// <summary>
/// Constructs MPVControl
/// </summary>
public MPVControl()
{
InitializeComponent();
Expand All @@ -19,11 +26,18 @@ public MPVControl()
AddChild(_hwndHost);
}

/// <summary>
/// Loads and plays file from path or URL
/// </summary>
/// <param name="url">Path or URL</param>
public void Load(string url)
{
_client.LoadFile(url);
_client.SetProperty("pause", false);
}

/// <summary>
/// Toggles pause
/// </summary>
public void CyclePause() => _client.CyclePause();
}
28 changes: 28 additions & 0 deletions Examples/WPF/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ namespace Nickvision.MPVSharp.Examples.WPF.Views;
/// </summary>
public partial class MainWindow : Window
{
/// <summary>
/// Constructs MainWindow
/// </summary>
public MainWindow()
{
InitializeComponent();
}

/// <summary>
/// Occurs when Open Video File button was clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">RoutedEventArgs</param>
private void OnOpenVideo(object sender, RoutedEventArgs e)
{
var openFileDialog = new OpenFileDialog()
Expand All @@ -28,11 +36,31 @@ private void OnOpenVideo(object sender, RoutedEventArgs e)
OnLoadVideo(sender, e);
}

/// <summary>
/// Occurs when Exit action was activated
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">RoutedEventArgs</param>
private void OnExit(object sender, RoutedEventArgs e) => Close();

/// <summary>
/// Occurs when Load Video button was clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">RoutedEventArgs</param>
private void OnLoadVideo(object sender, RoutedEventArgs e) => MPV.Load(TxtUrl.Text);

/// <summary>
/// Occurs when Pause button aws clicked
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">RoutedEventArgs</param>
private void OnPause(object sender, RoutedEventArgs e) => MPV.CyclePause();

/// <summary>
/// Occurs when About action was activated
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="e">RoutedEventArgs</param>
private void OnAbout(object sender, RoutedEventArgs e) => MessageBox.Show("WPF MPV# Example", "About", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
}

0 comments on commit d109e76

Please sign in to comment.