Ejemplo n.º 1
0
        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            lock (typeof(ScheduleService))
            {
                try
                {
                    _invocationTimer = new InvocationTimer();

                    string strInterval = ConfigurationManager.AppSettings["Interval"];
                    if (strInterval != null)
                    {
                        _invocationTimer.Interval = int.Parse(strInterval);
                    }
                    else
                    {
                        _invocationTimer.Interval = 10;
                    }

                    _threadingTimer = new System.Threading.Timer(new System.Threading.TimerCallback(m_timer_Elapsed), null, Timeout.Infinite, Timeout.Infinite);

                    //RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);

                    // Initialize WebConfig Reset
                    this._fileSystemWatcher.Path = SchedulerServiceClient.InstallDir;
                    this._fileSystemWatcher.Filter = "*.config";
                    this._fileSystemWatcher.EnableRaisingEvents = true;

                    SetTimer();
                }
                catch (Exception ex)
                {
                    Log.WriteEntry("OnStart(): Exception: " + ex.ToString(), EventLogEntryType.Error);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            lock (typeof(ScheduleService))
            {
                try
                {
                    _invocationTimer = new InvocationTimer();


                    string strInterval = ConfigurationManager.AppSettings["Interval"];
                    if (strInterval != null)
                    {
                        _invocationTimer.Interval = int.Parse(strInterval);
                    }
                    else
                    {
                        _invocationTimer.Interval = 10;
                    }

                    _threadingTimer = new System.Threading.Timer(new System.Threading.TimerCallback(m_timer_Elapsed), null, Timeout.Infinite, Timeout.Infinite);

                    //RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);

                    // Initialize WebConfig Reset
                    this._fileSystemWatcher.Path   = SchedulerServiceClient.InstallDir;
                    this._fileSystemWatcher.Filter = "*.config";
                    this._fileSystemWatcher.EnableRaisingEvents = true;

                    SetTimer();
                }
                catch (Exception ex)
                {
                    Log.WriteEntry("OnStart(): Exception: " + ex.ToString(), EventLogEntryType.Error);
                }
            }
        }