Commit bbd34269 authored by Martin Finkel's avatar Martin Finkel

Hide event managers

parent 5a51c5c7
This diff is collapsed.
......@@ -48,4 +48,14 @@ namespace LibVLCSharp.Shared
return utf8Args;
}
}
[AttributeUsage(AttributeTargets.Method)]
internal sealed class MonoPInvokeCallbackAttribute : Attribute
{
public MonoPInvokeCallbackAttribute(Type type)
{
Type = type;
}
public Type Type { get; private set; }
}
}
\ No newline at end of file
......@@ -526,7 +526,7 @@ namespace LibVLCSharp.Shared
/// <para>NOTE: this function doesn't increment reference counting.</para>
/// </summary>
/// <returns>event manager object</returns>
public MediaEventManager EventManager
MediaEventManager EventManager
{
get
{
......
......@@ -112,7 +112,7 @@ namespace LibVLCSharp.Shared
/// Get event manager from media service discover object.
/// under v3 only
/// </summary>
public MediaDiscovererEventManager EventManager
MediaDiscovererEventManager EventManager
{
get
{
......
......@@ -277,7 +277,7 @@ namespace LibVLCSharp.Shared
/// Get libvlc_event_manager from this media list instance. The
/// p_event_manager is immutable, so you don't have to hold the lock
/// </summary>
public MediaListEventManager EventManager
MediaListEventManager EventManager
{
get
{
......
......@@ -670,22 +670,6 @@ namespace LibVLCSharp.Shared
set => Native.LibVLCMediaPlayerSetMedia(NativeReference, value.NativeReference);
}
/// <summary>
/// Get the Event Manager from which the media player send event.
/// </summary>
public MediaPlayerEventManager EventManager
{
get
{
if (_eventManager == null)
{
var eventManagerPtr = Native.LibVLCMediaPlayerEventManager(NativeReference);
_eventManager = new MediaPlayerEventManager(eventManagerPtr);
}
return _eventManager;
}
}
/// <summary>
/// return true if the media player is playing, false otherwise
/// </summary>
......@@ -1793,6 +1777,36 @@ namespace LibVLCSharp.Shared
public delegate void LibVLCVolumeCb(IntPtr data, float volume, [MarshalAs(UnmanagedType.I1)] bool mute);
#endregion
#region events
/// <summary>
/// Get the Event Manager from which the media player send event.
/// </summary>
MediaPlayerEventManager EventManager
{
get
{
if (_eventManager == null)
{
var eventManagerPtr = Native.LibVLCMediaPlayerEventManager(NativeReference);
_eventManager = new MediaPlayerEventManager(eventManagerPtr);
}
return _eventManager;
}
}
public event EventHandler<MediaPlayerPositionChangedEventArgs> PositionChanged
{
add
{
EventManager.AttachEvent(EventType.MediaPlayerPositionChanged, value);
}
remove
{
EventManager.DetachEvent(EventType.MediaPlayerPositionChanged, value);
}
}
#endregion
}
/// <summary>Description for titles</summary>
......
......@@ -6,6 +6,8 @@ namespace LibVLCSharp.Shared
{
public class RendererDiscoverer : Internal
{
RendererDiscovererEventManager _eventManager;
struct Native
{
[SuppressUnmanagedCodeSecurity]
......@@ -40,9 +42,7 @@ namespace LibVLCSharp.Shared
{
}
RendererDiscovererEventManager _eventManager;
public RendererDiscovererEventManager EventManager
private RendererDiscovererEventManager EventManager
{
get
{
......@@ -58,6 +58,30 @@ namespace LibVLCSharp.Shared
public bool Start() => Native.LibVLCRendererDiscovererStart(NativeReference) == 0;
public void Stop() => Native.LibVLCRendererDiscovererStop(NativeReference);
public event EventHandler<RendererDiscovererItemAddedEventArgs> ItemAdded
{
add
{
EventManager.AttachEvent(EventType.RendererDiscovererItemAdded, value);
}
remove
{
EventManager.DetachEvent(EventType.RendererDiscovererItemAdded, value);
}
}
public event EventHandler<RendererDiscovererItemDeletedEventArgs> ItemDeleted
{
add
{
EventManager.AttachEvent(EventType.RendererDiscovererItemDeleted, value);
}
remove
{
EventManager.DetachEvent(EventType.RendererDiscovererItemDeleted, value);
}
}
}
public class RendererItem : Internal
......
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