public AuthController(ILogger <UserController.UserController> logger, IJwtService jwtService,
                       UserManager <User> userManager, ILoginHandler loginHandler, IRefreshTokenHandler refreshTokenHandler,
                       ILogoutHandler logoutHandler)
 {
     _logger              = logger;
     _jwtService          = jwtService;
     _userManager         = userManager;
     _loginHandler        = loginHandler;
     _refreshTokenHandler = refreshTokenHandler;
     _logoutHandler       = logoutHandler;
 }
Exemple #2
0
        public MainWindowViewModel(IChatService chatService, IMWVMCommandExecuteConditionsService mwvmCommandExecuteConditionsService,
                                   ILoginHandler loginHandler, ILogoutHandler logoutHandler, IDisconnectHandler disconnectHandler, IMessageHandler messageHandler,
                                   IReconnectHandler reconnectHandler, INotificationDialogWindowService notificationDialogWindowService, TaskFactory ctxTaskFactory)
        {
            if (ctxTaskFactory.Scheduler == null)
            {
                throw new ArgumentNullException(nameof(ctxTaskFactory.Scheduler));
            }

            _ctxTaskFactory = ctxTaskFactory;

            _chatService = chatService ?? throw new ArgumentNullException(nameof(chatService));
            _mwvmCommandExecuteConditionsService = mwvmCommandExecuteConditionsService ?? throw new ArgumentNullException(nameof(_mwvmCommandExecuteConditionsService));

            _loginHandler = loginHandler ?? throw new ArgumentNullException(nameof(loginHandler));
            _loginHandler.CtxTaskFactory = _ctxTaskFactory ?? throw new ArgumentNullException(nameof(_ctxTaskFactory));
            _loginHandler.Participants   = Participants ?? throw new ArgumentNullException(nameof(Participants));

            _logoutHandler = logoutHandler ?? throw new ArgumentNullException(nameof(logoutHandler));
            _logoutHandler.Participants = Participants ?? throw new ArgumentNullException(nameof(logoutHandler));

            _disconnectHandler = disconnectHandler ?? throw new ArgumentNullException(nameof(disconnectHandler));
            _disconnectHandler.Participants = Participants ?? throw new ArgumentNullException(nameof(disconnectHandler));

            _reconnectHandler = reconnectHandler ?? throw new ArgumentNullException(nameof(reconnectHandler));
            _reconnectHandler.Participants = Participants ?? throw new ArgumentNullException(nameof(reconnectHandler));

            _messageHandler = messageHandler ?? throw new ArgumentException(nameof(messageHandler));
            _messageHandler.CtxTaskFactory = _ctxTaskFactory ?? throw new ArgumentNullException(nameof(_ctxTaskFactory));
            _messageHandler.Participants   = Participants ?? throw new ArgumentNullException(nameof(Participants));

            _notificationDialogWindowService = notificationDialogWindowService ??
                                               throw new ArgumentNullException(nameof(notificationDialogWindowService));

            _chatService.NewMessage              += NewMessage;
            _chatService.ParticipantLoggedIn     += ParticipantLoggedIn;
            _chatService.ParticipantLoggedOut    += ParticipantLoggedOut;
            _chatService.ParticipantDisconnected += ParticipantDisconnection;
            _chatService.ParticipantReconnected  += ParticipantReconnection;
            _chatService.ConnectionReconnecting  += Reconnecting;
            _chatService.ConnectionReconnected   += Reconnected;
            _chatService.ConnectionClosed        += Disconnected;

            _minDisplayTime = TimeSpan.FromSeconds(Convert.ToInt32(File.ReadAllLines("time_config.cfg")[0])); // tutaj czytam długość blokady z configu
        }