I'm facing troubles with converting this code ( for using this FFmpeg Wrapper ) to C# since it's the main language of my project .
I tried http://www.developerfusion.com/tools/convert/vb-to-csharp/ but the result code didn't work with me :(
I know it's a newbie request, I'm sorry ;
The Code :
Public WithEvents MediaConverter As New FFLib.Encoder
Private Sub ConOut(ByVal prog As String, ByVal tl As String) Handles MediaConverter.Progress
OperationPrgrss.Value = prog
Application.DoEvents()
End Sub
Private Sub stat(ByVal status) Handles MediaConverter.Status
StatusLbl.Text = status
Application.DoEvents()
End Sub
C# doesn't have a strict equivalent for the
Handles
keyword; what you need to do is add event handlers yourself in the constructor.You don't need an equivalent for
WithEvents
, as that just tells VB there are events to be wired up, and in C# you do that yourself.The rest is a very straightforward translation. A
Sub
is basically a function withvoid
return type,ByVal
and theHandles
clauses can go away, keywords are lowercase, and the rest is just semicolons and braces.For example,