I've been working project in Raspberry Pi 2 running Windows 10 IoT Core. Project subject sensor triggering with open a video. But I am getting the following error:
An exception of type 'System.Exception' occurred in ProjeVol1.exe but was not handled in user code
Additional information: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))
Code:
private void SensorPin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
{
Debug.WriteLine("Sensor Tetiklendi");
if (args.Edge == GpioPinEdge.FallingEdge)
{
Debug.WriteLine("Falling Edge");
ledPin.Write(GpioPinValue.High);
VideoAc();
}
else if (args.Edge == GpioPinEdge.RisingEdge)
{
Debug.WriteLine("Rising Edge");
ledPin.Write(GpioPinValue.High);
}
}
public void VideoAc()
{
video.AutoPlay = true;
video.Play();
video.MediaEnded += Video_MediaEnded;
}