Initial add of three projects
This commit is contained in:
38
VideoEnc/VideoEncoder.cs
Normal file
38
VideoEnc/VideoEncoder.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VideoEnc
|
||||
{
|
||||
public class VideoEventArgs : EventArgs
|
||||
{
|
||||
public Video Video { get; set; }
|
||||
}
|
||||
|
||||
public class VideoEncoder
|
||||
{
|
||||
// 1- Define a delegate
|
||||
// 2- Define an Event
|
||||
// 3 Raise the event
|
||||
|
||||
public delegate void VideoEncodedEventHandler(object source, VideoEventArgs args);
|
||||
public event VideoEncodedEventHandler VideoEncoded;
|
||||
|
||||
public void Encode(Video video)
|
||||
{
|
||||
Console.WriteLine("Encoding video...");
|
||||
Thread.Sleep(3000);
|
||||
|
||||
OnVideoEncoded(video);
|
||||
}
|
||||
|
||||
protected virtual void OnVideoEncoded(Video video)
|
||||
{
|
||||
if (VideoEncoded != null)
|
||||
VideoEncoded(this, new VideoEventArgs() { Video =video });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user