Click here to Skip to main content
16,004,944 members
Home / Discussions / C#
   

C#

 
GeneralRe: howto check a directory periodically Pin
pmarfleet19-Nov-07 3:09
pmarfleet19-Nov-07 3:09 
GeneralRe: howto check a directory periodically Pin
stephan_00719-Nov-07 2:12
stephan_00719-Nov-07 2:12 
GeneralRe: howto check a directory periodically Pin
stephan_00719-Nov-07 4:43
stephan_00719-Nov-07 4:43 
AnswerRe: howto check a directory periodically Pin
Luc Pattyn19-Nov-07 1:46
sitebuilderLuc Pattyn19-Nov-07 1:46 
Questionsearch a word Pin
RajeevKumarSharma19-Nov-07 0:21
RajeevKumarSharma19-Nov-07 0:21 
AnswerRe: search a word Pin
Sun Rays19-Nov-07 0:30
Sun Rays19-Nov-07 0:30 
AnswerRe: search a word Pin
Satish - Developer19-Nov-07 1:47
Satish - Developer19-Nov-07 1:47 
QuestionWCF thread problem Pin
User 269896718-Nov-07 23:57
User 269896718-Nov-07 23:57 
Hello,

I have the following problem: I have a WCF which gets informations from a HTML page, therefor I use a WebBrowser control. But anyway it sucks. How I do it:

1. Starting host => calls method for browsing
2. host gets data request from client => at the WCF a timer becomes started, so all x time units the method for browsing is called and the data is send to the client

1. is no problem, but at 2. I get a ThreadStateException when creating WebBrowser control. The calling thread is not STA and so on. So I thaught, I call the browsing method in a new thread, which StateApartment I set to STA. But it does not work: 1. no problem, but at 2. the thread never comes back. Has anybody an idea what the problem is or how to get it working??? Thanks for your help.

The calling of the browsing method:
Thread parserThread = new Thread(parse);<br />
parserThread.SetApartmentState(ApartmentState.STA);<br />
parserThread.Start(address);<br />
parserThread.Join();<br />
Console.WriteLine("after join"); // this point is only passed for 1., and and not for 2. !!! why???


The browsing method:
private void parse(object addressParameter)<br />
{<br />
  string address = addressParameter.ToString();<br />
  WebBrowser browser = new WebBrowser();<br />
  browser.DocumentCompleted +=<br />
    new WebBrowserDocumentCompletedEventHandler(OnDocumentCompleted);<br />
  try<br />
  {<br />
    this.documentCompleted = false;<br />
<br />
    browser.Navigate(new Uri(address));<br />
<br />
    while (!this.documentCompleted)<br />
    {<br />
      Application.DoEvents();<br />
      Thread.Sleep(1000);<br />
    }<br />
<br />
    HtmlDocument htmlDocument = browser.Document;<br />
<br />
    ...<br />
  }<br />
  catch (Exception ex)<br />
  {<br />
    Console.WriteLine(string.Format("Error in parse: {0}", ex));<br />
  }<br />
<br />
  browser.Dispose();<br />
} // parse


greets
pkoeppe
QuestionReal time processing using Threading Pin
Pankaj - Joshi18-Nov-07 23:01
Pankaj - Joshi18-Nov-07 23:01 
AnswerRe: Real time processing using Threading Pin
Bekjong18-Nov-07 23:14
Bekjong18-Nov-07 23:14 
GeneralRe: Real time processing using Threading Pin
Pankaj - Joshi18-Nov-07 23:19
Pankaj - Joshi18-Nov-07 23:19 
GeneralRe: Real time processing using Threading Pin
Bekjong18-Nov-07 23:41
Bekjong18-Nov-07 23:41 
GeneralRe: Real time processing using Threading Pin
Pankaj - Joshi19-Nov-07 16:34
Pankaj - Joshi19-Nov-07 16:34 
GeneralRe: Real time processing using Threading Pin
Bekjong19-Nov-07 22:21
Bekjong19-Nov-07 22:21 
Questioncall c# class from Java using JNI Pin
G.Makesh18-Nov-07 22:59
G.Makesh18-Nov-07 22:59 
AnswerRe: call c# class from Java using JNI Pin
duncanmhor18-Nov-07 23:04
duncanmhor18-Nov-07 23:04 
GeneralRe: call c# class from Java using JNI Pin
Laubi19-Nov-07 2:36
Laubi19-Nov-07 2:36 
AnswerRe: call c# class from Java using JNI Pin
Zamboch23-Nov-09 10:35
Zamboch23-Nov-09 10:35 
QuestionError-While sending Mail Pin
Satish - Developer18-Nov-07 22:40
Satish - Developer18-Nov-07 22:40 
AnswerRe: Error-While sending Mail Pin
duncanmhor18-Nov-07 22:46
duncanmhor18-Nov-07 22:46 
GeneralRe: Error-While sending Mail Pin
Satish - Developer18-Nov-07 22:55
Satish - Developer18-Nov-07 22:55 
GeneralRe: Error-While sending Mail Pin
duncanmhor18-Nov-07 23:01
duncanmhor18-Nov-07 23:01 
GeneralRe: Error-While sending Mail Pin
Satish - Developer18-Nov-07 23:31
Satish - Developer18-Nov-07 23:31 
AnswerRe: Error-While sending Mail Pin
Sun Rays19-Nov-07 0:18
Sun Rays19-Nov-07 0:18 
GeneralRe: Error-While sending Mail Pin
Satish - Developer19-Nov-07 0:27
Satish - Developer19-Nov-07 0:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.