public static bool TryGetChannelObserver <T>(string name, out IObserver <T> viewServiceInstance) { Object _service = null; var _response = ResourceLocator.TryGetResource(typeof(IObserver <T>), name, out _service); viewServiceInstance = _service == null ? null : (IObserver <T>)_service; return(_response); }
public static bool TryGetViewModel(Type viewType, out object viewModelInstance) { Guard.ArgumentNotNull(viewType, "viewType"); // we get the provider and then get the instance IViewModelProvider _viewModelProvider = null; var _response = ResourceLocator.TryGetResource <IViewModelProvider>(viewType.FullName, out _viewModelProvider); viewModelInstance = _viewModelProvider == null ? null : _viewModelProvider.CreateViewModelInstance(); return(_response); }
public IObservable <IUrlResponse> GetResponse(IRoutingContext context) { // we get the route handler from the resource locator IRouteHandler _routeHandler = null; if (!ResourceLocator.TryGetResource <IRouteHandler>(_url, out _routeHandler)) { // we return that the handler was not found var _observer = new LazyRelayObservable <IUrlResponse>((s) => { s.OnNext(new UrlResponse(context.Request, ResponseStatus.HandlerNotFound, null, null)); s.OnCompleted(); }); return(_observer); } // we we resolve return(_routeHandler.GetResponse(context)); }
protected internal override object ResolveResource(Type targetType) { var _viewModelProvider = (IViewModelProvider)null; if (ResourceLocator.TryGetResource <IViewModelProvider>(_viewType.FullName, out _viewModelProvider)) { return(_viewModelProvider.CreateViewModelInstance()); } else { if (!this.IsNullable) { throw new ResolveResourceException(string.Format(VIEWMODEL_COULDNOT_RESOLVE, _viewType.FullName)); } else { return(null); } } }
public static bool TryGetViewService <T>(string name, out T viewServiceInstance) where T : class { return(ResourceLocator.TryGetResource <T>(name, out viewServiceInstance)); }
public static bool TryGetViewService(Type viewServiceType, out object viewServiceInstance) { return(ResourceLocator.TryGetResource(viewServiceType, out viewServiceInstance)); }
public static bool GetChannelObserver(Type channelType, string name, out object viewServiceInstance) { return(ResourceLocator.TryGetResource(GetObserverTypeForChannel(channelType), name, out viewServiceInstance)); }
public static bool GetService(Type serviceType, string name, out object serviceInstance) { return(ResourceLocator.TryGetResource(serviceType, name, out serviceInstance)); }
// Try Get Service Related public static bool TryGetService <T>(out T serviceInstance) where T : class { return(ResourceLocator.TryGetResource <T>(out serviceInstance)); }
public static bool TryGetModule(string name, out IModule moduleInstance) { Guard.ArgumentNotNullOrWhiteSpace(name, "name"); return(ResourceLocator.TryGetResource <IModule>(name, out moduleInstance)); }