Specialized composite for parallel configuration.
Inheritance: CK.RouteConfig.Impl.ActionCompositeConfiguration
コード例 #1
0
 void DoSequenceOrParallelOrAdd( IActivityMonitor monitor, Action<ActionConfiguration> collector, XElement xml )
 {
     if( xml.Name == "Parallel" || xml.Name == "Sequence" )
     {
         Action<ActionConfiguration> elementCollector;
         if( xml.Name == "Parallel" )
         {
             var p = new ActionParallelConfiguration( xml.AttributeRequired( "Name" ).Value );
             elementCollector = a => p.AddAction( a );
             collector( p );
         }
         else
         {
             var s = new ActionSequenceConfiguration( xml.AttributeRequired( "Name" ).Value );
             elementCollector = a => s.AddAction( a );
             collector( s );
         }
         foreach( var action in xml.Elements() ) DoSequenceOrParallelOrAdd( monitor, collector, action );
     }
     else
     {
         if( xml.Name != "Add" ) throw new XmlException( String.Format( "Unknown element '{0}': only <Add>, <Parallel> or <Sequence>.", xml.Name ) );
         string type = xml.AttributeRequired( "Type" ).Value;
         Type t = FindConfigurationType( type );
         HandlerConfiguration hC = (HandlerConfiguration)Activator.CreateInstance( t, xml.AttributeRequired( "Name" ).Value );
         hC.DoInitialize( monitor, xml );
         collector( hC );
     }
 }
コード例 #2
0
 /// <summary>
 /// Must me implemented to create a parallel action.
 /// </summary>
 /// <param name="monitor">Monitor to use if needed.</param>
 /// <param name="configLock">
 /// Configuration lock. It must not be solicited during the creation of the parallel: if the parallel delays
 /// its work, it can keep a reference to it and use it as needed.
 /// </param>
 /// <param name="c">Configuration of the parallel action.</param>
 /// <param name="children">Array of already created children action.</param>
 /// <returns>A parallel action.</returns>
 protected abstract TAction DoCreateParallel(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionParallelConfiguration c, TAction[] children);
コード例 #3
0
ファイル: ParallelHandler.cs プロジェクト: Invenietis/ck-core
 public ParallelHandler( ActionParallelConfiguration c, HandlerBase[] children )
     : base( c )
 {
     _children = children;
 }