Skip to content

Instantly share code, notes, and snippets.

@yuka1984
Last active October 27, 2017 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuka1984/2cfa9672d54264f99134ecce7e1a9583 to your computer and use it in GitHub Desktop.
Save yuka1984/2cfa9672d54264f99134ecce7e1a9583 to your computer and use it in GitHub Desktop.
public Task<ITriggerData> BindAsync(object value, ValueBindingContext context)
{
if (value is SlackMessage)
{
var bindingData = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
{
{"data", value}
};
object argument;
if (_parameter.ParameterType == typeof(string))
argument = JsonConvert.SerializeObject(value, Formatting.Indented);
else
argument = value;
IValueBinder valueBinder = new SlackMessageValueBinder(_parameter, argument);
return Task.FromResult<ITriggerData>(new TriggerData(valueBinder, bindingData));
}
throw new Exception();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment