Пример #1
0
        void searchTraktWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                SearchTraktResults res = e.Result as SearchTraktResults;
                if (!string.IsNullOrEmpty(res.ErrorMessage))
                {
                    //MessageBox.Show()
                    SearchStatus = res.ErrorMessage;
                    return;
                }

                foreach (CrossRef_AniDB_TraktVMV2 tvxref in res.TraktLinks)
                {
                    TraktResults.Add(tvxref);
                }

                SearchStatus = string.Empty;
                if (!string.IsNullOrEmpty(res.ExtraInfo))
                {
                    SearchStatus = res.ExtraInfo;
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
                btnRandomAnime.IsEnabled = true;
                btnSearch.IsEnabled      = true;
            }
        }
Пример #2
0
        void searchTraktWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            SearchTraktResults res = new SearchTraktResults();

            res.ErrorMessage = string.Empty;
            res.TraktLinks   = new List <CrossRef_AniDB_TraktVMV2>();
            res.ExtraInfo    = string.Empty;

            try
            {
                SearchCriteria crit = e.Argument as SearchCriteria;
                if (!string.IsNullOrEmpty(crit.ExtraInfo))
                {
                    res.ExtraInfo = crit.ExtraInfo;
                }

                try
                {
                    List <JMMServerBinary.Contract_Azure_CrossRef_AniDB_Trakt> xrefs = JMMServerVM.Instance.clientBinaryHTTP.GetTraktCrossRefWebCache(crit.AnimeID, true);
                    if (xrefs != null && xrefs.Count > 0)
                    {
                        foreach (JMMServerBinary.Contract_Azure_CrossRef_AniDB_Trakt xref in xrefs)
                        {
                            CrossRef_AniDB_TraktVMV2 xrefAzure = new CrossRef_AniDB_TraktVMV2(xref);
                            res.TraktLinks.Add(xrefAzure);
                        }
                    }
                }
                catch (Exception ex)
                {
                    res.ErrorMessage = ex.Message;
                }

                e.Result = res;
            }
            catch (Exception ex)
            {
                res.ErrorMessage = ex.Message;
                e.Result         = res;
            }
        }
        void searchTraktWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            SearchTraktResults res = new SearchTraktResults();
            res.ErrorMessage = string.Empty;
            res.TraktLinks = new List<CrossRef_AniDB_TraktVMV2>();
            res.ExtraInfo = string.Empty;

            try
            {
                SearchCriteria crit = e.Argument as SearchCriteria;
                if (!string.IsNullOrEmpty(crit.ExtraInfo))
                    res.ExtraInfo = crit.ExtraInfo;

                try
                {
                    List<JMMServerBinary.Contract_Azure_CrossRef_AniDB_Trakt> xrefs = JMMServerVM.Instance.clientBinaryHTTP.GetTraktCrossRefWebCache(crit.AnimeID, true);
                    if (xrefs != null && xrefs.Count > 0)
                    {
                        foreach (JMMServerBinary.Contract_Azure_CrossRef_AniDB_Trakt xref in xrefs)
                        {
                            CrossRef_AniDB_TraktVMV2 xrefAzure = new CrossRef_AniDB_TraktVMV2(xref);
                            res.TraktLinks.Add(xrefAzure);
                        }
                    }
                }
                catch (Exception ex)
                {
                    res.ErrorMessage = ex.Message;
                }

                e.Result = res;
            }
            catch (Exception ex)
            {
                res.ErrorMessage = ex.Message;
                e.Result = res;
            }
        }