Exemplo n.º 1
0
 /// <summary>
 /// Adds user info the crash logger.
 /// </summary>
 /// <param name="user">Logged user</param>
 /// <returns>This instance</returns>
 public CrashManager SetUser(VpdbUserFull user)
 {
     _raygun.UserInfo = new RaygunIdentifierMessage(user.Id) {
         IsAnonymous = false,
         FullName = user.Name,
         Email = user.Email
     };
     return this;
 }
Exemplo n.º 2
0
		private void OnValidationResult(VpdbUserFull user)
		{
			System.Windows.Application.Current.Dispatcher.Invoke(delegate {
				if (user != null) {
					_apiAuthenticated.OnNext(user);
					AuthenticatedUser = user;
				} else {
					_apiAuthenticated.OnNext(null);
					AuthenticatedUser = null;
				}
			});
		}
Exemplo n.º 3
0
        /// <summary>
        /// Connects to Pusher and subscribes to the user's private channel.
        /// </summary>
        /// <param name="user"></param>
        private void SetupPusher(VpdbUserFull user)
        {
            // initialize pusher
            if (_pusher == null) {
                _pusher = new Pusher(user.ChannelConfig.ApiKey, new PusherOptions() {
                    Encrypted = true,
                    Authorizer = new PusherAuthorizer(this, _crashManager, _logger)
                });
            }

            var isNewConnection = _connectedApiEndpoint == null;
            var isSameConnection = !isNewConnection && _connectedApiEndpoint.Equals(_settingsManager.Settings.Endpoint);
            var isDifferentConnection = !isNewConnection && !isSameConnection;

            if (isNewConnection) {
                _logger.Info("Setting up Pusher...");

                _pusher.ConnectionStateChanged += PusherConnectionStateChanged;
                _pusher.Error += PusherError;

                _pusher.Connect();
            }

            if (isDifferentConnection) {
                _logger.Info("Unsubscribing from previous channel.");
                _userChannel.Unsubscribe();
            }

            if (isNewConnection || isDifferentConnection) {
                _logger.Info("Subscribing to user channel.");
                _userChannel = _pusher.Subscribe("private-user-" + user.Id);
                _userChannel.Subscribed += PusherSubscribed;
            }

            _connectedApiEndpoint = _settingsManager.Settings.Endpoint;
        }