Пример #1
0
        public void RunAsConsole(string[] args)
        {
            Logger.Log.Info("Running in console mode!");
            TFSIntegrationImplementation integrationImplementation = new TFSIntegrationImplementation();

            integrationImplementation.Run();
        }
Пример #2
0
        protected override void OnStart(string[] args)
        {
            Logger.Log.Info("Running in service mode!");
            Logger.Log.Info("Start");

            aTimer = new System.Timers.Timer(10000);

            // Hook up the Elapsed event for the timer.
            aTimer.Elapsed += this.OnTimedEvent;



            Logger.Log.Info("Thread start");

            integrationImplementation = new TFSIntegrationImplementation();
            Logger.Log.Info($"Application runs from this location: {System.Reflection.Assembly.GetExecutingAssembly().Location}");
            Logger.Log.Info("Read configuration");
            tfsConfiguration = integrationImplementation.ReadTFSConfiguration(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), TFSIntegrationImplementation.CONFIG_FILE));

            // Set the Interval
            if (tfsConfiguration != null && tfsConfiguration.RepetTaskEveryXSeconds != 0)
            {
                aTimer.Interval = TimeSpan.FromSeconds(tfsConfiguration.RepetTaskEveryXSeconds).TotalMilliseconds;
            }
            else
            {
                aTimer.Interval = 300000;//5 minutes
            }

            Logger.Log.Info($"Downloading will start in {aTimer.Interval} seconds!");
            aTimer.Enabled = true;
            Logger.Log.Info("End onstart");
        }