List of printers

static Map ListOfPrinters(Args _args)
{
Microsoft.Dynamics.AX.Framework.Reporting.Shared.PrinterHelper printerHelper;
Microsoft.Dynamics.AX.Framework.Reporting.Shared.PrinterInfo printerInfo;
System.Collections.ArrayList names;
System.Collections.IEnumerator enumerator;

Map printerMap;
str name;
int printerStatus;
str driverName;
str portName;
str comment;
int jobCountSinceLastReset;

if(!printerMap)
{
printerMap = new Map(Types::String, Types::Container);

// BP Deviation documented
printerHelper = new Microsoft.Dynamics.AX.Framework.Reporting.Shared.PrinterHelper();
names = printerHelper.get_PrinterNames();
if (names != null)
{
enumerator = names.GetEnumerator();
while (enumerator.MoveNext())
{
name = enumerator.get_Current();
printerInfo = printerHelper.GetPrinterInfo(name);

// BP Deviation documented
printerStatus = CLRInterop::getAnyTypeForObject(printerInfo.get_PrinterStatus());
// BP Deviation documented
driverName = CLRInterop::getAnyTypeForObject(printerInfo.get_DriverName());
// BP Deviation documented
portName = CLRInterop::getAnyTypeForObject(printerInfo.get_PortName());
// BP Deviation documented
comment = CLRInterop::getAnyTypeForObject(printerInfo.get_Comment());
// BP Deviation documented
jobCountSinceLastReset = CLRInterop::getAnyTypeForObject(printerInfo.get_JobCountSinceLastReset());

printerMap.insert(name, [name, printerStatus, driverName, portName, comment, jobCountSinceLastReset]);
}
}
}
return printerMap;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.