private Task <object> CreateServiceAsync(IAsyncServiceContainer container, CancellationToken cancellationToken, Type serviceType) { if (typeof(SPlcncliCommunication) == serviceType) { PlcncliProcessCommunication service = new PlcncliProcessCommunication(_locationService); return(Task.FromResult <object>(service)); } return(null); }
protected PlcncliTask() { PlcncliLocation = Environment.GetEnvironmentVariable("plcncli_toollocation"); if (string.IsNullOrEmpty(PlcncliLocation)) { PlcncliLocation = ToolLocationFinder.SearchPlcncliTool(null); if (string.IsNullOrEmpty(PlcncliLocation)) { throw new ArgumentException("PLCnCLI tool location could not be resolved."); } } Communication = new PlcncliProcessCommunication(null, PlcncliLocation); }