Ejemplo n.º 1
0
        private bool ValidateIntervalProcessSettings(IntervalProcessSettings settings)
        {
            bool hasValidSettings = true;

            try
            {
                if (!File.Exists(settings.Filename))
                {
                    hasValidSettings = false;
                }

            }
            catch (Exception ex)
            {
                logger.ErrorException("Error validating interval process settings.", ex);
                hasValidSettings = false;
            }

            return hasValidSettings;
        }
Ejemplo n.º 2
0
        private IntervalProcessSettings GetIntervalProcessSettings(XElement process)
        {
            IntervalProcessSettings settings = new IntervalProcessSettings();

            try
            {
                XElement timer = process.Element("timer");
                XElement timeout = process.Element("timeout");

                settings.Filename = (string)process.Attribute("filename");
                settings.Arguments = (string)process.Attribute("arguments");
                settings.TimerDuration = CreateTimeSpan(timer);
                settings.KillAfter = CreateTimeSpan(timeout);
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error getting interval process settings.", ex);
            }

            return settings;
        }
Ejemplo n.º 3
0
        private void StartIntervalProcess(IntervalProcessSettings settings)
        {
            TimerCallback timerCallback = RunIntervalProcess;
            var timer = new System.Threading.Timer(timerCallback, settings, new TimeSpan(0), settings.TimerDuration);

            Thread.Sleep(Timeout.Infinite);
        }