public static IAction CreateAction(ActionParameter param) { if (param is SwitchGridActionParameter) { return(new SwitchGridAction(param, GridSwitchHandler)); } else if (param is TcpActionParameter) { return(new TcpAction(param, ConnectionPool)); } else if (param is TTSActionParameter) { return(new TTSAction(param)); } else if (param is LogActionParameter) { return(new LogAction(param)); } else if (param is ScannerActionParameter) { return(new ScannerAction(param, StartScanner, StopScanner)); } else if (param is SelectActionParameter) { return(new SelectAction(param, SelectionHandler)); } else if (param is TimeActionParameter) { return(new TimeAction(param)); } else { throw new NotImplementedException(String.Format("Action for parameter type {0} is not implemented!", param.GetType().Name)); } }