示例#1
0
        private void AssignOutputMeasurements(Dictionary <string, string> settings)
        {
            MeasurementKey[] outputMeasurementKeys = settings.TryGetValue("outputMeasurements", out string setting) ?
                                                     AdapterBase.ParseOutputMeasurements(m_dataSource, false, setting).MeasurementKeys() :
                                                     Array.Empty <MeasurementKey>();

            m_outputSignalIDs = outputMeasurementKeys.Select(k => k.SignalID).ToArray();
            LoadMeasurements(m_outputSignalIDs, dataGridViewOutputMeasurements, groupBoxOutputMeasurements);
        }
示例#2
0
        /// <summary>
        /// Parses connection string. Derived classes should override for custom connection string parsing.
        /// </summary>
        /// <param name="instance">Target <see cref="IIndependentAdapterManager"/> instance.</param>
        public static void HandleParseConnectionString(this IIndependentAdapterManager instance)
        {
            // Parse all properties marked with ConnectionStringParameterAttribute from provided ConnectionString value
            ConnectionStringParser parser = new ConnectionStringParser();

            parser.ParseConnectionString(instance.ConnectionString, instance);

            // Parse input measurement keys like class was a typical adapter
            if (instance.Settings.TryGetValue(nameof(instance.InputMeasurementKeys), out string setting))
            {
                instance.InputMeasurementKeys = AdapterBase.ParseInputMeasurementKeys(instance.DataSource, true, setting, instance.SourceMeasurementTable);
            }

            // Parse output measurement keys like class was a typical adapter
            if (instance.Settings.TryGetValue(nameof(instance.OutputMeasurements), out setting))
            {
                instance.OutputMeasurements = AdapterBase.ParseOutputMeasurements(instance.DataSource, true, setting, instance.SourceMeasurementTable);
            }
        }