Start() public method

public Start ( ) : void
return void
Esempio n. 1
0
        protected override void OnStart(string[] args)
        {
            logger.Info("Starting service...");

            try
            {
                var configuration = new ConfigurationManager(HostMetadata.MetricApp, Environment.SpecialFolder.CommonApplicationData);
                var settings = configuration.GetSection<MetricSettings>(MetricSettings.SectionKey);

                metric = new MetricInstance(settings);
                metric.Start();

                logger.Info("Service started");
            }
            catch (Exception e)
            {
                logger.Error(e);
                throw;
            }
        }
Esempio n. 2
0
        private void Start()
        {
            try
            {
                startButton.Enabled = false;

                Stop();

                editDatabaseSettingsControl.Save();
                metric = new MetricInstance(settings);
                metric.Start();

                startButton.Enabled = false;
                stopButton.Enabled = true;
                started = true;
            }
            catch (Exception e)
            {
                startButton.Enabled = true;
                UIHelper.Error(e);
            }
        }