public LoadingPage()
        {
            this.Loaded += (sender, e) =>
            {
                //ProgressBar
                progress = new ProgressBar();
                progress.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
                progress.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
                progress.IsIndeterminate = true;
                progress.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                progress.Width = 400;
                ((Grid)this.Content).Children.Add(progress);

                //Error
                error = new Error();
                error.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
                error.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Right;
                error.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                error.Margin = new Thickness(0, 0, 30, 0);
                ((Grid)this.Content).Children.Add(error);

                //OfflineError
                offlineError = new OfflineError();
                offlineError.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
                offlineError.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Right;
                offlineError.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                offlineError.Margin = new Thickness(0, 0, 130, 0);
                ((Grid)this.Content).Children.Add(offlineError);
            };
        }
        public NativeSessionCallbacks(NativeSession session)
        {
            _session = session;

            _connectionError = ConnectionErrorCallback;
            _endOfTrack = EndOfTrackCallback;
            _getAudioBufferStats = GetAudioBufferStatsCallback;
            _loggedIn = LoggedInCallback;
            _loggedOut = LoggedOutCallback;
            _logMessage = LogMessageCallback;
            _messageToUser = MessageToUserCallback;
            _metadataUpdated = MetadataUpdatedCallback;
            _musicDelivery = MusicDeliveryCallback;
            _notifyMainThread = NotifyMainThreadCallback;
            _playTokenLost = PlayTokenLostCallback;
            _startPlayback = StartPlaybackCallback;
            _stopPlayback = StopPlaybackCallback;
            _streamingError = StreamingErrorCallback;
            _userinfoUpdated = UserinfoUpdatedCallback;
            _offlineStatusUpdated = OfflineStatusUpdatedCallback;
            _offlineError = OfflineErrorCallback;
            _credentialsBlobUpdated = CredentialsBlobUpdatedCallback;
            _connectionStateUpdated = ConnectionStateUpdatedCallback;
            _scrobbleError = ScrobbleErrorCallback;
            _privateSessionModeChanged = PrivateSessionModeChangedCallback;

            _callbacks = new Spotify.SpotifySessionCallbacks();
            _callbacks.LoggedIn = Marshal.GetFunctionPointerForDelegate(_loggedIn);
            _callbacks.LoggedOut = Marshal.GetFunctionPointerForDelegate(_loggedOut);
            _callbacks.MetadataUpdated = Marshal.GetFunctionPointerForDelegate(_metadataUpdated);
            _callbacks.ConnectionError = Marshal.GetFunctionPointerForDelegate(_connectionError);
            _callbacks.MessageToUser = Marshal.GetFunctionPointerForDelegate(_messageToUser);
            _callbacks.NotifyMainThread = Marshal.GetFunctionPointerForDelegate(_notifyMainThread);
            _callbacks.MusicDelivery = Marshal.GetFunctionPointerForDelegate(_musicDelivery);
            _callbacks.PlayTokenLost = Marshal.GetFunctionPointerForDelegate(_playTokenLost);
            _callbacks.LogMessage = Marshal.GetFunctionPointerForDelegate(_logMessage);
            _callbacks.EndOfTrack = Marshal.GetFunctionPointerForDelegate(_endOfTrack);
            _callbacks.StreamingError = Marshal.GetFunctionPointerForDelegate(_streamingError);
            _callbacks.UserinfoUpdated = Marshal.GetFunctionPointerForDelegate(_userinfoUpdated);
            _callbacks.StartPlayback = Marshal.GetFunctionPointerForDelegate(_startPlayback);
            _callbacks.StopPlayback = Marshal.GetFunctionPointerForDelegate(_stopPlayback);
            _callbacks.GetAudioBufferStats = Marshal.GetFunctionPointerForDelegate(_getAudioBufferStats);
            _callbacks.OfflineStatusUpdated = Marshal.GetFunctionPointerForDelegate(_offlineStatusUpdated);
            _callbacks.OfflineError = Marshal.GetFunctionPointerForDelegate(_offlineError);
            _callbacks.CredentialsBlobUpdated = Marshal.GetFunctionPointerForDelegate(_credentialsBlobUpdated);
            _callbacks.ConnectionStateUpdated = Marshal.GetFunctionPointerForDelegate(_connectionStateUpdated);
            _callbacks.ScrobbleError = Marshal.GetFunctionPointerForDelegate(_scrobbleError);
            _callbacks.PrivateSessionModeChanged = Marshal.GetFunctionPointerForDelegate(_privateSessionModeChanged);

            _callbacksHandle = Marshal.AllocHGlobal(CallbacksSize);
            Marshal.StructureToPtr(_callbacks, _callbacksHandle, true);
        }
Exemple #3
0
        public NativeSessionCallbacks(NativeSession session)
        {
            _session = session;

            _connectionError           = ConnectionErrorCallback;
            _endOfTrack                = EndOfTrackCallback;
            _getAudioBufferStats       = GetAudioBufferStatsCallback;
            _loggedIn                  = LoggedInCallback;
            _loggedOut                 = LoggedOutCallback;
            _logMessage                = LogMessageCallback;
            _messageToUser             = MessageToUserCallback;
            _metadataUpdated           = MetadataUpdatedCallback;
            _musicDelivery             = MusicDeliveryCallback;
            _notifyMainThread          = NotifyMainThreadCallback;
            _playTokenLost             = PlayTokenLostCallback;
            _startPlayback             = StartPlaybackCallback;
            _stopPlayback              = StopPlaybackCallback;
            _streamingError            = StreamingErrorCallback;
            _userinfoUpdated           = UserinfoUpdatedCallback;
            _offlineStatusUpdated      = OfflineStatusUpdatedCallback;
            _offlineError              = OfflineErrorCallback;
            _credentialsBlobUpdated    = CredentialsBlobUpdatedCallback;
            _connectionStateUpdated    = ConnectionStateUpdatedCallback;
            _scrobbleError             = ScrobbleErrorCallback;
            _privateSessionModeChanged = PrivateSessionModeChangedCallback;

            _callbacks                           = new Spotify.SpotifySessionCallbacks();
            _callbacks.LoggedIn                  = Marshal.GetFunctionPointerForDelegate(_loggedIn);
            _callbacks.LoggedOut                 = Marshal.GetFunctionPointerForDelegate(_loggedOut);
            _callbacks.MetadataUpdated           = Marshal.GetFunctionPointerForDelegate(_metadataUpdated);
            _callbacks.ConnectionError           = Marshal.GetFunctionPointerForDelegate(_connectionError);
            _callbacks.MessageToUser             = Marshal.GetFunctionPointerForDelegate(_messageToUser);
            _callbacks.NotifyMainThread          = Marshal.GetFunctionPointerForDelegate(_notifyMainThread);
            _callbacks.MusicDelivery             = Marshal.GetFunctionPointerForDelegate(_musicDelivery);
            _callbacks.PlayTokenLost             = Marshal.GetFunctionPointerForDelegate(_playTokenLost);
            _callbacks.LogMessage                = Marshal.GetFunctionPointerForDelegate(_logMessage);
            _callbacks.EndOfTrack                = Marshal.GetFunctionPointerForDelegate(_endOfTrack);
            _callbacks.StreamingError            = Marshal.GetFunctionPointerForDelegate(_streamingError);
            _callbacks.UserinfoUpdated           = Marshal.GetFunctionPointerForDelegate(_userinfoUpdated);
            _callbacks.StartPlayback             = Marshal.GetFunctionPointerForDelegate(_startPlayback);
            _callbacks.StopPlayback              = Marshal.GetFunctionPointerForDelegate(_stopPlayback);
            _callbacks.GetAudioBufferStats       = Marshal.GetFunctionPointerForDelegate(_getAudioBufferStats);
            _callbacks.OfflineStatusUpdated      = Marshal.GetFunctionPointerForDelegate(_offlineStatusUpdated);
            _callbacks.OfflineError              = Marshal.GetFunctionPointerForDelegate(_offlineError);
            _callbacks.CredentialsBlobUpdated    = Marshal.GetFunctionPointerForDelegate(_credentialsBlobUpdated);
            _callbacks.ConnectionStateUpdated    = Marshal.GetFunctionPointerForDelegate(_connectionStateUpdated);
            _callbacks.ScrobbleError             = Marshal.GetFunctionPointerForDelegate(_scrobbleError);
            _callbacks.PrivateSessionModeChanged = Marshal.GetFunctionPointerForDelegate(_privateSessionModeChanged);

            _callbacksHandle = Marshal.AllocHGlobal(CallbacksSize);
            Marshal.StructureToPtr(_callbacks, _callbacksHandle, true);
        }
Exemple #4
0
 internal void OnOfflineError(SessionEventArgs e)
 {
     OfflineError.RaiseEvent(this, e);
 }