Пример #1
0
        public MainViewModel(IThePirateBaySource thePirateBaySource,
                             ILogService logger,
                             ILeetxSource leetxSource,
                             IRargbSource rargbSource,
                             IKickassSource kickassSource,
                             TorrentInfoDialogViewModel torrentInfoDialogViewModel,
                             IUserConfiguration userConfiguration,
                             IAutoCompleteService autoCompleteService)
        {
            _torrentSourceDictionary = new Dictionary <TorrentSource, SourceInformation>();

            _unfilteredTorrentEntries = new List <TorrentEntry>();

            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _torrentInfoDialogViewModel = torrentInfoDialogViewModel ?? throw new ArgumentNullException(nameof(torrentInfoDialogViewModel));
            _userConfiguration          = userConfiguration ?? throw new ArgumentNullException(nameof(userConfiguration));
            _autoCompleteService        = autoCompleteService;

            AddTorrentSource(TorrentSource.ThePirateBay, thePirateBaySource, startPage: 0, siteName: "The Pirate Bay");
            AddTorrentSource(TorrentSource.Leetx, leetxSource, startPage: 1, siteName: "1337X");
            AddTorrentSource(TorrentSource.Kickass, kickassSource, startPage: 1, siteName: "Kickass Torrents");

            InitializeViewModel();

            LoadSettings();

            SetSourceAvailablitiesAsync();
        }
        public MainViewModel(IThePirateBaySource thePirateBaySource, ILogService logger, ILeetxSource leetxSource,
                             IRargbSource rargbSource,
                             TorrentInfoDialogViewModel torrentInfoDialogViewModel, IUserConfiguration userConfiguration)
        {
            _torrentSourceDictionary = new Dictionary <TorrentSource, SourceInformation>();

            _unfilteredTorrentEntries = new List <TorrentEntry>();

            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            _torrentInfoDialogViewModel = torrentInfoDialogViewModel ?? throw new ArgumentNullException(nameof(torrentInfoDialogViewModel));
            _userConfiguration          = userConfiguration ?? throw new ArgumentNullException(nameof(userConfiguration));

            AddTorrentSource(TorrentSource.ThePirateBay, thePirateBaySource, startPage: 0, sourceName: "The Pirate Bay");
            AddTorrentSource(TorrentSource.Leetx, leetxSource, startPage: 1, sourceName: "1337X");
            AddTorrentSource(TorrentSource.Rargb, rargbSource, startPage: 1, sourceName: "RARGB");

            InitializeViewModel();
            LoadSettings();
        }