public override void LoadAll(IPluginManagerService svc) { ScriptDomainManager sdm = ScriptDomainManager.CurrentManager; LanguageProvider langs = sdm.GetLanguageProviderByFileExtension("py"); Console.WriteLine(langs); }
public InitializingPluginManagerServiceDecorator( IPluginManagerService decorated, Container container, IPluginToServiceProviderBridge serviceProvider) { this.pluginManagerService = pluginManagerService; this.container = container; this.serviceProvider = serviceProvider; }
public ApplicationOptionsViewModel(IPluginManagerService pluginManagerService) { PluginManagerService = pluginManagerService; Globals.AppSettings = AppSettings.Load(); AppSettings = Globals.AppSettings; AvailableTransmissionLossEngines.AddRange(from key in PluginManagerService[PluginType.TransmissionLossCalculator].Keys select (PluginBase)PluginManagerService[PluginType.TransmissionLossCalculator][key].DefaultPlugin); SelectedTransmissionLossEngine = AvailableTransmissionLossEngines.FirstOrDefault(engine => engine.PluginIdentifier == AppSettings.SelectedTransmissionLossEngine); _propertyObserver = new PropertyObserver<ApplicationOptionsViewModel>(this) .RegisterHandler(p => p.SelectedTransmissionLossEngine, () => { Globals.AppSettings.SelectedTransmissionLossEngine = SelectedTransmissionLossEngine.PluginIdentifier; }); }
public static void Draw(IUiManagerService ui, IAgentManagerService agentMan, IPluginManagerService pluginMan, HttpClient http) { ImGui.SetNextWindowSize(new Vector2(600, 400)); ImGui.Begin("Island Universe", ImGuiWindowFlags.NoResize); _ = State switch { WindowState.Index => DrawIndex(ui), WindowState.AgentIndex => DrawAgentIndex(ui, agentMan, http), WindowState.AgentSetup => DrawAgentSetup(pluginMan), WindowState.Settings => DrawSettings(ui), _ => throw new NotImplementedException(), }; ImGui.End(); }
private static bool DrawAgentSetup(IPluginManagerService pluginMan) { var properties = CurrentAgent.GetType().GetProperties(BindingFlags.FlattenHierarchy | BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public); ImGui.BeginChild("##MainWindowColumnHolder3", new Vector2(800, 330)); { ImGui.Columns(2, "##MainWindowColumns3", border: false); { ImGui.Combo("", ref selectedAgentType, pluginMan.LoadedAgentTypes .Select(agent => (string)agent.GetProperty("AgentTypeName").GetValue(null)).ToArray(), pluginMan.LoadedAgentTypes.Count()); foreach (var property in properties.Where(prop => prop.GetCustomAttribute <AgentEditableAttribute>(true) != null)) { ImGui.Text(property.Name); var temp = property.GetValue(CurrentAgent); if (property.PropertyType == typeof(string)) { var tempString = (string)temp ?? string.Empty; if (ImGui.InputText($"##{property.Name}", ref tempString, 3500000)) { property.SetMethod.Invoke(CurrentAgent, new[] { tempString }); } } } if (ImGui.Button("Done##AgentSetup")) { State = WindowState.AgentIndex; } } ImGui.GetWindowDrawList().AddLine( ImGui.GetWindowPos() + new Vector2(392, 42), ImGui.GetWindowPos() + new Vector2(392, 322), ImGui.GetColorU32(ImGuiCol.Border)); ImGui.NextColumn(); { ImGui.BeginChild("##AgentSetupDescription", new Vector2(200, 330)); var property = properties.FirstOrDefault(prop => prop.Name == "AgentDescription"); ImGui.TextWrapped((string)property.GetValue(null)); ImGui.EndChild(); } } ImGui.EndChild(); return(true); }
public override void LoadAll(IPluginManagerService svc) { Configuration.IdeSupport.about.progressBar1.Value = 10; new LanguageService(); Configuration.IdeSupport.about.progressBar1.Value += 20; new ImageListProvider(); if (SettingsService.idemode) { new ToolBarService(); new MenuService(); new StatusBarService(); } Configuration.IdeSupport.about.progressBar1.Value += 10; new DiscoveryService(); new CodeModelManager(); new ErrorService(); // figure some way out to order these for toolbar/menu new FileManager(); new EditService(); new ProjectManager(); new BuildService(); new DebugService(); new ToolsService(); new HelpService(); new UpdaterService(); Configuration.IdeSupport.about.progressBar1.Value += 10; new ShellService(); new ScriptingService(); new StandardConsole(); new SettingsService(); new PropertyService(); Configuration.IdeSupport.about.progressBar1.Value = 55; }
public override void LoadAll(IPluginManagerService svc) { new Xacc.Languages.MercuryLang(); new Xacc.Languages.PatchLanguage(); new Xacc.Languages.ScalaLang(); new Xacc.Languages.PowerShellLang(); new Xacc.Languages.CssLang(); new Xacc.Languages.ILLanguage(); new Xacc.Languages.HLSLLang(); new Xacc.Languages.JavaScriptLanguage(); new Xacc.Languages.BooLanguage(); new Xacc.Languages.RubyLang(); new Xacc.Languages.FSharpLang(); new Xacc.Languages.IronPythonLang(); new Xacc.Languages.CppLang(); new Xacc.Languages.NemerleLang(); new Xacc.Languages.VBNETLang(); new Xacc.Languages.NSISLang(); new Xacc.Languages.SqlLang(); new Xacc.Languages.CatLanguage(); }
public TransmissionLossCalculatorService(IMasterDatabaseService databaseService, IPluginManagerService pluginService, EnvironmentalCacheService cacheService) : this() { _databaseService = databaseService; _cacheService = cacheService; }
public TransmissionLossCalculatorPluginBase GetTransmissionLossPlugin(IPluginManagerService pluginManagerService) { return (from engine in from pluginSubtype in pluginManagerService[PluginType.TransmissionLossCalculator].Keys select (TransmissionLossCalculatorPluginBase)pluginManagerService[PluginType.TransmissionLossCalculator][pluginSubtype].DefaultPlugin where engine.PluginIdentifier.Type == TransmissionLossPluginType select engine).FirstOrDefault() ?? ((TransmissionLossCalculatorPluginBase)pluginManagerService[PluginType.TransmissionLossCalculator].Values.First().DefaultPlugin); }
public static IApplicationBuilder UsePlugin(this IApplicationBuilder applicationBuilder) { var serviceProvider = applicationBuilder.ApplicationServices; PluginOptions _pluginOptions = serviceProvider.GetService <IOptions <PluginOptions> >().Value; if (!_pluginOptions.Enable) { return(applicationBuilder); } MvcRazorRuntimeCompilationOptions option = serviceProvider.GetService <IOptions <MvcRazorRuntimeCompilationOptions> >()?.Value; var pluginsLoadContexts = serviceProvider.GetService <IPluginsAssemblyLoadContexts>(); //AssemblyLoadContextResoving(pluginsLoadContexts); IReferenceLoader loader = serviceProvider.GetService <IReferenceLoader>(); var moduleSetup = serviceProvider.GetService <IMvcModuleSetup>(); IPluginManagerService pluginManager = serviceProvider.GetService <IPluginManagerService>(); List <PluginInfoDto> allEnabledPlugins = pluginManager.GetAllPlugins().ConfigureAwait(false).GetAwaiter().GetResult(); ModuleChangeDelegate moduleStarted = (moduleEvent, context) => { if (context?.PluginContext == null || context?.PluginContext.PluginEntityAssemblies.Count() == 0) { return; } //var pluginContexts = pluginsLoadContexts.All().Select(c => c.PluginContext).SkipWhile(c => c == null); switch (moduleEvent) { case ModuleEvent.Installed: HandleModuleInstallEvent(serviceProvider, context); break; case ModuleEvent.Loaded: HandleModuleLoadEvent(serviceProvider, context); break; case ModuleEvent.Started: break; case ModuleEvent.Stoped: break; case ModuleEvent.UnInstalled: HandleModuleUnintallEvent(serviceProvider, context); break; default: break; } }; moduleSetup.ModuleChangeEventHandler += moduleStarted; var env = serviceProvider.GetService <IHostEnvironment>(); foreach (var plugin in allEnabledPlugins) { string filePath = Path.Combine(env.ContentRootPath, _pluginOptions.InstallBasePath, plugin.Name, $"{ plugin.Name}.dll"); //option.FileProviders.Add(new PhysicalFileProvider(Path.Combine(AppContext.BaseDirectory, _pluginOptions.InstallBasePath, plugin.Name))); option.AdditionalReferencePaths.Add(filePath); if (plugin.IsEnable) { moduleSetup.EnableModule(plugin.Name); } else { moduleSetup.LoadModule(plugin.Name, false); } } AdditionalReferencePathHolder.AdditionalReferencePaths = option?.AdditionalReferencePaths; var razorViewEngineOptions = serviceProvider.GetService <IOptions <RazorViewEngineOptions> >()?.Value; razorViewEngineOptions?.AreaViewLocationFormats.Add("/Plugins/{2}/Views/{1}/{0}" + RazorViewEngine.ViewExtension); razorViewEngineOptions?.AreaViewLocationFormats.Add("/Views/Shared/{0}.cshtml"); return(applicationBuilder); }
public MainViewModel(IViewAwareStatus viewAwareStatus, IMasterDatabaseService database, IMessageBoxService messageBox, IUIVisualizerService visualizer, IHRCSaveFileService saveFile, IHRCOpenFileService openFile, TransmissionLossCalculatorService transmissionLoss, IPluginManagerService plugins, EnvironmentalCacheService cache) { try { Mediator.Instance.Register(this); } catch (Exception ex) { Debug.WriteLine("***********\nMainViewModel: Mediator registration failed: " + ex.Message + "\n***********"); throw; } Cursor = Cursors.Arrow; ESME.Data.AppSettings.ApplicationName = App.Name; Globals.AppSettings = ESME.Data.AppSettings.Load(ESME.Data.AppSettings.AppSettingsFile); Globals.AppSettings.Save(); Globals.PluginManagerService = plugins; Globals.TransmissionLossCalculatorService = transmissionLoss; Globals.MasterDatabaseService = database; Globals.VisualizerService = visualizer; Globals.SaveFileService = saveFile; Globals.OpenFileService = openFile; Globals.EnvironmentalCacheService = cache; Globals.ViewAwareStatusService = viewAwareStatus; Globals.MessageBoxService = messageBox; MapViewModel = new MapViewModel(this); Globals.TransmissionLossCalculatorService.WorkQueue.PropertyChanged += (s, e) => { if (e.PropertyName == "Count") { TransmissionLossActivity = Globals.TransmissionLossCalculatorService.WorkQueue.Keys.Count > 0 ? string.Format("Acoustic Simulator: {0} items", Globals.TransmissionLossCalculatorService.WorkQueue.Keys.Count) : "Acoustic Simulator: idle"; // Debug.WriteLine(string.Format("TransmissionLossActivity: {0}", TransmissionLossActivity)); var isBusy = Globals.TransmissionLossCalculatorService.WorkQueue.Keys.Count > 0; IsTransmissionLossBusy = isBusy; if (!isBusy && IsSaveSampleDataRequested) { Globals.MasterDatabaseService.SaveChanges(); IsSaveSampleDataRequested = false; } } }; if (Designer.IsInDesignMode) return; Globals.ViewAwareStatusService.ViewLoaded += ViewLoaded; //_appTracker = new ApplicationTracker("UA-44329261-1", "TestWPFApp"); //_appTracker.StartSession(); //_appTracker.TrackEvent(ApplicationTrackerCategories.Command, "ApplicationStartup"); }
/// <summary> /// Loads all /// </summary> /// <param name="svc">the calling service</param> public abstract void LoadAll(IPluginManagerService svc);
public PluginManagerController(IPluginManagerService pluginManager, PluginPackageManager pluginPackageManager) { _pluginManager = pluginManager; _pluginPackageManager = pluginPackageManager; }
public OperationResolver(IPluginManagerService pluginManagerService, ILoggerService logger) { Operations = pluginManagerService.GetOperations <IOperation>(); _logger = logger; }