|
Thanks for your help.
Works great.
|
|
|
|
|
Hello everyone,
What is the most convenient way to check whether elapsed time from some time point to another time point is larger than 2 seconds?
Currently, I am using TimeSpan, and I am using stupid method to check hour/minute/second one by one to decide. Are there any quick way to check?
thanks in advance,
George
|
|
|
|
|
Just use TotalSeconds:
DateTime start = ???;
DateTime now = ???;
TimeSpan difference = now-start;
if(difference.TotalSeconds > 2)
more that two seconds longer
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Cool, SK!
regards,
George
|
|
|
|
|
Hi,
DateTime check=DateTime.Now.AddSeconds(2);
...
if(DateTime.Now>check) doSomething();
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Cool, Luc!
regards,
George
|
|
|
|
|
<br />
System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch() ;<br />
<br />
timer.Reset() ;
timer.Start() ;<br />
<br />
<br />
timer.Stop() ;<br />
<br />
|
|
|
|
|
|
I find it easier to use.
But read the documentation. It has greater precision which may not be important in this case, but maybe down the line you'll find you need it.
|
|
|
|
|
Cool, thanks PIEBALDconsult!
regards,
George
|
|
|
|
|
Is it possible to somehow draw text on an image with an inverted color? I basically want to make a small timestamp that always shows up, and I don't want to resort to putting it in a colored rectangle if I can avoid it.
I've got access to framework 3.5 if that helps.
|
|
|
|
|
Im not entirely certain that would be very readable either, with the changing colour and whatnot. What about an outline around the text?
EDIT: But, if you want inverted text, then how about:
ImageOne - original image
ImageTwo - empty image with same dimensions as ImageOne, white background
ImageThree - Duplicate of ImageOne
Step one:
Draw Text to ImageTwo in black
Step two:
Invert the colour of ImageThree
Step three:
Read the colour of each pixel in ImageTwo.
If the colour is WHITE, then set the same pixel in ImageThree to bright pink or something (255,0,255)
Step four:
Set the transparency key of ImageThree to the same colour as before (in this case, [255,0,255])
Step five:
Draw ImageThree on to ImageOne
My current favourite word is: Bacon!
-SK Genius
modified on Saturday, April 12, 2008 11:02 AM
|
|
|
|
|
I have a web browser control in my program, and I'm change its url property to different urls, via a foreach loop.
Now, the problem is, that the "Document Loaded" event only fires for the last url in the list, and the only page you eventually see is the last, what i want is kind of a slide-show effect.
is there any way to force the control to pause the loop and fire the event for each of the urls in my collection?
|
|
|
|
|
Instead of using a for loop, why not use a timer with an interval of <insert time you want each page to be displayed here> and change the url on each pass through, you could do something like:
Timer()
{
static int counter = 0;
switch(counter) {
case 0:
navigate to url
break;
case 1:
navigate to url
break;
case 2:
navigate to url
break;
case 3:
navigate to url
break;
default:
counter = 0;
myTimer.Stop();
break;
}
counter++;
}
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
this might work, but if some site takes extremly long to load (or longer than usual) then the slideshow might miss a website, or show it for too long/too little.
what i want is for the browser to sort of pause the thread, untill the website hes showing is loaded completly, is this possible?
|
|
|
|
|
Okay then, how about using the DocumentCompleted event:
DocumentCompleted()
{
myTimer.Start();
}
Timer()
{
static int counter = 0;
switch(counter) {
case 0:
navigate to url
break;
case 1:
navigate to url
break;
case 2:
navigate to url
break;
case 3:
navigate to url
break;
default:
counter = 0;
break;
}
counter++;
myTimer.Stop();
}
That way, the set amout of time will pass, then the page will change and the timer will stop. Once the page is loaded the timer will start again. After the set amount of time passes again it will navigate to the new page then stop the timer... and so on.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
|
Good Day,
I've been searching for it in Google for like 2 hours but can't hit the proper keyword.
I have a Windows Form with a Listbox on it. When I drag a file from the desktop inside the Windows form, I want to have the path of the file added to the listbox.
Is there an article or a guide on how to accomplish such feat?
Thanks!
|
|
|
|
|
|
|
I do my project(softphone) with code "AsteriskIAXClientWrapper" and i have a problem when i compile my project for connexion to my server Asterisk one exception ( that is : "ConfigurationErrorsException was Unhaldled" )figure in this line : "return ((int)(this["ConfigStatus"])) "
we can help me?
Thank you
|
|
|
|
|
What is AsteriskIAXClientWrapper ? If it's an article, ask the author ? If it's a third party library, ask the vendor. Odds are, none of us know what you're talking about.
But, it looks to me like you have a missing entry in your config file.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you for your reponse
AsteriskIAXClientWrapper is a project " Asterisk IAXClient library in C#"
|
|
|
|
|
asma_pfe wrote: Asterisk IAXClient library in C#
There is an article here in CP which explains about writing wrapper for IAX client. Try posting this question there.
|
|
|
|
|