示例#1
0
        /// <summary>
        /// Adds the specified SimpleCurve to the SimpleMeasurement.
        /// </summary>
        /// <param name="simpleCurve">The SimpleCurve.</param>
        /// <param name="silent">if set to <c>true</c> [silent] the SimpleCurveAdded event is not raised.</param>
        /// <exception cref="System.ArgumentNullException">The specified SimpleCurve is null.</exception>
        /// <exception cref="System.ArgumentException">This measurement allready contains the specified SimpleCurve.</exception>
        public void AddSimpleCurve(SimpleCurve simpleCurve, bool silent = false)
        {
            if (simpleCurve == null)
            {
                throw new ArgumentNullException("The specified SimpleCurve is null.");
            }
            if (ContainsSimpleCurve(simpleCurve))
            {
                throw new ArgumentException("This SimpleMeasurement allready contains the specified SimpleCurve.");
            }

            SimpleCurveCollection.Add(simpleCurve); //Add the SimpleCurve to this SimpleMeasurement.
            if (!Measurement.ContainsCurve(simpleCurve.Curve))
            {
                if (!silent)
                {
                    Measurement.AddCurve(simpleCurve.Curve); //Add the original Curve to the orginal Measurement.
                }
                else
                {
                    Measurement.AddCurveSilent(simpleCurve.Curve); //Add the original Curve to the orginal Measurement without raising the curve added event.
                }
            }

            if (!silent)
            {
                OnSimpleCurveAdded(simpleCurve);
            }
        }