// ReSharper disable once UnusedMember.Local public async Task <HandleResult> HandleMessage(string rawMessage) { var messageHandler = (IMessageHandler <TMessage>)_resolver.Get(_messageHandlerType); var message = _messageParser.DeserializeMessage <TMessage>(rawMessage); var result = await messageHandler.Handle(message); return(new HandleResult(message, result)); }
public override object Get(Type type) { return (base.CanGet(type) ? base.Get(type) : _secondaryContainer.CanGet(type) ? _secondaryContainer.Get(type) : ThrowResolveException(type)); }
private object[] CreateConstructorArgs( IEnumerable <ParameterInfo> targetConstructorParameters, IResolver resolver) { return(targetConstructorParameters.Select(parameter => { object argValue; if (TryGetTargetMemberValue(parameter.Name, parameter.ParameterType, out argValue)) { return argValue; } if (resolver != null && resolver.CanGet(parameter.ParameterType)) { return resolver.Get(parameter.ParameterType); } return parameter.HasDefaultValue ? parameter.DefaultValue : null; }).ToArray()); }
public App(IComponentProvider provider) { InitializeComponent(); var config = new ResolverConfig(); RegisterComponents(config); provider.RegisterComponents(config); Resolver = config.ToResolver(); MainPage = new NavigationPage { BarBackgroundColor = (Color)Resources["MetroBlueDark"] }; var navigationService = Resolver.Get <INavigator>(); navigationService.ForwardAsync("/LoginPage"); }
public async Task <OkResult> Post([FromBody] Microsoft.Bot.Connector.Activity activity) { if (activity.Type == ActivityTypes.Message) { //MicrosoftAppCredentials.TrustServiceUrl(activity.ServiceUrl); var appCredentials = new MicrosoftAppCredentials(_microsoftAppSettingsResolver.Get(activity.From.Id).Id, _microsoftAppSettingsResolver.Get(activity.From.Id).Password, _logger); var connector = new ConnectorClient(new Uri(activity.ServiceUrl), appCredentials); // return our reply to the user var reply = activity.CreateReply("HelloWorld"); await connector.Conversations.ReplyToActivityAsync(reply); } else { //HandleSystemMessage(activity); } return(Ok()); }
private object[] CreateArgs(IEnumerable <ParameterInfo> parameters, IResolver resolver) { var argsList = new List <object>(); foreach (var parameter in parameters) { object argValue; if (TryGetValueForInstance(parameter.Name, parameter.ParameterType, out argValue)) { argsList.Add(argValue); } else if (resolver != null && resolver.CanGet(parameter.ParameterType)) { argsList.Add(resolver.Get(parameter.ParameterType)); } else { argsList.Add(parameter.HasDefaultValue ? parameter.DefaultValue : null); } } return(argsList.ToArray()); }
public void GivenIAddedTheFollowingFillup(Table table) => table .CreateInstance <AddFillUpCommand>() .Finally(_resolver .Get <ICommandHandler <AddFillUpCommand> >() .Handle);
/// <summary> /// Return an object for this Type based on this configuration. /// </summary> /// <returns>an object for this Type based on this configuration.</returns> public object Get(params object[] @params) => resolver.Get(@params);