public static string GetDoubleRampEventArgsText(SetDoubleRampEventArgs ramp)
        {
            string result = "RetentionTime = " + Property.GetDoubleValueText(ramp.RetentionTime) + ", " +
                            "Start = " + Property.GetDoubleValueText(ramp.StartValue) + ", " +
                            "End = " + Property.GetDoubleValueText(ramp.EndValue) + ", " +
                            "Duration = " + Property.GetDoubleValueText(ramp.Duration);

            return(result);
        }
        /// <summary>
        /// Called when a Percentage ramp step is set by Chromeleon.
        /// </summary>
        /// <param name="args">The SetDoubleRampEventArgs contain
        ///   the start value, the end value and the duration of the ramp.</param>
        private void m_RampedPercentageProperty_OnSetRamp(SetRampEventArgs args)
        {
            SetDoubleRampEventArgs doubleArgs = args as SetDoubleRampEventArgs;

            Debug.Assert(doubleArgs != null);

            // Write a message to the audit trail
            String message = String.Format(CultureInfo.InvariantCulture, "m_RampedPercentageProperty_OnSetRamp(time: {3} from: {0} to: {1} in: {2})", doubleArgs.StartValue, doubleArgs.EndValue, RetentionToString(doubleArgs.Duration), RetentionToString(args.RetentionTime));

            m_MyCmDevice.AuditMessage(AuditLevel.Message, message);
            m_FlowHandler.ComponentProperties[1].Update(doubleArgs.EndValue);
        }
Exemple #3
0
        private void OnPropertyFlowNominalSetRamp(SetRampEventArgs args)
        {
            SetDoubleRampEventArgs ramp = Property.GetDoubleRampEventArgs(args);
            string text = Property.GetDoubleRampEventArgsText(ramp);

            Log.WriteLine(Id, text);

            if (ramp.StartValue == null)
            {
                return;
            }
            FlowRequested = ramp.StartValue.GetValueOrDefault();
        }
        public static SetDoubleRampEventArgs GetDoubleRampEventArgs(SetRampEventArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            SetDoubleRampEventArgs rampEventArgs = args as SetDoubleRampEventArgs;

            if (rampEventArgs == null)
            {
                throw new ArgumentException("Parameter args type " + args.GetType().FullName + " is not " + typeof(SetDoubleRampEventArgs));
            }
            return(rampEventArgs);
        }
        private void m_RampedPercentageProperty_OnPreflightSetRamp(SetRampEventArgs args)
        {
            SetDoubleRampEventArgs doubleArgs = args as SetDoubleRampEventArgs;

            if (doubleArgs == null)
            {
                return;
            }

            // Write a message to the preflight results
            String message = String.Format(CultureInfo.InvariantCulture, "m_RampedPercentageProperty_OnPreflightSetRamp(time: {3} from: {0} to: {1} in: {2})", doubleArgs.StartValue, doubleArgs.EndValue, RetentionToString(doubleArgs.Duration), RetentionToString(args.RetentionTime));

#if (PreflightMessagesToCM)
            m_MyCmDevice.AuditMessage(AuditLevel.Warning, message);
#else
            Debug.WriteLine("PreflightMessage: " + message);
#endif
        }