Exemplo n.º 1
0
        private void ShowTorrentDetails(DetailsContainer details)
        {
            SetAttachedSeries(null);

            if (!torrentDetailsWorker.IsBusy)
            {
                torrentDetailsWorker.RunWorkerAsync(details);
            }
        }
Exemplo n.º 2
0
        void torrentDetailsWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            DetailsContainer details = e.Argument as DetailsContainer;

            if (details == null)
            {
                return;
            }

            if (details.SearchCritera != null)
            {
                if (details.SearchCritera.SearchType == DownloadSearchType.Episode)
                {
                    AnimeEpisodeVM ep  = details.SearchCritera.SearchParameter as AnimeEpisodeVM;
                    AnimeSeriesVM  ser = MainListHelperVM.Instance.GetSeries(ep.AnimeSeriesID);
                    if (ser != null)
                    {
                        e.Result = ser;
                        return;
                    }
                }

                if (details.SearchCritera.SearchType == DownloadSearchType.Series)
                {
                    AniDB_AnimeVM anime = details.SearchCritera.SearchParameter as AniDB_AnimeVM;
                    AnimeSeriesVM ser   = MainListHelperVM.Instance.GetSeriesForAnime(anime.AnimeID);
                    if (ser != null)
                    {
                        e.Result = ser;
                        return;
                    }
                }
            }

            // try and find the series
            foreach (AniDB_AnimeVM anime in AniDB_AnimeVM.BestLevenshteinDistanceMatchesCache(details.TorLink.ClosestAnimeMatchString, 10))
            {
                // get the series for the anime
                AnimeSeriesVM ser = MainListHelperVM.Instance.GetSeriesForAnime(anime.AnimeID);
                if (ser != null)
                {
                    e.Result = ser;
                    return;
                }
            }

            e.Result = null;
        }
Exemplo n.º 3
0
        void dgTorrents_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid _DataGrid = sender as DataGrid;

            TorrentLinkVM torLink = _DataGrid.SelectedItem as TorrentLinkVM;

            if (torLink == null)
            {
                return;
            }

            DetailsContainer details = new DetailsContainer();

            details.TorLink       = torLink;
            details.SearchCritera = CurrentSearchCriteria;

            ShowTorrentDetails(details);
        }
		void dgTorrents_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			DataGrid _DataGrid = sender as DataGrid;

			TorrentLinkVM torLink = _DataGrid.SelectedItem as TorrentLinkVM;
			if (torLink == null) return;

			DetailsContainer details = new DetailsContainer();
			details.TorLink = torLink;
			details.SearchCritera = CurrentSearchCriteria;

			ShowTorrentDetails(details);
		}
		private void ShowTorrentDetails(DetailsContainer details)
		{
			SetAttachedSeries(null);

			if (!torrentDetailsWorker.IsBusy)
				torrentDetailsWorker.RunWorkerAsync(details);
		}