private void btnPlayLoop_Click(object sender, EventArgs e) { if (this.graph1.WaveData.Count() > 0) { this.Playing = true; this.Loop = true; btnPlay.IsOn = false; btnPause.IsOn = false; btnPlayLoop.IsOn = true; graph1.Start(); ReadTimer.Start(); } }
static int Main(string[] args) { try { var assembly = Assembly.GetExecutingAssembly(); log.InfoFormat("Starting {0} Version {1}", assembly.Location, assembly.GetName().Version.ToString()); #region Argument Options var app = new CommandLineApplication(throwOnUnexpectedArg: false) { Name = "SQLToSplunkHTTP", Description = "Command line application meant to forward records from a SQL Server Database to a Splunk HTTP collector", FullName = "SQL Server to Splunk HTTP Collector" }; // Define app Options; app.HelpOption("-?| -h| --help"); app.VersionOption("-v| --version", assembly.GetName().Version.MajorRevision.ToString(), assembly.GetName().Version.ToString()); optionsFilePathOption = app.Option("-o| --optionsfile <PATH>", "Path to options file (Optional)", CommandOptionType.SingleValue); app.OnExecute(() => { // Setup the SplunkHTTPClient SplunkHTTPClient = new SplunkHTTP(log, RuntimeOptions.SplunkAuthorizationToken, RuntimeOptions.SplunkBaseAddress, RuntimeOptions.SplunkClientID); //Eat any SSL errors if configured to do so via options // TODO : Test this feature ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { return(RuntimeOptions.SplunkIgnoreSSLErrors); }; // Configure Timer ReadTimer.Interval = RuntimeOptions.ReadInterval; // Create delegate to handle elapsed time event ReadTimer.Elapsed += ReadTimer_Elapsed; //Start Timer ReadTimer.Start(); //Prevent console from exiting Console.Read(); return(0); }); app.Command("clearcache", c => { c.Description = "Deletes the current cache file"; c.HelpOption("-?| -h| --help"); c.OnExecute(() => { return(ClearCache(CacheFilename)); }); }); app.Command("createdefaultoptionsfile", c => { c.Description = "Create a default options.json file"; c.HelpOption("-?| -h| --help"); var overWriteOption = c.Option("-o| --overwrite", "Overwrite file if it exists", CommandOptionType.NoValue); var fileNameOption = c.Option("-f| --filename <PATH>", "Name of options file (Optional)", CommandOptionType.SingleValue); c.OnExecute(() => { return(CreateDefaultOptionsFile(fileNameOption.Value() ?? "options.json", overWriteOption.HasValue())); }); }); //Debug the startup arguments log.DebugFormat("Startup Arguments {0}", JsonConvert.SerializeObject(args)); //Always make sure we load runtime options first //RuntimeOptions = ReadOptionsFile(OptionsFilePathOption); // Run the application with arguments return(app.Execute(args)); #endregion } catch (Exception ex) { log.Error(ex); return(-1); } }