mirror of
https://github.com/DarthAffe/ScreenCapture.NET.git
synced 2025-12-12 13:28:35 +00:00
Added Updated-events
This commit is contained in:
parent
1702415aa0
commit
e6202d88b5
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using ScreenCapture.Events;
|
||||
using SharpGen.Runtime;
|
||||
using Vortice.Direct3D;
|
||||
using Vortice.Direct3D11;
|
||||
@ -15,7 +16,7 @@ using Usage = Vortice.Direct3D11.Usage;
|
||||
namespace ScreenCapture
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public class DX11ScreenCapture : IScreenCapture
|
||||
public sealed class DX11ScreenCapture : IScreenCapture
|
||||
{
|
||||
#region Constants
|
||||
|
||||
@ -51,6 +52,12 @@ namespace ScreenCapture
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler<ScreenCaptureUpdatedEventArgs>? Updated;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public DX11ScreenCapture(IDXGIFactory1 factory, Display display)
|
||||
@ -120,6 +127,12 @@ namespace ScreenCapture
|
||||
}
|
||||
catch { /**/ }
|
||||
|
||||
try
|
||||
{
|
||||
Updated?.Invoke(this, new ScreenCaptureUpdatedEventArgs(result));
|
||||
}
|
||||
catch { /**/ }
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
22
ScreenCapture/Events/ScreenCaptureUpdatedEventArgs.cs
Normal file
22
ScreenCapture/Events/ScreenCaptureUpdatedEventArgs.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace ScreenCapture.Events
|
||||
{
|
||||
public class ScreenCaptureUpdatedEventArgs : EventArgs
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
public bool IsSuccessful { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public ScreenCaptureUpdatedEventArgs(bool isSuccessful)
|
||||
{
|
||||
this.IsSuccessful = isSuccessful;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
namespace ScreenCapture
|
||||
using System;
|
||||
|
||||
namespace ScreenCapture
|
||||
{
|
||||
public sealed class CaptureZone
|
||||
{
|
||||
@ -30,6 +32,12 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
public event EventHandler? Updated;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public CaptureZone(int id, int x, int y, int width, int height, int downscaleLevel, int unscaledWidth, int unscaledHeight, int captureWidth, int captureHeight, int bufferWidth, int bufferHeight, byte[] buffer)
|
||||
@ -61,6 +69,8 @@
|
||||
{
|
||||
IsUpdateRequested = false;
|
||||
BlackBars.InvalidateCache();
|
||||
|
||||
Updated?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
public override int GetHashCode() => Id;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user