Ejemplo n.º 1
0
        void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            HasWebCacheRec = false;
            CrossRef_AniDB_MALResult.Clear();

            if (!VM_ShokoServer.Instance.ServerOnline)
            {
                return;
            }

            Cursor = Cursors.Wait;
            try
            {
                // first find what the community recommends

                VM_CrossRef_AniDB_MAL_Response xref = (VM_CrossRef_AniDB_MAL_Response)VM_ShokoServer.Instance.ShokoServices.GetMALCrossRefWebCache(AnimeID);
                if (xref != null)
                {
                    CrossRef_AniDB_MALResult.Add(xref);
                    HasWebCacheRec = true;
                }

                // now search MAL
                MALSearchResults = VM_ShokoServer.Instance.ShokoServices.SearchMAL(txtSearch.Text.Replace("`", "'").Trim()).CastList <VM_MALAnime_Response>();
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                Cursor = Cursors.Arrow;
            }
        }
Ejemplo n.º 2
0
        void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            HasWebCacheRec = false;
            CrossRef_AniDB_MALResult.Clear();

            if (!JMMServerVM.Instance.ServerOnline)
            {
                return;
            }

            this.Cursor = Cursors.Wait;
            try
            {
                // first find what the community recommends

                List <JMMServerBinary.Contract_CrossRef_AniDB_MALResult> xrefs = JMMServerVM.Instance.clientBinaryHTTP.GetMALCrossRefWebCache(AnimeID);
                if (xrefs != null)
                {
                    foreach (JMMServerBinary.Contract_CrossRef_AniDB_MALResult xref in xrefs)
                    {
                        CrossRef_AniDB_MALResult.Add(new CrossRef_AniDB_MALResultVM(xref));
                        HasWebCacheRec = true;
                    }
                }

                // now search MAL
                MALSearchResults = new List <MALSearchResultVM>();
                List <JMMServerBinary.Contract_MALAnimeResponse> malResults = JMMServerVM.Instance.clientBinaryHTTP.SearchMAL(txtSearch.Text.Trim());
                foreach (JMMServerBinary.Contract_MALAnimeResponse malResult in malResults)
                {
                    MALSearchResults.Add(new MALSearchResultVM(malResult));
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }