Can I wait for a signal from a event so that , when I recievce the signal then only I will proceed with next code segment.
For making it clear , I have the follwoing code:
hiddenMediaElement.Source = new Uri(strMediaFileName, UriKind.RelativeOrAbsolute);
hiddenMediaElement.MediaFailed += (obj, Sender) =>
{
bMediaError = true;
};
if (!bMediaError)
{
ObjChildMediaPlayer.Visibility = Visibility.Visible;
ObjChildMediaPlayer._currenTitle = strTitle;
ObjChildMediaPlayer.Show();
Content_FullScreenChanged(null, null);
}
The problem here is the if condition is executed before MediaFailed event . But I want to wait for mediaFailed event to be executed 1st and then the if condition and I do not want to use events here.
How could I wait for the same. Can I use mutex or something similar.