コード例 #1
0
        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);
        }
コード例 #2
0
        private void OnReinitializeComponent(object sender, EventArgs e)
        {
            Controls.Clear();
            albumArtPictureBox = null;
            artistLabel        = null;
            titleLabel         = null;

            SessionManager.CurrentSongChanged -= OnCurrentSongChanged;
            SessionManager.Destroy();
            SessionManager = null;

            InitializeAll();
        }
コード例 #3
0
        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");
        }