IsAsyncBusy Property (original) (raw)
Summary
Gets a value that determines whether this RasterCodecs object is currently busy with an asynchronous operation on a URL.
Syntax
public bool IsAsyncBusy { get; }
public boolean isAsyncBusy(Object operation)
public:
property bool IsAsyncBusy {
bool get();
}
Property Value
true if this RasterCodecs object is currently busy with an asynchronous operation on a URL, otherwise; false. The default value is false.
Example
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;
public void CancelAsyncExample()
{
string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp");
Uri uri = new Uri(srcFileName);
RasterCodecs codecs = new RasterCodecs();
// Now Load the file asynchronously
codecs.LoadAsyncCompleted += new EventHandler<CodecsLoadAsyncCompletedEventArgs>(cancelAsyncExample_LoadAsyncCompleted);
RasterImage image = codecs.LoadAsync(uri, null);
// Cancel it immediatly, in normal situation, the cancelation will happen
// before the LoadAsync method has a chance to load the file and
// the message "User canceled" will be displayed on the console
if (codecs.IsAsyncBusy)
{
codecs.CancelAsync();
}
}
private void cancelAsyncExample_LoadAsyncCompleted(object sender, CodecsLoadAsyncCompletedEventArgs e)
{
if (e.Cancelled)
{
Debug.WriteLine("User canceled");
}
else if (e.Error != null)
{
Debug.WriteLine("Error: " + e.Error.Message);
}
else
{
// Get the image
RasterImage image = e.Image;
Debug.WriteLine("Image loaded asynchronously: Size = {0} by {1}", image.Width, image.Height);
image.Dispose();
}
// Unsubscribe to the event and dispose the RasterCodecs object
RasterCodecs codecs = sender as RasterCodecs;
codecs.LoadAsyncCompleted -= new EventHandler<CodecsLoadAsyncCompletedEventArgs>(cancelAsyncExample_LoadAsyncCompleted);
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Leadtools.Codecs Assembly
CompactFile(Stream,Stream,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method
CompactFile(Stream,Stream,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method
CompactFile(string,string,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method
CompactFile(string,string,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method