c# - BitmapFrame.Create cannot access this object -
i'm trying export several bitmapsource images png files. here's code:
thread call:
var exportimagesthread = new thread(exportrangeofimages); exportimagesthread.start();   function:
private void exportrangeofimages() {      (var currentframe = exportfromframe; currentframe <= exporttoframe; currentframe++)      {             var currentimage = application.current.dispatcher.invoke(() => (currentstream.children[0] image).source);             var pngbitmapencoder = new pngbitmapencoder();             var bitmapframe = bitmapframe.create((bitmapsource) currentimage);              application.current.dispatcher.invoke(() => pngbitmapencoder.frames.add(bitmapframe));             var = new filestream(updateddir + sequencefile + "_" + framenumber + ".png", filemode.create);             pngbitmapencoder.save(a);      } }   when doing i'm receiving additional information: calling thread cannot access object because different thread owns it. on line: var bitmapframe = bitmapframe.create((bitmapsource) currentimage); 
what missing?
 
 
Comments
Post a Comment