1

Hello all of you on stack overflow. I have Asp.net web application which picks up image from a folder , resize them and dump in other folder. For this i have to click on a button to pick image an work on it very often.

Is there a way to make application run automatically by picking image from folder and working on it and then dump in other folder.

Setting can be like start application and run for five minutes and stop and then wait for 1 minute and then start and run again for 5 minute.

IMPORTANT thing is it should only stop after it has finished resizing and dumping the last image in interval.

this will save me lot of trouble because I have to click on button very frequently and disturb me .

I only want the approach and related LINKS .Lots of them . Please reply.

  • 4
    You might want to do this in a window service or create a C# exe and add it as a scheduled task. Search in your favorite search engine for these and you shoudl get your approach. – Ravi Y Dec 01 '12 at 06:56
  • which of the two approach will consume more resources , be heavier ? Application is on a server which holds other application also. plz –  Dec 01 '12 at 06:58
  • I depends on what else you want to do with your application. If it is just a matter of copying the files, you are better of building a service which has a built in file watcher as well. – Ravi Y Dec 01 '12 at 06:59

1 Answers1

2

use a timer control to do this task

        timer.Tick += new EventHandler(timer_Tick); // Everytime timer ticks, timer_Tick will be called
        timer.Interval = (1000) * (1);              // Timer will tick evert second
        timer.Enabled = true;                       // Enable the timer
        timer.Start();  

void timer_Tick(object sender, EventArgs e)
    {
        do whatever you want
    }
Garry
  • 4,996
  • 5
  • 32
  • 44
  • can i call my web application C# file in timer_tick() , I will remove button from it and place all the code in page load section ..is it possible , sorry I can vote you up i don't i have enough reputation ... –  Dec 01 '12 at 07:02
  • plz help me , i have voted you up , gained reputation and able to vote you up now... –  Dec 01 '12 at 07:04
  • well it should enable you to do the specific task .just try it on page load just start it and then do your work on timer_tick..there might be others solutions too – Garry Dec 01 '12 at 07:05
  • This would help only if the application or the page is loaded. What if the web application is reset because of any app pool recycle may be? – Ravi Y Dec 01 '12 at 07:24
  • Perhaps this SO question can give you some ideas on this: http://stackoverflow.com/q/542804/5836 – Brettski Dec 01 '12 at 08:19