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

            if (!torrentDetailsWorker.IsBusy)
            {
                torrentDetailsWorker.RunWorkerAsync(details);
            }
        }
        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)
                {
                    VM_AnimeEpisode_User ep  = details.SearchCritera.Episode as VM_AnimeEpisode_User;
                    VM_AnimeSeries_User  ser = VM_MainListHelper.Instance.GetSeries(ep.AnimeSeriesID);
                    if (ser != null)
                    {
                        e.Result = ser;
                        return;
                    }
                }

                if (details.SearchCritera.SearchType == DownloadSearchType.Series)
                {
                    VM_AniDB_Anime      anime = details.SearchCritera.Anime as VM_AniDB_Anime;
                    VM_AnimeSeries_User ser   = VM_MainListHelper.Instance.GetSeriesForAnime(anime.AnimeID);
                    if (ser != null)
                    {
                        e.Result = ser;
                        return;
                    }
                }
            }

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

            e.Result = null;
        }
        void dgTorrents_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid _DataGrid = sender as DataGrid;

            TorrentLink torLink = _DataGrid.SelectedItem as TorrentLink;

            if (torLink == null)
            {
                return;
            }

            DetailsContainer details = new DetailsContainer();

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

            ShowTorrentDetails(details);
        }