Пример #1
0
        // All kind of stuff because of the wait cursor ;-)
        private void DownloadWorker(object sender, DoWorkEventArgs e)
        {
            Thread.CurrentThread.Name = "Wikipedia";
            _workerCompleted          = false;

            using (WaitCursor cursor = new WaitCursor())
            {
                lock (this)
                {
                    if (!txtArticle.IsVisible)
                    {
                        GUIControl.ShowControl(GetID, txtArticle.GetID);
                    }
                    if (imageControl.IsVisible)
                    {
                        GUIControl.HideControl(GetID, imageControl.GetID);
                    }
                    if (!searchtermLabel.IsVisible)
                    {
                        GUIControl.ShowControl(GetID, searchtermLabel.GetID);
                    }
                    if (imagedescLabel.IsVisible)
                    {
                        GUIControl.HideControl(GetID, imagedescLabel.GetID);
                    }
                    if (buttonBack.IsVisible)
                    {
                        GUIControl.HideControl(GetID, buttonBack.GetID);
                    }
                    linkArray.Clear();
                    imagenameArray.Clear();
                    imagedescArray.Clear();
                    searchtermLabel.Label = e.Argument.ToString();
                    WikipediaArticle article = new WikipediaArticle(e.Argument.ToString(), language);
                    articletext    = article.GetArticleText();
                    linkArray      = article.GetLinkArray();
                    imagenameArray = article.GetImageArray();
                    imagedescArray = article.GetImagedescArray();
                    language       = article.GetLanguage();

                    if (articletext == "REDIRECT")
                    {
                        txtArticle.Label = GUILocalizeStrings.Get(2509) + "\n" + GUILocalizeStrings.Get(2510);
                        //This page is only a redirect. Please chose the redirect aim from the link list.
                    }
                    else if (articletext == string.Empty)
                    {
                        txtArticle.Label = GUILocalizeStrings.Get(2504); //Sorry, no Article was found for your searchterm...
                    }
                    else
                    {
                        txtArticle.Label = articletext;
                    }
                }
            }

            _workerCompleted = true;
        }
Пример #2
0
    // All kind of stuff because of the wait cursor ;-)
    private void DownloadWorker(object sender, DoWorkEventArgs e)
    {
      Thread.CurrentThread.Name = "Wikipedia";
      _workerCompleted = false;

      using (WaitCursor cursor = new WaitCursor())
      {
        lock (this)
        {
          if (!txtArticle.IsVisible)
          {
            GUIControl.ShowControl(GetID, txtArticle.GetID);
          }
          if (imageControl.IsVisible)
          {
            GUIControl.HideControl(GetID, imageControl.GetID);
          }
          if (!searchtermLabel.IsVisible)
          {
            GUIControl.ShowControl(GetID, searchtermLabel.GetID);
          }
          if (imagedescLabel.IsVisible)
          {
            GUIControl.HideControl(GetID, imagedescLabel.GetID);
          }
          if (buttonBack.IsVisible)
          {
            GUIControl.HideControl(GetID, buttonBack.GetID);
          }
          linkArray.Clear();
          imagenameArray.Clear();
          imagedescArray.Clear();
          searchtermLabel.Label = e.Argument.ToString();
          WikipediaArticle article = new WikipediaArticle(e.Argument.ToString(), language);
          articletext = article.GetArticleText();
          linkArray = article.GetLinkArray();
          imagenameArray = article.GetImageArray();
          imagedescArray = article.GetImagedescArray();
          language = article.GetLanguage();

          if (articletext == "REDIRECT")
          {
            txtArticle.Label = GUILocalizeStrings.Get(2509) + "\n" + GUILocalizeStrings.Get(2510);
            //This page is only a redirect. Please chose the redirect aim from the link list.
          }
          else if (articletext == string.Empty)
          {
            txtArticle.Label = GUILocalizeStrings.Get(2504); //Sorry, no Article was found for your searchterm...
          }
          else
          {
            txtArticle.Label = articletext;
          }
        }
      }

      _workerCompleted = true;
    }