Click here to Skip to main content
15,908,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I already posted this code, but not able to convert the code as per my requirement.

The code is below:

public partial class FilePooling : ServiceBase
    {
        #region Declarations
        private System.ComponentModel.Container components = null;
        private System.ServiceProcess.ServiceController serviceController1;        
        private System.Timers.Timer timer1;
        DataTable dtHub = new DataTable();
        DataTable dtImage = new DataTable();        
        #endregion
        public FilePooling()
        {
            InitializeComponent();
            this.ServiceName = "FilePooling";
        }
        static void Main()
        {
            System.ServiceProcess.ServiceBase[] ServicesToRun;
            ServicesToRun = new System.ServiceProcess.ServiceBase[] { new FilePooling() };
            System.ServiceProcess.ServiceBase.Run(ServicesToRun);
        }
        private void InitializeComponent()
        {
            this.serviceController1 = new System.ServiceProcess.ServiceController();
            this.timer1 = new System.Timers.Timer();
            ((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit();
            this.timer1.AutoReset = false;
            this.timer1.Enabled = true;
            this.timer1.Interval = Convert.ToDouble(ConfigurationSettings.AppSettings["TimerInterval"].ToString());
            this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed);
            ((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit();
        }

        # region timer1_Elapsed
        private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {            
            timer1.Enabled = false;                      
            FileFTPCopy();           
            timer1.Enabled = true;            
        }
        # endregion



Its very urgent task for me to convert this to System.Threading.Timer .....


Anybody plzzzz edit the code and assist me..


Thanks & Regards,
Posted
Updated 24-Mar-11 0:34am
v2

1 solution

 
Share this answer
 
v2
Comments
Raj.rcr 24-Mar-11 6:43am    
I said that because, I have been trying for this from yesterday... But not getting how to get rid of this issue.. anyways thanx for the link .. I will go through that..
Raj.rcr 24-Mar-11 6:49am    
Hiii, I checked it out.. I have gone through this already, butI need to do some changes in InitializeComponent() method. That is the main issue.
Prerak Patel 24-Mar-11 7:28am    
What have you tried? and what error you get?

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