LEADTOOLS Multimedia (Leadtools.Multimedia assembly)

ErrorAbort Event (ConvertCtrl)

Show in webframe
Example 



Occurs when an error has caused an operation to abort.
Syntax
'Declaration
 
Public Event ErrorAbort As ErrorAbortEventHandler
'Usage
 
Dim instance As ConvertCtrl
Dim handler As ErrorAbortEventHandler
 
AddHandler instance.ErrorAbort, handler
public event ErrorAbortEventHandler ErrorAbort
public:
event ErrorAbortEventHandler^ ErrorAbort
Remarks
The event handler is passed an ErrorAbortEventArgs object containing the related error code.

For more information, refer to the Error Codes.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Multimedia
Imports LeadtoolsMultimediaExamples.Fixtures

Public _result As Boolean = False
Public _form As ConvertCtrlForm = New ConvertCtrlForm()
Public Sub ErrorAbortExample()
   ' reference the convert control
   Dim convertctrl As ConvertCtrl = _form.ConvertCtrl

   convertctrl.Window = _form.Handle

   ' input and output file names
   Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_ErrorAbortSource.mpeg")
   Dim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_ErrorAbortExample.mpg")

   Try
      ' subscribe to the ErrorAbort event
      AddHandler convertctrl.ErrorAbort, AddressOf ConvertCtrl_ErrorAbort

      ' no recompression for video and audio
      convertctrl.VideoCompressors.Selection = -1
      convertctrl.AudioCompressors.Selection = -1

      ' set the allowed streams and target type
      convertctrl.AllowedStreams = convertctrl.TargetFormats(TargetFormatType.MPEG2DICOM).Streams
      convertctrl.TargetFormat = TargetFormatType.MPEG2DICOM

      ' set the source and target files
      convertctrl.SourceFile = inFile
      convertctrl.TargetFile = outFile

      ' show preview
      convertctrl.Preview = True

      ' convert it now!
      convertctrl.StartConvert()
   Catch e1 As Exception
      _result = False
   End Try

   ' we'll loop on the state and pump messages for this example.
   ' but you should not need to if running from a Windows Forms application.
   Do While convertctrl.State = ConvertState.Running
      Application.DoEvents()
   Loop
End Sub

Public Sub ConvertCtrl_ErrorAbort(ByVal sender As Object, ByVal e As ErrorAbortEventArgs)
   ' uncomment this line to show the error message
   ' MessageBox.Show(e.errorMessage, "Convert Error");

   ' set result
   _result = True
End Sub

Public NotInheritable Class LEAD_VARS
Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 18\Media"
End Class
using Leadtools;
using Leadtools.Multimedia;
using LeadtoolsMultimediaExamples.Fixtures;

public bool _result = false;
public ConvertCtrlForm _form = new ConvertCtrlForm();
public void ErrorAbortExample()
{
   // reference the convert control
   ConvertCtrl convertctrl = _form.ConvertCtrl;

   convertctrl.Window = _form.Handle;

   // input and output file names
   string inFile = Path.Combine(LEAD_VARS.MediaDir,"ConvertCtrl_ErrorAbortSource.mpeg");
   string outFile = Path.Combine(LEAD_VARS.MediaDir, "ConvertCtrl_ErrorAbortExample.mpg");

   try
   {
      // subscribe to the ErrorAbort event
      convertctrl.ErrorAbort += ConvertCtrl_ErrorAbort;

      // no recompression for video and audio
      convertctrl.VideoCompressors.Selection = -1;
      convertctrl.AudioCompressors.Selection = -1;

      // set the allowed streams and target type
      convertctrl.AllowedStreams = convertctrl.TargetFormats[TargetFormatType.MPEG2DICOM].Streams;
      convertctrl.TargetFormat = TargetFormatType.MPEG2DICOM;

      // set the source and target files
      convertctrl.SourceFile = inFile;
      convertctrl.TargetFile = outFile;

      // show preview
      convertctrl.Preview = true;

      // convert it now!
      convertctrl.StartConvert();
   }
   catch (Exception)
   {
      _result = false;
   }

   // we'll loop on the state and pump messages for this example.
   // but you should not need to if running from a Windows Forms application.
   while (convertctrl.State == ConvertState.Running)
      Application.DoEvents();
}

public void ConvertCtrl_ErrorAbort(object sender, ErrorAbortEventArgs e)
{
   // uncomment this line to show the error message
   // MessageBox.Show(e.errorMessage, "Convert Error");

   // set result
   _result = true;
}

static class LEAD_VARS
{
public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 18\Media";
}
Requirements

Target Platforms

See Also

Reference

ConvertCtrl Class
ConvertCtrl Members

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Multimedia requires a Multimedia or Multimedia Suite license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features