Why the value of “Images” is always null?
This launches the Mathematica kernel via IKernelLink (the last for including the path to MathKernel):
string[] mlArgs = { "-linkmode", "launch", "-linkname", ViewModelMain.mathKernel };
IKernelLink ml = MathLinkFactory.CreateKernelLink(mlArgs);
MathKernel mk = new MathKernel(ml)
{
CaptureGraphics = true, //Get or sets whether this MathKernel object should capture Mathematica graphics output generated during a computation.
GraphicsFormat = "Automatic", //Gets or sets the image format for Mathematica graphics generated during a computation.
UseFrontEnd = false, //Gets or sets whether the Mathematica notebook front end should be used in the background for graphics rendering services.
AutoCloseLink = true,
CaptureMessages = true
};
try
{
mk.Compute("Graphics3D[Cylinder[{ { 0, 0, 0}, { 0, 0, 1} }, 1], Axes->True]");
System.Drawing.Image[] Images = mk.Graphics; //Gets the accumulated Images from Mathematica graphics output during the last call to Compute.
}