J
J-T
Thanks Kevin for all the helps and follow ups.I appreciate it.
I got it finally up and working.Here is the code
**********My Global.asax :
IFPWatcherComponent ifpWacher=new IFPWatcherComponent(
ConfigurationSettings.AppSettings["MonitorPath"],
int.Parse(ConfigurationSettings.AppSettings["SimultaniousNumberOfFiles"]));
Authorization.Current.Initialize();
try
{
Application.Lock();
Application.Add("IFPWatcherComponent",ifpWacher);
}
finally
{
Application.UnLock();
**********Class:
public class IFPWatcherComponent: Timer
{
private string mDir="";
private string mirrorDir="";
private int iCount=1;
// Monitor directory
public string monitorDirectory
{
get { return this.mDir; }
set { this.mDir= value; }
}
// interval
public double timerInterval
{
get { return this.Interval; }
set { this.Interval= value; }
}
public IFPWatcherComponent(string MonitorPath,int FileCounts)
{
this.monitorDirectory=MonitorPath;
this.fileCounts=FileCounts;
try
{
//Check to see if Web.config has appropriate settings
if (this.monitorDirectory.Trim().Length==0 ) return;
// Make a reference to a Montitor directory.
DirectoryInfo diMonitor = new DirectoryInfo(this.monitorDirectory);
// Create the directory only if it does not already exist.
if (diMonitor.Exists == false)
diMonitor.Create();
this.Elapsed+=new ElapsedEventHandler(OnTimedEvent);
this.Interval=this.timerInterval;
this.Enabled=true;
}
catch
{
throw;
}
}
private void OnTimedEvent(object source, ElapsedEventArgs e)
{
//do whatever you want here
}
}
I got it finally up and working.Here is the code
**********My Global.asax :
IFPWatcherComponent ifpWacher=new IFPWatcherComponent(
ConfigurationSettings.AppSettings["MonitorPath"],
int.Parse(ConfigurationSettings.AppSettings["SimultaniousNumberOfFiles"]));
Authorization.Current.Initialize();
try
{
Application.Lock();
Application.Add("IFPWatcherComponent",ifpWacher);
}
finally
{
Application.UnLock();
**********Class:
public class IFPWatcherComponent: Timer
{
private string mDir="";
private string mirrorDir="";
private int iCount=1;
// Monitor directory
public string monitorDirectory
{
get { return this.mDir; }
set { this.mDir= value; }
}
// interval
public double timerInterval
{
get { return this.Interval; }
set { this.Interval= value; }
}
public IFPWatcherComponent(string MonitorPath,int FileCounts)
{
this.monitorDirectory=MonitorPath;
this.fileCounts=FileCounts;
try
{
//Check to see if Web.config has appropriate settings
if (this.monitorDirectory.Trim().Length==0 ) return;
// Make a reference to a Montitor directory.
DirectoryInfo diMonitor = new DirectoryInfo(this.monitorDirectory);
// Create the directory only if it does not already exist.
if (diMonitor.Exists == false)
diMonitor.Create();
this.Elapsed+=new ElapsedEventHandler(OnTimedEvent);
this.Interval=this.timerInterval;
this.Enabled=true;
}
catch
{
throw;
}
}
private void OnTimedEvent(object source, ElapsedEventArgs e)
{
//do whatever you want here
}
}