private void StartupMusicProvider(AsyncTask task, object state) { task.DoOneStep( delegate() { var mohFileConfig = ApplicationConfiguration.GetMusicOnHoldConfiguration(); m_mohProvider = new MusicProvider(this.AppPlatform, mohFileConfig.FilePath); //Logger.Log(Logger.LogLevel.Info, "Starting Music Provider."); m_mohProvider.BeginStartup( delegate(IAsyncResult ar) { task.DoFinalStep( delegate() { m_mohProvider.EndStartup(ar); //Logger.Log(Logger.LogLevel.Info, "Started Music Provider."); }); }, null); }); }
private void ShutdownMusicProvider(AsyncTask task, object state) { if (m_mohProvider == null) { task.Complete(null); return; } task.DoOneStep( delegate() { MusicProvider musicProvider = m_mohProvider; musicProvider.BeginShutdown( delegate(IAsyncResult ar) { task.DoFinalStep( delegate() { musicProvider.EndShutdown(ar); this.Logger.Log(Logger.LogLevel.Verbose, "Music provider shutdown."); }); }, null); }); }