Пример #1
0
        //

        public FileListViewModel(IFileService fileService, IAnimeService animeService)
        {
            _fileService  = fileService;
            _animeService = animeService;

            SelectionChangedCommand = new RelayCommand <IList>(items =>
            {
                if (items == null)
                {
                    return;
                }
                SelectedFiles = items.Cast <AnimeFile>().ToList();
            });

            //

            MoveCommand    = new RelayCommand(Move);
            DeleteCommand  = new RelayCommand(Delete);
            ProfileCommand = new RelayCommand(Profile);
            OpenCommand    = new RelayCommand(Open);
            CopyCommand    = new RelayCommand(() =>
            {
                Clipboard.Clear();
                Clipboard.SetText(string.Join(", ", SelectedFiles.Select(c => c.StrippedFilename)));
            });
            ClearFilterCommand = new RelayCommand(() => Filter = "");
            FolderCommand      = new RelayCommand(() => Process.Start(StartPath));
            MalCommand         = new RelayCommand(MyAnimeListProfile);
        }
Пример #2
0
 public NyaaPantsuService(ISettingsRepository settingsRepository, IAnimeRepository animeRepository, IAnimeService animeService)
 {
     SettingsRepository = settingsRepository;
     AnimeRepository    = animeRepository;
     AnimeService       = animeService;
     Downloader         = new WebClient();
 }
Пример #3
0
 public HorribleSubsService(ISettingsRepository settingsRepository, IAnimeRepository animeRepository, IAnimeService animeService)
 {
     SettingsRepository = settingsRepository;
     AnimeRepository    = animeRepository;
     AnimeService       = animeService;
     Downloader         = new WebClient();
 }
Пример #4
0
        public AnimeViewModel(IAnimeService animeService) : base()
        {
            _animeService       = animeService;
            _animeAPIEnumerator = new AnimeApiEnumerator();

            BindingOperations.EnableCollectionSynchronization(AnimeItems, _CollectionLock);
        }
Пример #5
0
 public UpdateAnimeTable(
     IAnimeService animeService,
     ILogger <UpdateAnimeTable> logger
     )
 {
     _animeService = animeService;
     _logger       = logger;
 }
Пример #6
0
 public TrendingViewModel(IAnimeService animeService)
 {
     _animeService = animeService;
     GetTrendings();
     FilterCommand  = new Command(ApplyFilter);
     IsNotConnected = Connectivity.NetworkAccess != NetworkAccess.Internet;
     Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
 }
Пример #7
0
 public OutputViewModel(ISettingsRepository settings, IFileService fileService,
                        IAnimeService animeService, IDownloadService downloadService)
 {
     _settings        = settings;
     _fileService     = fileService;
     _animeService    = animeService;
     _downloadService = downloadService;
 }
Пример #8
0
        //

        public ManageViewModel(ISettingsRepository settings, IFileService fileService, IAnimeService animeService)
        {
            _settings     = settings;
            _fileService  = fileService;
            _animeService = animeService;
            _settings.PathConfig.PropertyChanged += (sender, args) => LoadFolders();
            LoadFolders();
        }
Пример #9
0
        //

        public DiscoverViewModel(IFindSeasonAnimeService findService, IAnimeService animeService)
        {
            _findService  = findService;
            _animeService = animeService;
            AddCommand    = new RelayCommand(Add);

            MessengerInstance.Register <ViewRequest>(this, HandleViewAction);
        }
Пример #10
0
        //

        public DetailsViewModel(IAnimeRepository animeRepository, ISettingsRepository settingsRepository, IAnimeService animeService)
        {
            AnimeRepository    = animeRepository;
            SettingsRepository = settingsRepository;
            _animeService      = animeService;

            // Behaviors that are the same no matter what condition
            ClearSubgroupCommand = new RelayCommand(() => Anime.PreferredSubgroup = null);
        }
        /// <summary>
        /// 根据分片条目创建媒体来源
        /// </summary>
        /// <param name="video">视频</param>
        /// <param name="audio">音频</param>
        /// <returns></returns>
        public async static Task <MediaSource> CreateMediaSourceAsync(this IAnimeService animeService, VideoDashItem video, VideoDashItem audio)
        {
            try
            {
                HttpClient httpClient = new HttpClient();
                httpClient.DefaultRequestHeaders.Referer = new Uri("https://www.bilibili.com");
                httpClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
                var mpdStr = $@"<MPD xmlns=""urn:mpeg:DASH:schema:MPD:2011""  profiles=""urn:mpeg:dash:profile:isoff-on-demand:2011"" type=""static"">
                                  <Period  start=""PT0S"">
                                    <AdaptationSet>
                                      <ContentComponent contentType=""video"" id=""1"" />
                                      <Representation bandwidth=""{video.bandwidth}"" codecs=""{video.codecs}"" height=""{video.height}"" id=""{video.id}"" mimeType=""{video.mimeType}"" width=""{video.width}"">
                                        <BaseURL></BaseURL>
                                        <SegmentBase indexRange=""{video.SegmentBase.indexRange}"">
                                          <Initialization range=""{video.SegmentBase.Initialization}"" />
                                        </SegmentBase>
                                      </Representation>
                                    </AdaptationSet>
                                    {{audio}}
                                  </Period>
                                </MPD>
                                ";
                if (audio == null)
                {
                    mpdStr = mpdStr.Replace("{audio}", "");
                }
                else
                {
                    mpdStr = mpdStr.Replace("{audio}", $@"<AdaptationSet>
                                      <ContentComponent contentType=""audio"" id=""2"" />
                                      <Representation bandwidth=""{audio.bandwidth}"" codecs=""{audio.codecs}"" id=""{audio.id}"" mimeType=""{audio.mimeType}"" >
                                        <BaseURL></BaseURL>
                                        <SegmentBase indexRange=""{audio.SegmentBase.indexRange}"">
                                          <Initialization range=""{audio.SegmentBase.Initialization}"" />
                                        </SegmentBase>
                                      </Representation>
                                    </AdaptationSet>");
                }
                var stream = new MemoryStream(Encoding.UTF8.GetBytes(mpdStr)).AsInputStream();
                var soure  = await AdaptiveMediaSource.CreateFromStreamAsync(stream, new Uri(video.baseUrl), "application/dash+xml", httpClient);

                var s = soure.Status;
                soure.MediaSource.DownloadRequested += (sender, args) =>
                {
                    if (args.ResourceContentType == "audio/mp4" && audio != null)
                    {
                        args.Result.ResourceUri = new Uri(audio.baseUrl);
                    }
                };
                return(MediaSource.CreateFromAdaptiveMediaSource(soure.MediaSource));
            }
            catch (Exception)
            {
                return(null);
            }
        }
Пример #12
0
        public SettingsViewModel(IAnimeService animeService, IMangaService mangaService, IRunJobs <DWOneImportJob> dwOneImportJob, IRunJobs <UpdateDbEntries> updateDbEntriesJob, IDefineCanvasRoutines <Chart> canvasRoutines)
        {
            this.animeService       = animeService;
            this.mangaService       = mangaService;
            this.dwOneImportJob     = dwOneImportJob;
            this.updateDbEntriesJob = updateDbEntriesJob;
            this.canvasRoutines     = canvasRoutines;

            LogEvent.LogLineReceived += LogLineReceivedFunc;
        }
Пример #13
0
        //

        public AnimeListViewModel(ISettingsRepository settings, IAnimeService animeService)
        {
            _animeService = animeService;
            Settings      = settings;

            //

            Find = new FindViewModel();
            Find.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName.Equals("Text"))
                {
                    if (Find.Text.Equals(""))
                    {
                        Animes = new ObservableCollection <Anime>(_animeService.FilteredAndSorted());
                    }
                    else
                    {
                        Animes =
                            new ObservableCollection <Anime>(
                                _animeService.FilteredAndSorted().Where(
                                    a => a.Name.ToLower().Contains(Find.Text.ToLower())));
                    }
                }
            };

            FilterText = Settings.FilterBy;
            Animes     = new ObservableCollection <Anime>(_animeService.FilteredAndSorted());

            //

            SelectionChangedCommand = new RelayCommand <IList>(items =>
            {
                if (items == null)
                {
                    return;
                }
                SelectedAnimes = items.Cast <Anime>().ToList();
            });

            FindToggleCommand = new RelayCommand(() => Find.Toggle());

            AddCommand         = new RelayCommand(Add);
            AddMultipleCommand = new RelayCommand(AddMultiple);
            EditCommand        = new RelayCommand(Edit);
            DeleteCommand      = new RelayCommand(Delete);
            SearchCommand      = new RelayCommand(Search);
            CopyCommand        = new RelayCommand(() =>
            {
                Clipboard.Clear();
                Clipboard.SetText(string.Join(", ", SelectedAnimes.Select(c => c.Title)));
            });
        }
Пример #14
0
 public AnimeController(
     IAnimeService animeService,
     IBookmarkService bookmarkService,
     IEpisodeService episodeService,
     IMapper mapper
     )
 {
     _animeService    = animeService;
     _bookmarkService = bookmarkService;
     _episodeService  = episodeService;
     _mapper          = mapper;
 }
Пример #15
0
 public CartController(IAccountService _accountService, IProductService _productService, IImageService _imageService,
                       IManufactorService _manufactorService, ICategoryService _categoryService, IAnimeService _animeService, ITagService _tagService, IOrderProductService _orderProductService,
                       IOrderService _orderService)
 {
     this._accountService      = _accountService;
     this._productService      = _productService;
     this._imageService        = _imageService;
     this._manufactorService   = _manufactorService;
     this._categoryService     = _categoryService;
     this._animeService        = _animeService;
     this._orderProductService = _orderProductService;
     this._orderService        = _orderService;
 }
Пример #16
0
 public HomeController(
     IAnimeService animeService,
     IUpdateService updateService,
     IAnimeReccomendationsService animeReccomendationsService,
     UserManager <ApplicationUser> userManager,
     IMangaService mangaService)
 {
     this.animeService  = animeService;
     this.updateService = updateService;
     this.animeReccomendationsService = animeReccomendationsService;
     this.userManager  = userManager;
     this.mangaService = mangaService;
 }
Пример #17
0
 public void Init()
 {
     _settings = new MockXmlSettingsService
     {
         MyAnimeListConfig =
             new MyAnimeListConfiguration
         {
             Username = Credentials.MyAnimeListName,
             Password = Credentials.MyAnimeListPassword
         }
     };
     _api    = new MyAnimeListApi(_settings);
     _animes = new MockAnimeService();
     _mal    = new MyAnimeListService(_api, _animes);
 }
Пример #18
0
 public BiliBiliClient(
     TokenPackage tokenPackage,
     IAccountService accountService,
     IChannelService channelService,
     ITopicService topicService,
     IVideoService videoService,
     IAnimeService animeService)
 {
     BiliTool._accessToken = tokenPackage.AccessToken;
     Account = accountService;
     Channel = channelService;
     Topic   = topicService;
     Video   = videoService;
     Anime   = animeService;
 }
Пример #19
0
 public MiscViewModel(ICredentialsRepository credentialsRepository,
                      IAnimeRepository animeRepository,
                      IAnimeService animeService,
                      IDetailProviderService detailService,
                      IFileService fileService,
                      ISettingsRepository settingsRepository)
 {
     _credentialsRepository = credentialsRepository;
     _animeRepository       = animeRepository;
     _animeService          = animeService;
     _detailService         = detailService;
     _fileService           = fileService;
     _settingsRepository    = settingsRepository;
     SelectedIndex          = 0;
     SubmitCommand          = new RelayCommand(DoAction, () => !DoingAction);
     //
 }
Пример #20
0
 public AdminController(IAccountService _accountService, IProductService _productService, IImageService _imageService,
                        IManufactorService _manufactorService, ICategoryService _categoryService, IAnimeService _animeService, IStatusService _statusService
                        , IBlogService _blogService, IProductTagService _productTagService, ITagService _tagService, IWebsiteAttributeService _websiteAttributeService
                        , IMessageSendingService _messageSendingService, IFAQService _faqService)
 {
     this._accountService          = _accountService;
     this._productService          = _productService;
     this._imageService            = _imageService;
     this._manufactorService       = _manufactorService;
     this._categoryService         = _categoryService;
     this._animeService            = _animeService;
     this._statusService           = _statusService;
     this._blogService             = _blogService;
     this._productTagService       = _productTagService;
     this._tagService              = _tagService;
     this._websiteAttributeService = _websiteAttributeService;
     this._messageSendingService   = _messageSendingService;
     this._faqService              = _faqService;
 }
Пример #21
0
        public WebViewModel(ICredentialsRepository credentialsRepository,
                            IAnimeRepository animeRepository,
                            IAnimeService animeService,
                            ISyncProviderService syncService,
                            IMyAnimeListApi api,
                            IDownloadService downloadService)
        {
            DownloadService        = downloadService;
            _credentialsRepository = credentialsRepository;
            _animeRepository       = animeRepository;
            _animeService          = animeService;
            _syncService           = syncService;
            _api = api;

            //

            SetCommands();
            CheckSyncAndLog();

            MessengerInstance.Register <Request>(this, HandleRequest);
            MessengerInstance.Register <ViewRequest>(this, HandleViewAction);
        }
Пример #22
0
 public AnimeController(IAnimeService animeService, ILoggingService loggingService) : base(loggingService)
 {
     this.animeService = animeService;
 }
 public AnimeController(ILogger <AnimeController> logger, IAnimeService animeService)
 {
     _logger       = logger;
     _animeService = animeService;
 }
Пример #24
0
 public AnimesController(IAnimeService animeservice)
 {
     _animeservice = animeservice;
 }
Пример #25
0
 // コンストラクタインジェクション例。
 public AnimeListController(IAnimeService animeService)
 {
     AnimeService = animeService;
 }
Пример #26
0
 public AnimesController(IAnimeService service) => _service = service;
        //

        public DetailsMultipleViewModel(IAnimeService animeService) => _animeService = animeService;
Пример #28
0
 public IndexController(IAnimeService animeService)
 {
     _animeService = animeService;
 }
Пример #29
0
        //

        public MyAnimeListService(IMyAnimeListApi api, IAnimeService anime)
        {
            _api   = api;
            _anime = anime;
        }
Пример #30
0
 public AnimesController(IAnimeService animeService, IMapper mapper)
 {
     _animeService = animeService;
     _mapper       = mapper;
 }