|
I did think about a timer at first but I do not think it is a good decision because of the following:
1-
There is a separate event which gets fired everytime a new message is received (i.e. every few milliseconds).
At this time, a collection is populated with the data being recieved in the above event.
2-
I am thinking of having a separate thread in the windows service to constantly check the collection and delete items where necessary...
What do you think?
Thanks
|
|
|
|
|
The checking can be done on the background thread which the DoWork event is called on and any updates to the UI can be done by reporting progress.
Two problems here:
Once the DoWork handler method returns then the RunWorkerCompleted event fires and the thread will be closed so you would either need to a. Ensure the DoWork handler never returns or b. start a new BackgroundWorker/restart from the RunWorkerCompleted handler. This is why Pete suggested a timer as it can raise an event on a background thread periodically for you.
The background thread is going to be chewing up processor cycles if you just loop in your DoWork handler - this isn't a good idea! Sleeping the thread on each loop may be a quick solution to this - but still a timer makes more sense.
|
|
|
|
|
|
hi,
I have a MDI Parent From, MDI Child Form & a third Dialog Form.
I call a third Form by clicking a button using ShowDialog() placed in MDI Child.
I like to refresh MDI Child after closing that third Form...
but after closing of third Form,
MDI Parent fired Activated event instead of MDI Child ...!
Give the solution...
|
|
|
|
|
Manish_84 wrote: I call a third Form by clicking a button using ShowDialog() placed in MDI Child.
I like to refresh MDI Child after closing that third Form...
The ShowDialog method is blocking; you can refresh your MDI child right after the line where you show the dialog. Once the dialog is closed, execution will continue there.
Manish_84 wrote: Give the solution...
I are Troll
|
|
|
|
|
please advice me a simlple unzip method in C#
other than using Shell object...
note : zip file contains files and multiple folders
modified on Wednesday, January 5, 2011 1:57 AM
|
|
|
|
|
|
this will help me to unzip multiple folders??
|
|
|
|
|
Yes it is.
If you can unzip one folder then further you can unzip any number of folders, There are lot of features in a language of looping, Just change your program accordingly.
|
|
|
|
|
thanks
i will try hiren .. will let you know
|
|
|
|
|
me too. I have a project but It's don't work in this case.
|
|
|
|
|
|
thanks a lot ravi
its working
|
|
|
|
|
you are always welcome.
|
|
|
|
|
|
Is this a question?
Or is this an instruction?
If the former, then you forgot to include the bit explaining what your problem is.
If the later, you forgot you are not my employer.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
actually i struck in implementing site map by using recursion concept.
i need to develop user control for sitemap by using recursion if you have idea on that please let me know.
thanks.
|
|
|
|
|
What have you tried?
How far have you got?
Where are you stuck?
Sorry, but without these it is difficult to be at all specific!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
|
Couple of things:
1) When you post code fragments, use the "code block" widget not the "inline code" (That way you get <pre> tags instead of <code> tags. This preserves your formatting
inline code:
string SubUlHTML = "";<br />
if (node.HasChildNodes)<br />
{<br />
SubUlHTML = "<ul>";<br />
foreach (SiteMapNode childnode in node.ChildNodes)<br />
{<br />
SubUlHTML += GetNodeHTML(childnode);
code block:
string SubUlHTML = "";
if (node.HasChildNodes)
{
SubUlHTML = "<ul>";
foreach (SiteMapNode childnode in node.ChildNodes)
{
SubUlHTML += GetNodeHTML(childnode); Which would you rather read?
2) Looping isn't recursion. Recursion: See "Recursion".
For example: Factorials
In mathematics, the factorial of a positive integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,
5! = 5 x 4 x 3 x 2 x 1
0! is a special case that is explicitly defined to be 1.
Another way to write that is n! = n * (n-1)! while n > 1
To code this:
private int Factorial (int n)
{
if (n < 0)
{
throw new ArgumentException("Factorial not defined for negative numbers");
}
if (n == 0)
{
return 1;
}
return n * Factorial(n - 1);
}
Do you see the difference between that an a loop? If not, think about it. This is important!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Correct me if I'm wrong but are you not putting yourself in an infinite loop in your Factorial method?
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Consider yourself corrected!
private int Factorial (int n)
{
if (n < 0)
{
throw new ArgumentException("Factorial not defined for negative numbers");
}
if (n == 0)
{
return 1;
}
return n * Factorial(n - 1);
} If you call it with 3:
Factorial(3)
Calls Factorial(3 - 1): Factorial(2)
Calls Factorial(2 - 1): Factorial(1)
Calls Factorial(1 - 1): Factorial(0)
Which returns 1. You can add another special case @ either 2 or 1, but it looks clumsy for this example. Let's be honest, I wouldn't implement factorial this way in the real world anyway; it is just the classic example and easy to understand what is going on.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
My bad, I stand corrected
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
You should go through the bottom section of this[^] once before asking a question on a forum.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
Has anyone used rdpsign.exe with c#? Any compatibility issues with .net 3.0 or 3.5?
Any idea where I can download it? Or does anyone have a copy they can attach to the forum (as long as there is no TOS being violated)?
I have the 2008 enterprise iso file, but I do not find it inside of the iso?
Thanks!
|
|
|
|