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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -