Esempio n. 1
0
        async void UnLoadComponents(object parameter)
        {
            var pluginLoader = AppServiceLocator.GetService <IPluginLoader <IAppComponent> >();
            await pluginLoader.Unload();

            Components = new List <string>();
            this.RaisePropertyChanged(nameof(Components));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
        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;
        }
Esempio n. 7
0
        public static void Run()
        {
            var kernel = new StandardKernel(new NinjectRegistrar());

            AppServiceLocator.SetServiceLocator(() => new NinjectServiceLocator(kernel));
        }
Esempio n. 8
0
 public BaseUpdateScreen(IScreenGame game, TViewModel viewModel) : base(game, viewModel)
 {
     _threadService = AppServiceLocator.Resolve <IThreadService>();
 }
Esempio n. 9
0
 private void InitializeComponent()
 {
     AvaloniaXamlLoader.Load(this);
     this.DataContext = AppServiceLocator.GetService <MainWindowViewModel>();
 }