///<summary></summary>
        public DelegatedPerfLoggerAppender(IDelegatedPerfLoggerAppenderSettings settings)
        {
            if (settings == null) throw new ArgumentNullException("settings");
            _settings = settings;

            if (settings.SendInterval <= TimeSpan.Zero)
            {
                if (_settings.WriteLog == null)
                {
                    throw new ArgumentNullException("settings.WriteLog", "when SendInterval is 0, WriteLog delegate must be provided.");
                }
            }
            else
            {
                if (_settings.BatchWriteLogs == null)
                {
                    throw new ArgumentNullException("settings.BatchWriteLogs", "when SendInterval is greater than 0, BatchWriteLogs delegate must be provided.");
                }
                _queue = new TimedActionQueue<string>(SendImpl, settings.SendInterval);
            }

            _guagesFormat = PrepForStringFormat(settings.GuagesFormat);
            _guagesFormatWithSampling = PrepForStringFormat(settings.GuagesFormatWithSampling);
            _timingsFormat = PrepForStringFormat(settings.TimingsFormat);
            _timingsFormatWithSampling = PrepForStringFormat(settings.TimingsFormatWithSampling);
            _countsFormat = PrepForStringFormat(settings.CountsFormat);
            _countsFormatWithSampling = PrepForStringFormat(settings.CountsFormatWithSampling);
        }
 ///<summary></summary>
 public StatsdPerfLoggerAppender(IStatsdPerfLoggerAppenderSettings settings)
 {
     if (settings == null) throw new ArgumentNullException("settings");
     _settings = settings;
     _queue = new TimedActionQueue<string>(SendImpl, settings.SendInterval);
     _threadSafeUdpClient = new ThreadSafeUdpClient(
         settings.Host, settings.Port,
         string.Format("sending to udp://{0}:{1} interval={2}\n{{0}}", _settings.Host, _settings.Port, _settings.SendInterval));
 }
 ///<summary></summary>
 public SqlPerfLoggerAppender(SqlPerfLoggerAppenderSettings settings)
 {
     if (settings == null) throw new ArgumentNullException("settings");
     _settings = settings;
     _queue = new TimedActionQueue<string>(SendImpl, settings.SendInterval);
     _guagesInsertStatement = PrepForStringFormat(settings.GuagesInsertStatement);
     _timingsInsertStatement = PrepForStringFormat(settings.TimingsInsertStatement);
     _countsInsertStatement = PrepForStringFormat(settings.CountsInsertStatement);
 }
Esempio n. 4
0
 private void FillActions()
 {
     _actions = new TimedActionQueue
     {
         // Welcome
         { 3000, () => PrintSubtitles(Resources.IntroSubtitlesWelcome) },
         { 6000, labelSubtitles.Hide },
         // Catalog search
         { 1000, () => PrintSubtitles(Resources.IntroSubtitlesCatalogSearch) },
         { 3000, tabControlApps.Show },
         { 2500, arrowSearch.Show },
         { 500, arrowSearch.Hide },
         { 500, arrowSearch.Show },
         { 1500, () => TypeText(tileListCatalog.TextSearch, "C") },
         { 500, () => TypeText(tileListCatalog.TextSearch, "Co") },
         { 500, () => TypeText(tileListCatalog.TextSearch, "Coo") },
         { 500, () => TypeText(tileListCatalog.TextSearch, "Cool") },
         { 500, arrowSearch.Hide },
         { 2000, labelSubtitles.Hide },
         // Run app
         { 1000, () => PrintSubtitles(Resources.IntroSubtitlesRunApp) },
         { 2000, () => FlashRectangle(GetCatalogTile(_coolApp).buttonRun) },
         { 4000, GetCatalogTile(_coolApp).Refresh },
         { 1000, labelSubtitles.Hide },
         // Add app
         { 2000, () => PrintSubtitles(Resources.IntroSubtitlesAddApp) },
         { 4000, () => FlashRectangle(GetCatalogTile(_coolApp).buttonAdd) },
         { 2000, () => { GetCatalogTile(_coolApp).Status = AppStatus.Added; } },
         { 3000, GetCatalogTile(_coolApp).Refresh },
         { 1000, labelSubtitles.Hide },
         // My apps
         { 2000, arrowMyApps.Show },
         { 500, arrowMyApps.Hide },
         { 500, arrowMyApps.Show },
         { 1500, () => tabControlApps.SelectTab(tabPageAppList) },
         { 1000, () => PrintSubtitles(Resources.IntroSubtitlesMyApps) },
         { 4000, arrowMyApps.Hide },
         { 1000, labelSubtitles.Hide },
         // Integrate app
         { 1000, () => PrintSubtitles(Resources.IntroSubtitlesIntegrateApp) },
         { 5000, () => FlashRectangle(GetMyAppsTile(_coolApp).buttonIntegrate) },
         { 2000, () => { GetMyAppsTile(_coolApp).Status = AppStatus.Integrated; } },
         { 3000, GetMyAppsTile(_coolApp).Refresh },
         { 1500, labelSubtitles.Hide },
         // Thanks
         { 2000, () => PrintSubtitles(Resources.IntroSubtitlesThanks) },
         {
             4000, () =>
             {
                 tabControlApps.Hide();
                 labelVideo.Hide();
                 buttonReplay.Visible = buttonClose.Visible = true;
             }
         }
     };
 }