// ASync method to avoid mediaportal video treatment sleep public void loadPlayingPresetASync(AnimeEpisodeVM curEpisode, string fileName) { // Create an instance of the FFDShowHelper class. FFDShowHelper ffdshowHelper = new FFDShowHelper(); // Create the delegate. AsyncloadPlayingPresetCaller caller = new AsyncloadPlayingPresetCaller(loadPlayingPreset); // Initiate the asychronous call. IAsyncResult result = caller.BeginInvoke(curEpisode, fileName, null, null); Thread.Sleep(0); debug("Main thread " + Thread.CurrentThread.ManagedThreadId + " does some work."); // Call EndInvoke to wait for the asynchronous call to complete, // and to retrieve the results. // string returnValue = caller.EndInvoke(result); // caller.EndInvoke(result); }