public代码csImageInfoGetInformationAsync(
stringfileName,
booltotalPages,
intpageNumber,
objectuserState
)
PublicOverloadsFunctionGetInformationAsync( _
ByValfileNameAsString, _
ByValtotalPagesAsBoolean, _
ByValpageNumberAsInteger, _
ByValuserStateAsObject_
)As代码csImageInfo
- (void)imageInformationForFileAsync:(NSString *)file
totalPages:(BOOL)totalPages
pageNumber:(NSInteger)pageNumber
completion:(void(^)(LTCodecsImageInfo * __nullable info, NSError * __nullable error))completion
public:
代码csImageInfo^GetInformationAsync(
String^fileName,
booltotalPages,
intpageNumber,
Object^userState
)
fileName
String containing the input file name to query.
totalPages
trueto query the file for total number of pages;false, otherwise.
pageNumber
The page number to query. Pass 1 for the first page (default).
userState
A user-defined object that is passed to the method invoked when the asynchronous operation completes.
A代码csImageInfoobject that contains the information about the specified image. See remarks about the usage of this object.
NOTE: This topic is part ofRasterCodecs
Async support using the .NETSystem.ComponentMode.AsyncOperation
model. For .NETasync/await
, useTask
Specifying true fortotalPagescan cause the process to be slow for files with large number of pages.
TheRasterCodecsclass supports getting information on image files asynchronously using theGetInformationAsyncmethods. When calling any of these methods, the caller thread will not be blocked and the method will return instantly with an instance代码csImageInfothat is in a loading status (代码csImageInfo.IsLoadingset totrue). You should not use the other properties of this object while the object is in loading status.
When theRasterCodecsobject finishes getting the information about the file, the various properties of the代码csImageInfowill be populated with the image file information and the代码csImageInfo.IsLoadingproperty will be set tofalse.
It is recommended that you do not poll for the代码csImageInfo.IsLoadingproperty to determine whether the image information has been collected. Instead, subscribe to theGetInformationAsyncCompleted事件时得到通知GetInformationAsyncoperation is completed and whether any errors occurred.
TheGetInformationAsyncCompletedevent data will also contain the same object returned fromGetInformationAsyncso you do not have to keep the original object in your application.userStatewill be passed to the CodecsGetInformationAsyncCompletedEventArgs.UserState member of theGetInformationAsyncCompletedevent data.
usingLeadtools;
usingLeadtools.Codecs;
usingLeadtools.ImageProcessing;
usingLeadtools.ImageProcessing.Color;
usingLeadtools.Svg;
publicvoidGetInformationAsyncFileExample()
{
stringsrcFileName = Path.Combine(LEAD_VARS.ImagesDir,"Image1.cmp");
RasterCodecs codecs =newRasterCodecs();
// Now get information about the file asynchronously
codecs.GetInformationAsyncCompleted +=newEventHandler
(GetInformationAsyncFileExample_GetInformationAsyncCompleted); objectimageInfoObject = codecs.GetInformationAsync(srcFileName,true, 1,null);
// Notice that the returned imageInfoObject is a CodecsImageInfo with IsLoading set to true at this point
// The IsLoading will be false (and hence, the object will be usable) when the GetInformationAsyncCompleted
// fires.
}
privatevoidGetInformationAsyncFileExample_GetInformationAsyncCompleted(objectsender, CodecsGetInformationAsyncCompletedEventArgs e)
{
if(e.Cancelled)
{
Console.WriteLine("User canceled");
}
elseif(e.Error !=null)
{
Console.WriteLine("Error: "+ e.Error.Message);
}
else
{
// Get the image info
代码csImageInfo info = e.Info;
Console.WriteLine("Image info obtainted asynchronously:\n{0}", info.ToString());
info.Dispose();
}
// Unsubscribe to the event and dispose the RasterCodecs object
RasterCodecs codecs = senderasRasterCodecs;
codecs.GetInformationAsyncCompleted -=newEventHandler
(GetInformationAsyncFileExample_GetInformationAsyncCompleted); codecs.Dispose();
}
staticclassLEAD_VARS
{
publicconststringImagesDir =@"C:\LEADTOOLS21\Resources\Images";
}
Help Collections
Raster.NET|C API|C++ Class Library|HTML5 JavaScript
Document.NET|C API|C++ Class Library|HTML5 JavaScript
Medical.NET|C API|C++ Class Library|HTML5 JavaScript
Medical Web Viewer.NET
188宝金博怎么下载
Media Foundation.NET|C API|Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.