Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

am working on asp.net c#,

Iam reading Xml file using url,, its working fine.

I have two buttons on my page as ON and OFF.

When i click on ON button, the status of the xml file relay states will be 1

as....
XML
<inputstates>000000000000000000</inputstates>
<relaystates>0000000000000001</relaystates>



and when i click OFF the status of the XML file relay states will be 0

XML
<inputstates>000000000000000000</inputstates>
<relaystates>0000000000000000</relaystates>


Now, i want to put 10 seconds timer between these 0 and 1
When i click ON button it should be 1 and after 10 seconds it should be 0, same thing must be continued.

Please help.

This is my code for 10 seconds

string url = "http://10.10.14.44/state.xml?relay1state=2&pulsetTime1=10";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(url);


thanks.
Posted

1 solution

Hi You can try to create method in separate thread on your server side code which will call same method as your OFF button. when you receive ON request you need to start the method in separate thread and put Thread.Sleep with 10 seconds.
In this case after 10 seconds the thread will continue his work and will call OFF method.

Hope this will help
Best Regards
Deverno
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900