Beispiel #1
0
 /// <summary>
 /// Called after the compound list is changed
 /// </summary>
 protected void UpdateCompoundList()
 {
     CasterLogger.Debug("UpdateCompoundList");
     foreach (var item in Ports)
     {
         CapeMaterialPort p = item.Value as CapeMaterialPort;
         if (p != null && p.Material != null)
         {
             p.Material.UpdateCompoundList();
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Default action is to check if an inlet and a outlet material is connected, override to customize
        /// </summary>
        protected virtual bool PortsValidate(out string message)
        {
            CasterLogger.Debug("PortsValidate");
            bool hasInlet  = false;
            bool hasOutlet = false;

            message = "";
            foreach (var port in Ports)
            {
                CapeMaterialPort p = port.Value as CapeMaterialPort;
                if (p == null)
                {
                    continue;
                }
                if (p.direction == CapePortDirection.CAPE_INLET && p.IsConnected())
                {
                    hasInlet = true;
                }
                else if (p.direction == CapePortDirection.CAPE_OUTLET && p.IsConnected())
                {
                    hasOutlet = true;
                }
            }
            if (!hasInlet)
            {
                CasterLogger.Debug("Inlet material is not connected.");
                message += "Inlet material is not connected.";
            }
            if (!hasOutlet)
            {
                CasterLogger.Debug("Inlet material is not connected.");
                message += "Outlet material is not connected.";
            }
            CasterLogger.Debug("PortsValidate result: " + (hasInlet && hasOutlet));
            return(hasInlet && hasOutlet);
        }