Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 8th, 2007, 05:24 AM
Authorized User
 
Join Date: Dec 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default specifing the time intraval in win service

Hi guys,

      I want to set the intraval time as 24hours i.e only once per day i shud run my windows service to perform the task.Moreover i have coded to start my service after one minute of log on and now i have to set the time to run the task.I am struck in specifing the time.

      Please look at the underlined line of the code and suggest me how to do it.

Thanks for ur kindness,
Karthik










    public void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            AddEventLog( "Buildfolio Services entered" );
            try
            {

                if( timer!=null )
                    timer.Stop();
                foreach( IService s in subServices )
                {
                    try
                    {
                        s.TimedEvent();
                    }
                    catch( Exception ex )
                    {
                        AddEventLog( "Sub Service: Exception "+ex.Message );
                    }

                }
                RootSystem.timeCount++;
                if( timer!=null )
                    timer.Start();
                [u]//timer.Interval =Convert.ToDouble(System.Configuration.Configurati onSettings.AppSettings.Get("JDEdTamesSynchronizer. TimerInterval"));</u> }
            catch( Exception ex )
            {
                AddEventLog( "AMOS Services: Exception "+ex.Message );
            }
            AddEventLog( "AMOS Services exited" );
        }

        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {

            // TODO: Add code here to start your service.
            try
            {
                timer = new System.Timers.Timer();
                timer.Elapsed += new ElapsedEventHandler( OnTimedEvent );
                timer.Interval = 60000;
                timer.Enabled=true;

            }
            catch( Exception ex )
            {
                AddEventLog( ex.Message );
            }
            AddEventLog( "AMOS Services started" );
        }
__________________
Karthik
[Nothing is impossible]





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to remove web service time out ? hendyhanusin VB.NET 2002/2003 Basics 1 September 21st, 2007 11:43 AM
How to access web service in win forms saravanan.k .NET Web Services 2 May 5th, 2007 06:49 AM
pop-up window appear for every intraval of time srkarthik_82 General .NET 1 January 16th, 2007 11:46 AM
Win 2k3 service prabodh_mishra VB How-To 1 October 27th, 2005 02:37 AM
Start win.. service in folder other than System32 zaheersharief General .NET 2 April 18th, 2005 12:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.