public object GetService(Type serviceType) { if (resolver == null) { throw new ObjectDisposedException("this", "This scope has been disposed."); } return(resolver.TryGet(serviceType)); }
public object GetService(Type serviceType) { if (resolver == null) { throw new ObjectDisposedException("this", "scope is disposed"); } return resolver.TryGet(serviceType); }
public object GetService(Type serviceType) { if (resolutionRoot == null) { throw new ObjectDisposedException("resolutionRoot", "Dependency scope already disposed"); } return(resolutionRoot.TryGet(serviceType)); }
public object GetService(Type serviceType) { if (_resolver == null) { throw new ObjectDisposedException("this", ErrDisposed); } return(_resolver.TryGet(serviceType)); }
public object GetService(Type serviceType) { if (resolver == null) { throw new Exception("This scope has been disposable"); } return(resolver.TryGet(serviceType)); }
/// <summary> /// Retrieves a service from the scope. /// </summary> /// <returns> /// The retrieved service. /// </returns> /// <param name="serviceType">The service to be retrieved.</param> public object GetService(Type serviceType) { string controllerName = serviceType.Name.AsControllerName(); if (string.IsNullOrEmpty(controllerName)) { return(null); // _resolutionRoot.Get(serviceType, new IParameter[0]); } return(_resolutionRoot.TryGet <IHttpController>(controllerName, new IParameter[0])); }
/// <summary> /// /// </summary> /// <param name="serviceType"></param> /// <returns></returns> public object GetService(Type serviceType) { try { return(root.TryGet(serviceType)); } catch (Exception ex) { return(null); } }
private static IContextStore GetStore(IResolutionRoot kernel) { var store = kernel.TryGet <IContextStore>(); if (store == null) { throw new InvalidOperationException( "There is no IContextStore implementation registered in the container."); } return(store); }
public object GetService(Type serviceType) { if (kernel == null) { return(resolutionRoot.TryGet(serviceType)); } else { return(kernel.TryGet(serviceType)); } }
public object GetService(Type serviceType) { if (resolver == null) { throw new ObjectDisposedException("this", "This scope has already been disposed"); } return(resolver.TryGet(serviceType)); }
private static IContextStore GetStore(IResolutionRoot kernel) { var store = kernel.TryGet<IContextStore>(); if (store == null) { throw new InvalidOperationException( "There is no IContextStore implementation registered in the container."); } return store; }
public IReferenceRatingProvider CreateReferenceRatingProvider() { string providerName = _ratingSettings.SelectedReferenceRatingProvider; IReferenceRatingProvider referenceRatingProvider = _resolutionRoot.TryGet <IReferenceRatingProvider>(providerName); if (referenceRatingProvider == null) { var binding = _kernel.GetBindings(typeof(IReferenceRatingProvider)).First(); providerName = binding.Metadata.Name; _ratingSettings.SelectedReferenceRatingProvider = providerName; return(_resolutionRoot.Get <IReferenceRatingProvider>(providerName)); } return(referenceRatingProvider); }
public MainViewModel(IResolutionRoot resolutionRoot) { this.resolutionRoot = resolutionRoot; MyCockpitPlugins = new BindableCollection <PluginModel>(); Ninject.Parameters.Parameter[] param = null; var FullImage = @"J:\heliosDevices\Images\TypePushButton\red_0.png"; var groupname = "PushButton"; var nameUC = "mfd"; var model = ""; if (groupname.StartsWith("PushButton")) { var FullImage1 = FullImage.Replace("_0.png", "_1.png"); param = new Ninject.Parameters.Parameter[] { new ConstructorArgument("settings", new object[] { //PushButton false, this, //0 is in Mode Editor? $"{nameUC}", //2 name of UC new int[] { 0, 0, 100, 100, 0 }, //3 [Left, Top, Width, Height, Angle] new string[] { FullImage, FullImage1 }, 0, //4 [images] & startimageposition 2d, 0.8d, (int)0, Colors.White, //6 Glyph: Thickness, Scale, Type, Color "Hello", "1,1", "Franklin Gothic", "Normal", "Normal", //10 Text, TextPushOffset, Family, Style, Weight 12d, new double[] { 0d, 0d, 0d, 0d }, //15 Size, [padding L,T,R,B] new int[] { 1, 1 }, Colors.White, //17 [TextAlign H,V], TextColor 1 //19 Button Type }, true) }; model = "Cockpit.RUN.ViewModels.PushButton_ViewModel, Cockpit.RUN.ViewModels"; } var typeClass = Type.GetType(model); //var viewmodel = Activator.CreateInstance(typeClass, param); var viewmodel = resolutionRoot.TryGet(typeClass, param); //var t = ViewLocator.TransformName("Cockpit.RUN.ViewModels.PushButton_ViewModel", param); //var view = ViewLocator.LocateForModel(viewmodel, null, null); //ViewModelBinder.Bind(viewmodel, view, null); var v = viewmodel as PluginModel; var w = (PluginModel)viewmodel; MyCockpitPlugins.Add(w); }
private void CreateNewInstancePropertyModel(string propertymodel, bool AddToPropertyCollection = false) { if (!ViewModels.ContainsKey(propertymodel)) { var typeClass = Type.GetType(propertymodel); //Ninject.Parameters.Parameter[] param = { new ConstructorArgument("tag", 0, true) }; var viewmodel = resolutionRoot.TryGet(typeClass); var view = ViewLocator.LocateForModel(viewmodel, null, null); ViewModelBinder.Bind(viewmodel, view, null); ViewModels[propertymodel] = (IPluginProperty)viewmodel; } if (AddToPropertyCollection) { PropertyViewModels.Add(ViewModels[propertymodel]); } }
public override object GetService(Type serviceType) { return(_resolutionRoot.TryGet(serviceType) ?? base.GetService(serviceType)); }
public object GetService(Type serviceType) { return(Container.TryGet(serviceType)); }
public object GetService(Type serviceType) { return(_root.TryGet(serviceType)); }
public object GetService(Type type) { return(_resolver.TryGet(type, _microdotNinectScopParameter)); }
public object GetService(Type serviceType) { return(_resolutionRoot.TryGet(serviceType)); }
public object GetService(Type serviceType) { return(_kernel.TryGet(serviceType)); }
public object GetService(Type serviceType) { return(resolver.TryGet(serviceType)); }
public T Resolve <T>() where T : class { return(_container.TryGet <T>()); }
private object GetSingleService(Type type) { return(_resolver.TryGet(type, _inheritedParameters)); }
public T Resolve <T>() { return(_container.TryGet <T>()); }