public static async Task <MediaSessionManager> CreateAsync() { SimpleLogger.DefaultLog("MediaSessionManager::CreateAsync called..."); var instance = new MediaSessionManager { SystemSessionManager = await GlobalSystemMediaTransportControlsSessionManager.RequestAsync(), }; instance.SystemSessionManager.SessionsChanged += instance.OnSessionsChanged; SimpleLogger.DefaultLog("MediaSessionManager::CreateAsync DONE"); return(instance); }
private void OnReinitializeComponent(object sender, EventArgs e) { Controls.Clear(); albumArtPictureBox = null; artistLabel = null; titleLabel = null; SessionManager.CurrentSongChanged -= OnCurrentSongChanged; SessionManager.Destroy(); SessionManager = null; InitializeAll(); }
private async Task InitializeMediaSessionManager() { SimpleLogger.DefaultLog("NowPlayingDeskbandControl::InitializeMediaSessionManager called..."); while (!IsHandleCreated) { SimpleLogger.DefaultLog(" No handle yet, waiting..."); await Task.Delay(250); } SessionManager = await MediaSessionManager.CreateAsync(); SessionManager.CurrentSongChanged += OnCurrentSongChanged; SessionManager.ForceUpdate(); SimpleLogger.DefaultLog("NowPlayingDeskbandControl::InitializeMediaSessionManager DONE"); }