c# - Trouble with camera in Windows Phone 8.0 using videobrush -


i got bug in app , can not solve it.

bug - can not use camera more 3 times.

code, demonstrates here:

using system; using system.windows; using system.windows.controls; using system.windows.navigation; using microsoft.phone.controls; using microsoft.phone.shell; using phoneapp1.resources; using system.windows.media; using microsoft.devices;  namespace phoneapp1 {     public partial class mainpage : phoneapplicationpage     {          photocamera acamera = new photocamera(cameratype.primary);         // constructor         public mainpage()         {             initializecomponent();         }          private void button_click(object sender, routedeventargs e)         {             var cam = new camera_vm();          }     }       class camera_vm     {         public camera_vm()         {             videobrush __cameraview = new videobrush();             photocamera acamera = new photocamera(cameratype.primary);             __cameraview.setsource(acamera);                     }     } } 

on third launch - throws error:

   {system.notsupportedexception: specified method not supported.    @ ms.internal.xcpimports.checkhresult(uint32 hr)    @ ms.internal.xcpimports.videobrush_setexternalvideoportsource(videobrush vb, string sportname)    @ microsoft.devices.camera 

have no idea - mean.

my guess having videobrush in code - bad idea, have option? got grid in datatemplate, binds videobrush object.

if must dispose camera unit - can tell me, how right?

p.s. code example, fires error.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -