Changeset 11468 for branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/ServicePort.cs
- Timestamp:
- 10/16/14 03:57:49 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Optimization.Networks/3.3/ServicePort.cs
r11454 r11468 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 25 using System; 26 using System.Threading; 27 using System.Threading.Tasks; 26 28 27 29 namespace HeuristicLab.Optimization.Networks { … … 40 42 } 41 43 42 public ServiceParameterCollection Call(ServiceParameterCollection parameters) { 43 return OnCalled(parameters); 44 public ServiceParameterCollection Process(ServiceParameterCollection parameters) { 45 return Process(parameters, new CancellationToken()); 46 } 47 public ServiceParameterCollection Process(ServiceParameterCollection parameters, CancellationToken token) { 48 return OnProcessParameters(parameters, token); 49 } 50 public async Task<ServiceParameterCollection> ProcessAsync(ServiceParameterCollection parameters) { 51 return await ProcessAsync(parameters, new CancellationToken()); 52 } 53 public async Task<ServiceParameterCollection> ProcessAsync(ServiceParameterCollection parameters, CancellationToken token) { 54 return await Task.Run(() => { return Process(parameters, token); }, token); 44 55 } 45 56 46 public event EventHandler<EventArgs<ServiceParameterCollection >> Called;47 protected virtual ServiceParameterCollection On Called(ServiceParameterCollection parameters) {48 var handler = Called;49 if (handler != null) handler(this, new EventArgs<ServiceParameterCollection >(parameters));57 public event EventHandler<EventArgs<ServiceParameterCollection, CancellationToken>> ProcessParameters; 58 protected virtual ServiceParameterCollection OnProcessParameters(ServiceParameterCollection parameters, CancellationToken token) { 59 var handler = ProcessParameters; 60 if (handler != null) handler(this, new EventArgs<ServiceParameterCollection, CancellationToken>(parameters, token)); 50 61 return parameters; 51 62 }
Note: See TracChangeset
for help on using the changeset viewer.