Esempio n. 1
0
            /// <summary>Returns the value before the script assignment</summary>
            public Nullable <int> GetPreconditionValue(IIntProperty property)
            {
                IPropertyValue    propertyValue    = GetPreconditionPropertyValue(property);
                IIntPropertyValue intPropertyValue = propertyValue as IIntPropertyValue;
                Nullable <int>    result           = intPropertyValue.Value;

                return(result);
            }
Esempio n. 2
0
            private Nullable <int> GetScriptOrPreconditionValue(IIntProperty property, bool ifNotFoundReturnPreconditionValue)
            {
                Nullable <int> result        = null;
                IPropertyValue propertyValue = GetPropertyValue(property);

                if (propertyValue == null)
                {
                    if (ifNotFoundReturnPreconditionValue)
                    {
                        result = GetPreconditionValue(property);
                    }
                    return(result);
                }
                IIntPropertyValue intPropertyValue = propertyValue as IIntPropertyValue;

                result = intPropertyValue.Value;
                return(result);
            }
        /// <summary>
        /// OnTransferPfToRun is called when the previously preflighted instrument method is actually started.
        /// </summary>
        /// <param name="args">The PreflightEventArgs contain the IRunContext with the ProgramSteps.</param>
        private void OnTransferPfToRun(PreflightEventArgs args)
        {
            m_MyCmDevice.AuditMessage(AuditLevel.Message, "OnTransferPreflightToRun handler OnTransferPfToRun, please wait...");

            // We use the IProgramStep interface to walk the list of events in the instrument method.
            // In a real driver we would need to build some kind of time table and send it to the hardware.
            // In this example we create a list instead and write it to the audit trail.
            // Note that the property is not updated, as this would be done asynchronously during the run.

            StringBuilder sb = new StringBuilder("Table of timed events:\n");

            foreach (IProgramStep step in args.RunContext.ProgramSteps)
            {
                IPropertyAssignmentStep propertyAssignment = step as IPropertyAssignmentStep;

                if (propertyAssignment != null)
                {
                    if (propertyAssignment.Value.Property == m_EventAProperty ||
                        propertyAssignment.Value.Property == m_EventBProperty)
                    {
                        IIntPropertyValue value = propertyAssignment.Value as IIntPropertyValue;

                        sb.Append("Retention ");
                        sb.Append(step.Retention.Minutes.ToString("F3"));
                        sb.Append(": ");
                        sb.Append(propertyAssignment.Value.Property.Name);
                        sb.Append("=");
                        sb.Append(value.Value.ToString());
                        sb.Append("\n");
                    }
                }
            }

            m_MyCmDevice.AuditMessage(AuditLevel.Message, sb.ToString());

            m_MyCmDevice.AuditMessage(AuditLevel.Message, "OnTransferPreflightToRun handler OnTransferPfToRun has finished.");
        }