Ejemplo n.º 1
0
 ///<summary>
 /// Constructs a new compound shape entry using the volume of the shape as a weight.
 ///</summary>
 ///<param name="shape">Shape to use.</param>
 ///<param name="orientation">Local orientation of the shape.</param>
 ///<param name="weight">Weight of the entry.  This defines how much the entry contributes to its owner
 /// for the purposes of center of rotation computation.</param>
 public CompoundShapeEntry(EntityShape shape, System.Numerics.Quaternion orientation, float weight)
 {
     orientation.Validate();
     LocalTransform = new RigidTransform(orientation);
     Shape = shape;
     Weight = weight;
 }
Ejemplo n.º 2
0
 ///<summary>
 /// Constructs a new compound shape entry using the volume of the shape as a weight.
 ///</summary>
 ///<param name="shape">Shape to use.</param>
 ///<param name="position">Local position of the shape.</param>
 ///<param name="weight">Weight of the entry.  This defines how much the entry contributes to its owner
 /// for the purposes of center of mass and inertia computation.</param>
 public CompoundShapeEntry(EntityShape shape, System.Numerics.Vector3 position, float weight)
 {
     position.Validate();
     LocalTransform = new RigidTransform(position);
     Shape = shape;
     Weight = weight;
 }
Ejemplo n.º 3
0
 public static void ValidateXmlDoc(System.Xml.XmlDocument xmlDocument, string[] sSchemaFiles)
 {
     foreach (string sSchema in sSchemaFiles)
     {
         xmlDocument.Schemas.Add(null, sSchema);
     }
     System.Xml.Schema.ValidationEventHandler validationHandler = new ValidationEventHandler(ValidationEvent);
     xmlDocument.Validate(validationHandler);
 }
Ejemplo n.º 4
0
 public void OutOfOrder()
 {
     var events = new[]
     {
         new TestEvent("A") { Start = new DateTime(2015, 1, 1, 0, 0, 0), Duration = TimeSpan.FromHours(1) }, // A
         new TestEvent("B") { Start = new DateTime(2015, 1, 1, 1, 30, 0), Duration = TimeSpan.FromHours(2) }, // B OVERLAPS!!!
         new TestEvent("C") { Start = new DateTime(2015, 1, 1, 3, 0, 0), Duration = TimeSpan.FromHours(1) }, // C
         new TestEvent("D") { Start = new DateTime(2015, 1, 1, 5, 0, 0), Duration = TimeSpan.FromHours(1) }, // D
         new TestEvent("E") { Start = new DateTime(2015, 1, 1, 7, 0, 0), Duration = TimeSpan.FromHours(1) } // E
     };
     events.Validate();
 }
Ejemplo n.º 5
0
 public void Null()
 {
     var events = new[]
     {
         new TestEvent("A") { Start = new DateTime(2015, 1, 1, 0, 0, 0), Duration = TimeSpan.FromHours(1) }, // A
         null, // B null
         new TestEvent("C") { Start = new DateTime(2015, 1, 1, 3, 0, 0), Duration = TimeSpan.FromHours(1) }, // C
         new TestEvent("D") { Start = new DateTime(2015, 1, 1, 5, 0, 0), Duration = TimeSpan.FromHours(1) }, // D
         new TestEvent("E") { Start = new DateTime(2015, 1, 1, 7, 0, 0), Duration = TimeSpan.FromHours(1) } // E
     };
     events.Validate();
 }
Ejemplo n.º 6
0
 public void Adjacent()
 {
     var events = new[]
     {
         new TestEvent("A") { Start = new DateTime(2015, 1, 1, 0, 0, 0), Duration = TimeSpan.FromHours(1) }, // A
         new TestEvent("B") { Start = new DateTime(2015, 1, 1, 1, 0, 0), Duration = TimeSpan.FromHours(1) }, // B ADJACENT!!!
         new TestEvent("C") { Start = new DateTime(2015, 1, 1, 3, 0, 0), Duration = TimeSpan.FromHours(1) }, // C
         new TestEvent("D") { Start = new DateTime(2015, 1, 1, 5, 0, 0), Duration = TimeSpan.FromHours(1) }, // D
         new TestEvent("E") { Start = new DateTime(2015, 1, 1, 7, 0, 0), Duration = TimeSpan.FromHours(1) } // E
     };
     events.Validate();
 }
Ejemplo n.º 7
0
        public static void ExecuteRuleSet(System.Workflow.Activities.Rules.RuleSet ruleSet, object thisObject)
        {
            System.Workflow.Activities.Rules.RuleValidation validation = new System.Workflow.Activities.Rules.RuleValidation(thisObject.GetType(), null);
            ruleSet.Validate(validation);

            System.Workflow.ComponentModel.Compiler.ValidationErrorCollection errors = validation.Errors;
            if (errors.Count > 0)
            {
                System.Windows.MessageBox.Show("There were Errors in the validation");
            }

            System.Workflow.Activities.Rules.RuleExecution execution = new System.Workflow.Activities.Rules.RuleExecution(validation, thisObject);
            ruleSet.Execute(execution);
        }
Ejemplo n.º 8
0
        public static void Validate(System.Xml.XmlDocument xmlDocument, System.IO.Stream schemaStream, string xpath, System.Xml.Schema.ValidationEventHandler validationHandler)
        {
            if (null == xmlDocument)
                throw new System.ArgumentNullException("xmlDocument");

            if (null == schemaStream)
                throw new System.ArgumentNullException("schemaStream");
            
            System.Xml.Schema.XmlSchema xmlSchema = System.Xml.Schema.XmlSchema.Read(schemaStream, validationHandler);
            xmlDocument.Schemas.Add(xmlSchema);
            System.Xml.XmlNode xmlValidationNode = xmlDocument.SelectSingleNode(xpath);
            xmlDocument.Validate(validationHandler, xmlValidationNode);
            xmlDocument.Schemas.Remove(xmlSchema);
        }