Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonSerializer"></param>
        /// <param name="sessionManager"> </param>
        /// <param name="userDataManager"></param>
        /// <param name="libraryManager"> </param>
        /// <param name="logger"></param>
        /// <param name="httpClient"></param>
        /// <param name="appHost"></param>
        /// <param name="fileSystem"></param>
        public ServerMediator(IJsonSerializer jsonSerializer, ISessionManager sessionManager, IUserDataManager userDataManager, ILibraryManager libraryManager, ILogManager logger, IHttpClient httpClient, IServerApplicationHost appHost, IFileSystem fileSystem)
        {
            Instance = this;
            _sessionManager = sessionManager;
            _libraryManager = libraryManager;
            _logger = logger.GetLogger("Trakt");

            _traktApi = new TraktApi(jsonSerializer, _logger, httpClient, appHost, userDataManager, fileSystem);
            _service = new TraktUriService(_traktApi, _logger, _libraryManager);
            _libraryManagerEventsHelper = new LibraryManagerEventsHelper(_logger, _traktApi);
            _userDataManagerEventsHelper = new UserDataManagerEventsHelper(_logger, _traktApi);

            userDataManager.UserDataSaved += _userDataManager_UserDataSaved;
        }
Esempio n. 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonSerializer"></param>
        /// <param name="sessionManager"> </param>
        /// <param name="userDataManager"></param>
        /// <param name="libraryManager"> </param>
        /// <param name="logger"></param>
        /// <param name="httpClient"></param>
        /// <param name="fileSystem"></param>
        public ServerMediator(IJsonSerializer jsonSerializer, ISessionManager sessionManager, IUserDataManager userDataManager,
            ILibraryManager libraryManager, ILogManager logger, IHttpClient httpClient, IFileSystem fileSystem)
        {
            Instance = this;
            _sessionManager = sessionManager;
            _userDataManager = userDataManager;
            _libraryManager = libraryManager;
            _logger = logger.GetLogger("Trakt");
            _fileSystem = fileSystem;

            _traktApi = new TraktApi(jsonSerializer, _logger, httpClient);
            _service = new TraktUriService(_traktApi, _logger, _libraryManager);
            _libraryManagerEventsHelper = new LibraryManagerEventsHelper(_logger, _fileSystem, _traktApi);
            _progressEvents = new List<ProgressEvent>();
            _userDataManagerEventsHelper = new UserDataManagerEventsHelper(_logger, _traktApi);

            // TODO This should probably be elsewhere.
            UpdateUserRatingFormat();

            EnableUserDataSavedEventListener();
        }