public TrendViewModel() { _settings = new MySettings() { Language = Languages.English, PortBaudRate = 9600, PortParity = System.IO.Ports.Parity.None, PortStopBits = System.IO.Ports.StopBits.One, PortDataBits = 8, PortName = "COM3", }; ReadSettings(); _dataFromFile = new SamplesCSV(); _dataFromFile.DataReceived += _data_DataReceived; _dataFromSerial = new SamplesSerial(_settings.PortBaudRate, _settings.PortParity, _settings.PortStopBits, _settings.PortDataBits, _settings.PortName); _dataFromSerial.DataReceived += _data_DataReceived; InitializeChart(); _oneSecondTimer = new DispatcherTimer(); _oneSecondTimer.Interval = TimeSpan.FromSeconds(1); _oneSecondTimer.Tick += _oneSecondTimer_Tick; _capture = new ScreenCapturer(); _export = new ExcelExporter(); }
/// <summary> /// Executes the specified sample type. /// </summary> /// <param name="sampleType">Type of the sample.</param> /// <param name="args">The arguments.</param> public void Execute(SampleTypes sampleType, object[] args = null) { logger.WriteSeparator(); ISamples sample = GetSample(sampleType); using (var sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlServer"].ConnectionString)) { sample.Execute(sqlConnection, logger, args); } logger.WriteSeparator(); }
public async Task BeforeEach(TestAppInstance app) { appInstance = app; samples = app.Samples; tempLogFileName = Path.Combine(app.AppDataDirectory, "XmlWriterTraceListener1.xml"); File.Copy(await samples.GetSampleAsLocalFile("XmlWriterTraceListener1.xml"), tempLogFileName, overwrite: true); await app.EmulateFileDragAndDrop(tempLogFileName); await app.WaitFor(() => app.ViewModel.LoadedMessagesLogViewer.ViewLines.Length > 0); await app.WaitFor(() => app.ViewModel.SourcesList.RootItem.Children.Count == 1); app.ViewModel.SourcesList.OnSelectionChange(new[] { (SrcListItem)app.ViewModel.SourcesList.RootItem.Children[0] }); await OpenDialog(); }
/// <summary> /// Gets the sample. /// </summary> /// <param name="sampleType">Type of the sample.</param> /// <returns></returns> public static ISamples GetSample(SampleTypes sampleType) { ISamples sample = null; switch (sampleType) { case SampleTypes.SimpleSelectStatement: sample = new SimpleSelectStatement(); break; case SampleTypes.SimpleSelectStatementWithDynamicEntities: sample = new SimpleSelectStatementWithDynamicEntities(); break; case SampleTypes.MultiMappingSingleEntity: sample = new MultiMappingSelectStatement(); break; case SampleTypes.MultiMappingChildEntities: sample = new MultiMappingOneToManyRelationSelectStatement(); break; case SampleTypes.ParameterizedSelectStatement: sample = new ParameterizedSelectStatement(); break; case SampleTypes.MultipleQueries: sample = new MultipleQueries(); break; case SampleTypes.SimpleStoredProcedure: sample = new SimpleStoredProcedure(); break; case SampleTypes.SimpleInsertStatement: sample = new SimpleInsertStatement(); break; default: break; } return(sample); }
/// <summary>Creates a new `Analyzer` that will feed the given sample data to the given `IDetector`.</summary> /// <param name="samples">The samples to analyze. Its number of channels must match the number of channels the `IDetector` has been created for. Its sample rate must match the sample rate of the `IDetector`s config.</param> /// <param name="detector">The detector to use for the analysis.</param> public Analyzer(ISamples samples, IDetector detector) { _ = samples ?? throw new ArgumentNullException(nameof(samples)); _ = detector ?? throw new ArgumentNullException(nameof(detector)); if (samples.Channels != detector.Channels) { throw new InvalidOperationException("'ISamples.Channels' does not match 'Detector.Channels'"); } if (samples.SampleRate != detector.Config.SampleRate) { throw new InvalidOperationException("'ISamples.SampleRate' does not match 'Detector.Config.SampleRate'"); } this.samples = samples; blockSize = detector.Config.SampleBlockSize * samples.Channels; buffer = new float[blockSize]; this.detector = detector; prevKeys = Enumerable.Repeat(PhoneKey.None, samples.Channels).ToArray(); }
public void getsSample_sampleTypeIsSimpleStoredProcedure_returnsISample() { ISamples sample = SamplesFactory.GetSample(Samples.SampleTypes.SimpleStoredProcedure); Assert.IsTrue(sample != null); }
public void getsSample_sampleTypeIsSimpleSelectStatementWithDynamicEntities_returnsISample() { ISamples sample = SamplesFactory.GetSample(Samples.SampleTypes.SimpleSelectStatementWithDynamicEntities); Assert.IsTrue(sample != null); }
public void getsSample_sampleTypeIsSimpleInsertStatement_returnsISample() { ISamples sample = SamplesFactory.GetSample(Samples.SampleTypes.SimpleInsertStatement); Assert.IsTrue(sample != null); }
public void getsSample_sampleTypeIsParameterizedSelectStatement_returnsISample() { ISamples sample = SamplesFactory.GetSample(Samples.SampleTypes.ParameterizedSelectStatement); Assert.IsTrue(sample != null); }
public void getsSample_sampleTypeIsMultipleQueries_returnsISample() { ISamples sample = SamplesFactory.GetSample(Samples.SampleTypes.MultipleQueries); Assert.IsTrue(sample != null); }
public void getsSample_sampleTypeIsMultiMappingSingleEntity_returnsISample() { ISamples sample = SamplesFactory.GetSample(Samples.SampleTypes.MultiMappingSingleEntity); Assert.IsTrue(sample != null); }
/// <summary>Creates a new `Analyzer` using a self-created instance of `Detector` to feed the given sample data to it.</summary> /// <param name="samples">The samples to analyze. Its sample rate must match the sample rate of the given `Config`.</param> /// <param name="config">The detector config used to create a `Detector`.</param> /// <returns>A new `Analyzer` instance.</returns> public static Analyzer Create(ISamples samples, in Config config)
/// <summary>Creates a new `Analyzer` that will feed the given sample data to the given `IDetector`.</summary> /// <param name="samples">The samples to analyze. Its number of channels must match the number of channels the `IDetector` has been created for. Its sample rate must match the sample rate of the `IDetector`s config.</param> /// <param name="detector">The detector to use for the analysis.</param> /// <returns>A new `Analyzer` instance.</returns> public static Analyzer Create(ISamples samples, IDetector detector) => new Analyzer(samples, detector);