private void Initialize()
        {
            sourceAppInfo = SourceAppInfo.FromAppUserModelId(GSMTCSession.SourceAppUserModelId);
            if (sourceAppInfo != null)
            {
                sourceAppInfo.InfoFetched += SourceAppInfo_InfoFetched;
                sourceAppInfo.FetchInfosAsync();
                ActivateMediaSourceCommand = new RelayCommand(sourceAppInfo.Activate, () => sourceAppInfo != null);
            }

            GSMTCSession.MediaPropertiesChanged    += GSMTCSession_MediaPropertiesChanged;
            GSMTCSession.PlaybackInfoChanged       += GSMTCSession_PlaybackInfoChanged;
            GSMTCSession.TimelinePropertiesChanged += GSMTCSession_TimelinePropertiesChanged;

            UpdateSessionInfo(GSMTCSession);
        }
        private void Initialize()
        {
            if (NPSession == null)
            {
                throw new NullReferenceException(nameof(NPSession));
            }

            try
            {
                sourceAppId = NPSession.SourceAppId;
            }
            catch { }

            sourceAppInfo = SourceAppInfo.FromData(new SourceAppInfoData()
            {
                AppUserModelId   = sourceAppId,
                ProcessId        = NPSession.PID,
                MainWindowHandle = NPSession.Hwnd,
                DataType         = SourceAppInfoDataType.FromProcessId
            });

            if (sourceAppInfo != null)
            {
                sourceAppInfo.InfoFetched += SourceAppInfo_InfoFetched;
                sourceAppInfo.FetchInfosAsync();
                ActivateMediaSourceCommand = new RelayCommand(sourceAppInfo.Activate, () => sourceAppInfo != null);
            }

            mediaPlaybackDataSource = NPSession.ActivateMediaPlaybackDataSource();

            if (mediaPlaybackDataSource == null)
            {
                throw new InvalidOperationException(nameof(mediaPlaybackDataSource) + " should not be null");
            }

            mediaPlaybackDataSource.MediaPlaybackDataChanged += MediaPlaybackDataSource_MediaPlaybackDataChanged;

            UpdateSessionInfo();
        }