Beispiel #1
0
        static public void RegisterDelegate()
        {
            // get Result uda attribute
            var userDefinedAttributeResult = DbAttribute.GetDbAttribute(":uResultTest");
            // Create instance of delegate containing "uResultTest" method
            var doubleDelegate = new Ps.GetStringDelegate(TeStCalculation);

            // Pass delegate instance to core PDMS. This will be invoked later
            // when :uResultTest is queried.
            // In this case registry for all valid element types.
            Ps.AddGetStringAttribute(userDefinedAttributeResult, doubleDelegate);
        }
        public static void Run()
        {
            // get uda attribute
            DbAttribute uda = DbAttribute.GetDbAttribute(":VOLUME");

            if (uda != null)
            {
                // Create instance of delegate containing "VolumeCalculation" method
                Ps.GetDoubleDelegate dele = new Ps.GetDoubleDelegate(VolumeCalculation);
                // Pass delegate instance to core PDMS. This will be invoked later
                Ps.AddGetDoubleAttribute(uda, NOUN.BOX, dele);

                // Now get value on a box
                double vol = Example.Instance.mBox.GetDouble(uda);
                Console.WriteLine(vol);
            }
        }