async void UnLoadComponents(object parameter) { var pluginLoader = AppServiceLocator.GetService <IPluginLoader <IAppComponent> >(); await pluginLoader.Unload(); Components = new List <string>(); this.RaisePropertyChanged(nameof(Components)); }
void UnLoadComponents(object parameter) { var pluginLoader = AppServiceLocator.GetService <IPluginLoader>(); pluginLoader.UnloadAll(); CurrentControl = null; Components = new List <string>(); this.RaisePropertyChanged(nameof(CurrentControl)); this.RaisePropertyChanged(nameof(Components)); }
// GET: api/Initial public UserProfile Get() { UserProfile result = new UserProfile(); var temp = AppServiceLocator.GetService <IRepairAttr>(); return(result); }
async void LoadComponents(object parameter) { var pluginLoader = AppServiceLocator.GetService <IPluginLoader <IAppComponent> >(); var plugins = await pluginLoader.LoadAll(); components = new Dictionary <string, IAppComponent>(); foreach (var plugin in plugins) { components.Add(plugin.GetName(), plugin); } Components = new List <string>(components.Select(p => p.Key)); this.RaisePropertyChanged(nameof(Components)); }
async void LoadComponents(object parameter) { var pluginLoader = AppServiceLocator.GetService <IPluginLoader>(); var dist = GetPathToComponentsPublishDirectory(); var pluginScanResults = await pluginLoader.FindPlugins <IAppComponent>(dist); components = new Dictionary <string, IAppComponent>(); foreach (var pluginScanResult in pluginScanResults) { var plugin = await pluginLoader.LoadPlugin <IAppComponent>(pluginScanResult, configure : (ctx) => { ctx .AddHostTypes(new[] { typeof(Application) }) ; }); components.Add(plugin.GetName(), plugin); } Components = new List <string>(components.Select(p => p.Key)); this.RaisePropertyChanged(nameof(Components)); }
private static void OnAutoWireViewModelChanged(BindableObject bindable, object oldValue, object newValue) { if (!(bindable is Element view)) { return; } Type viewType = view.GetType(); string viewName = viewType.FullName.Replace(".Views.", ".ViewModels."); string viewAssemblyName = viewType.GetTypeInfo().Assembly.FullName; string viewModelName = string.Format(CultureInfo.InvariantCulture, "{0}Model, {1}", viewName, viewAssemblyName); Type viewModelType = Type.GetType(viewModelName); if (viewModelType == null) { return; } object viewModel = AppServiceLocator.Resolve(viewModelType); view.BindingContext = viewModel; }
public static void Run() { var kernel = new StandardKernel(new NinjectRegistrar()); AppServiceLocator.SetServiceLocator(() => new NinjectServiceLocator(kernel)); }
public BaseUpdateScreen(IScreenGame game, TViewModel viewModel) : base(game, viewModel) { _threadService = AppServiceLocator.Resolve <IThreadService>(); }
private void InitializeComponent() { AvaloniaXamlLoader.Load(this); this.DataContext = AppServiceLocator.GetService <MainWindowViewModel>(); }