[MonoDevelop] Error

phejl phejl at lednice.org
Mon Mar 21 10:23:26 EDT 2011


Hello,

I have installed 2.10.1 and monodevelop 2.6.1b on Ubuntu.
I try to run the program below.

Compilation is OK.
While Rum there are two errors:

1.
The Console.ReadKey() does not work, it is ignored:

2.
It announces errors in GTK:
(:24124): Gdk-WARNING **: GdkWindow 0x360009f unexpectedly destroyed
(:24124): Gdk-WARNING **: GdkWindow 0x3600066 unexpectedly destroyed
(:24124): Gdk-WARNING **: GdkWindow 0x3600024 unexpectedly destroyed

The program is below.

Can You help?

Thanks in advence.

Petr

-----

using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text;
using System.Net;
using System.Web;
using System.Linq;
namespace Hlodacz
{
  public static class HtmlDocumentEx
  {
    public static IEnumerable Urls (this HtmlDocument document)
    {
      return
document.GetElementsByTagName("a").OfType().Select(htmlElement=>htmlElement.GetAttribute("href")).Where(href=>!string.IsNullOrEmpty(href));
    }
  }
  public static class WebBrowserEx
  {
    public static void DownloadUrl (this WebBrowser browser, string url)
    {
      browser.ScriptErrorsSuppressed = true;
      browser.Url = new Uri(url);
      // parse the HTML document containing login data
      do
        {
          Application.DoEvents();
        }
      while (browser.ReadyState != WebBrowserReadyState.Complete);
    }
  }
  class Program
  {
    [STAThread]
    static void Main(string[] args)
    {
      // int result_of_program;
      string www_address;
      // result_of_program=0;
      Console.WriteLine("Program.cs");
      /* foreach (string arg in args)
      {
        Console.WriteLine(arg);
      }
      Console.Write("Press any key.");
      Console.ReadLine(); */
      // www_address="http://www.milionovastranka.net";
      if (args.Length>0)
        {
          www_address = args[0];
        }
      else
        {
          Console.WriteLine("WWW address:");
          www_address = Console.ReadLine();
        }
      Console.Write("WWW address: ");
      Console.Write(www_address);
      Console.WriteLine();
      Console.Write("Press any key.");
      Console.ReadKey();
      Console.WriteLine();
      Console.WriteLine("Links:");
      Console.Write("Press any key.");
      Console.ReadKey();
      using (var browser = new WebBrowser())
        {
          browser.DownloadUrl(www_address);
          /* foreach (var line in browser.Document.Lines())
          {
            Console.WriteLine(line);
          } */
          foreach (var url in browser.Document.Urls())
            {
              Console.WriteLine(url);
            }
          Console.Write("Press any key.");
          Console.ReadKey();
        }
      // exit(result_of_program);
      // return result_of_program;
    }
  }
}


--
View this message in context: http://mono.1490590.n4.nabble.com/MonoDevelop-2-6-Beta-1-released-tp3330334p3393714.html
Sent from the Mono - MonoDevelop IDE mailing list archive at Nabble.com.


More information about the Monodevelop-list mailing list