private static void InitializeContainer(IQFrameworkContainer container) { mViews = null; container.RegisterInstance(container); var viewTypes = GetDerivedTypes <IPackageKitView>(false, false).ToArray(); foreach (var view in viewTypes) { var viewInstance = Activator.CreateInstance(view) as IPackageKitView; if (viewInstance == null) { continue; } container.RegisterInstance(viewInstance, view.Name, false); container.RegisterInstance(viewInstance.GetType(), viewInstance); } container.InjectAll(); foreach (var view in Views) { view.Container = Container; view.Init(Container); } foreach (var view in Views) { container.Inject(view); } }
private static void InitializeContainer(IQFrameworkContainer container) { container.RegisterInstance(container); var viewTypes = FrameworkEngine.GetDerivedTypes <ISubModule>(false, false).ToArray(); Debug.Log($"viewTypes = {viewTypes.Length} "); foreach (var view in viewTypes) { var viewInstance = Activator.CreateInstance(view) as ISubModule; if (viewInstance == null) { continue; } container.RegisterInstance(viewInstance, view.Name, false); container.RegisterInstance(viewInstance.GetType(), viewInstance); } container.InjectAll(); _subModules = Container.ResolveAll <ISubModule>().ToList(); Debug.Log($"_subModules = {_subModules.Count} "); foreach (var view in _subModules) { view.Init(Container); } // foreach (var view in _subModules) // { // container.Inject(view); // } }
public static WindowFactory <TWindow> RegisterWindow <TWindow>(this IQFrameworkContainer container, string name) where TWindow : class, IWindow { var factory = new WindowFactory <TWindow>(container, name); container.RegisterInstance(factory, name); container.RegisterInstance <IWindowFactory>(factory, name); //container.RegisterInstance<IWindowFactory<TWindow>>(factory,name); return(factory); }
protected override void OnModelConfig(IQFrameworkContainer modelLayer) { // 包类型 modelLayer.RegisterInstance <IPackageTypeConfigModel>(new PackageTypeConfigModel()); // 已安装类型 modelLayer.RegisterInstance <IInstalledPackageVersionsConfigModel>(new InstalledPackageVersionsConfigModel()); modelLayer.RegisterInstance <IPackageManagerModel>(new PackageManagerModel()); modelLayer.RegisterInstance <IPackageManagerServer>(new PackageManagerServer()); }
private static void InitializeContainer(IQFrameworkContainer container) { _plugins = null; container.RegisterInstance <IQFrameworkContainer>(container); var pluginTypes = GetDerivedTypes <ICorePlugin>(false, false).ToArray(); // Load all plugins foreach (var diagramPlugin in pluginTypes) { if (pluginTypes.Any(p => p.BaseType == diagramPlugin)) { continue; } var pluginInstance = Activator.CreateInstance((Type)diagramPlugin) as ICorePlugin; if (pluginInstance == null) { continue; } container.RegisterInstance(pluginInstance, diagramPlugin.Name, false); container.RegisterInstance(pluginInstance.GetType(), pluginInstance); if (pluginInstance.Enabled) { foreach (var item in diagramPlugin.GetInterfaces()) { ListenFor(item, pluginInstance); } } } container.InjectAll(); foreach (var diagramPlugin in Plugins.OrderBy(p => p.LoadPriority).Where(p => !p.Ignore)) { if (diagramPlugin.Enabled) { var start = DateTime.Now; diagramPlugin.Container = Container; diagramPlugin.Initialize(Container); } } foreach (var diagramPlugin in Plugins.OrderBy(p => p.LoadPriority).Where(p => !p.Ignore)) { if (diagramPlugin.Enabled) { var start = DateTime.Now; container.Inject(diagramPlugin); diagramPlugin.Loaded(Container); diagramPlugin.LoadTime = DateTime.Now.Subtract(start); } } SignalEvent <ISystemResetEvents>(_ => _.SystemRestarted()); }
private static void InitializeContainer(IQFrameworkContainer container) { mPlugins = null; container.RegisterInstance(container); var pluginTypes = GetDerivedTypes <QFramework.IPackageKitView>(false, false).ToArray(); foreach (var diagramPlugin in pluginTypes) { var pluginInstance = Activator.CreateInstance((Type)diagramPlugin) as QFramework.IPackageKitView; if (pluginInstance == null) { continue; } container.RegisterInstance(pluginInstance, diagramPlugin.Name, false); container.RegisterInstance(pluginInstance.GetType(), pluginInstance); if (pluginInstance.Enabled) { foreach (var item in diagramPlugin.GetInterfaces()) { ListenFor(item, pluginInstance); } } } container.InjectAll(); foreach (var diagramPlugin in Plugins.Where(p => !p.Ignore)) { if (diagramPlugin.Enabled) { var start = DateTime.Now; diagramPlugin.Container = Container; diagramPlugin.Init(Container); } } foreach (var diagramPlugin in Plugins.Where(p => !p.Ignore)) { if (diagramPlugin.Enabled) { var start = DateTime.Now; container.Inject(diagramPlugin); // diagramPlugin.Loaded(Container); // diagramPlugin.LoadTime = DateTime.Now.Subtract(start); } } SignalEvent <ISystemResetEvents>(_ => _.SystemRestarted()); }
public static void RegisterConnectable(this IQFrameworkContainer container, Type outputType, Type inputType) { container.RegisterInstance(new RegisteredConnection() { TInputType = inputType, TOutputType = outputType }, outputType.Name + inputType.Name); }
public static void RegisterConnectable <TOutput, TInput>(this IQFrameworkContainer container) { container.RegisterInstance <RegisteredConnection>(new RegisteredConnection() { TInputType = typeof(TInput), TOutputType = typeof(TOutput) }, typeof(TOutput).Name + typeof(TInput).Name); }
public static WorkspaceConfiguration AddWorkspaceConfig <TWorkspaceType>(this IQFrameworkContainer container, string title, string description = null) { var config = new WorkspaceConfiguration(typeof(TWorkspaceType), title, description); container.RegisterInstance(config, typeof(TWorkspaceType).Name); return(config); }
public static IQFrameworkContainer RegisterConnectionStrategy <TConnectionStrategy>( this IQFrameworkContainer container) where TConnectionStrategy : IConnectionStrategy, new() { container.RegisterInstance <IConnectionStrategy>(new TConnectionStrategy(), typeof(TConnectionStrategy).Name); return(container); }
private static void InitializeContainer(IQFrameworkContainer container) { container.RegisterInstance(container); container.InjectAll(); SignalEvent <ISystemResetEvents>(_ => _.SystemRestarted()); }
public PackageManagerApp() { // 注册好 自己的实例 Container.RegisterInstance(Container); // 配置命令的执行 TypeEventSystem.Register <IEditorStrangeMVCCommand>(OnCommandExecute); InstalledPackageVersions.Reload(); // 注册好 model var model = new PackageManagerModel { Repositories = PackageInfosRequestCache.Get().PackageRepositories }; Container.RegisterInstance(model); Container.Register <IPackageManagerServer, PackageManagerServer>(); }
public AbstractApp() { mTypeEventSystem.Clear(); // 注册好 自己的实例 Container.RegisterInstance(Container); // 配置命令的执行 mTypeEventSystem.RegisterEvent <TCommand>(OnCommandExecute); ConfigureService(Container); }
public static NodeConfigBase GetNodeConfig(this IQFrameworkContainer container, Type nodeType) { var config = container.Resolve <NodeConfigBase>(nodeType.Name); if (config == null) { var nodeconfigType = typeof(NodeConfig <>).MakeGenericType(nodeType); var nodeConfig = Activator.CreateInstance(nodeconfigType, container) as NodeConfigBase; nodeConfig.NodeType = nodeType; container.RegisterInstance(nodeConfig, nodeType.Name); //nodeConfig.Section(string.Empty, _ => _.PersistedItems.OfType<GenericConnectionReference>(), false); return(nodeConfig); } return(config); }
protected override void OnUtilityConfig(IQFrameworkContainer utilityLayer) { utilityLayer.RegisterInstance <IBinarySerializer>(new BinarySerializer()); }
protected override void OnModelConfig(IQFrameworkContainer modelLayer) { InstalledPackageVersions.Reload(); modelLayer.RegisterInstance <IPackageManagerModel>(new PackageManagerModel()); modelLayer.RegisterInstance <IPackageManagerServer>(new PackageManagerServer()); }
protected override void OnSystemConfig(IQFrameworkContainer systemLayer) { systemLayer.RegisterInstance <IXMLToObjectConvertSystem>(new XMLToObjectConvertSystem()); }
protected override void OnUtilityConfig(IQFrameworkContainer utilityLayer) { utilityLayer.RegisterInstance <IJsonSerializeUtility>(new DefaultJsonSerializeUtility()); }
protected override void OnUtilityConfig(IQFrameworkContainer utilityLayer) { // 弹框注册 utilityLayer.RegisterInstance <IEditorDialogUtility>(new EditorDialogUtility()); }
protected override void ConfigureService(IQFrameworkContainer container) { container.RegisterInstance <IPackageLoginService>(new PacakgeLoginService()); }
protected override void OnModelConfig(IQFrameworkContainer modelLayer) { modelLayer.RegisterInstance <IPackageLoginService>(new PacakgeLoginService()); }
static void Init() { // 默认注入 Unity 官方的序列化器 SerializeContainer.RegisterInstance <IJsonSerializer>(new DefaultJsonSerializer()); }
private static void InitializeContainer(IQFrameworkContainer container) { container.RegisterInstance(container); container.InjectAll(); }
protected override void OnUtilityConfig(IQFrameworkContainer utilityLayer) { utilityLayer.RegisterInstance <IActionExecutor>(new MonoExecutor()); }
protected void OnStart(IQFrameworkContainer container) { PathParser pathParser = new PathParser(); ExpressionPathFinder expressionPathFinder = new ExpressionPathFinder(); ConverterRegistry converterRegistry = new ConverterRegistry(); ObjectSourceProxyFactory objectSourceProxyFactory = new ObjectSourceProxyFactory(); objectSourceProxyFactory.Register(new UniversalNodeProxyFactory(), 0); SourceProxyFactory sourceFactory = new SourceProxyFactory(); sourceFactory.Register(new LiteralSourceProxyFactory(), 0); sourceFactory.Register(new ExpressionSourceProxyFactory(sourceFactory, expressionPathFinder), 1); sourceFactory.Register(objectSourceProxyFactory, 2); TargetProxyFactory targetFactory = new TargetProxyFactory(); targetFactory.Register(new UniversalTargetProxyFactory(), 0); targetFactory.Register(new UnityTargetProxyFactory(), 10); BindingFactory bindingFactory = new BindingFactory(sourceFactory, targetFactory); StandardBinder binder = new StandardBinder(bindingFactory); container.RegisterInstance <IBinder>(binder); container.RegisterInstance <IBindingFactory>(bindingFactory); container.RegisterInstance <IConverterRegistry>(converterRegistry); container.RegisterInstance <IExpressionPathFinder>(expressionPathFinder); container.RegisterInstance <IPathParser>(pathParser); container.RegisterInstance <INodeProxyFactory>(objectSourceProxyFactory); container.RegisterInstance <INodeProxyFactoryRegister>(objectSourceProxyFactory); container.RegisterInstance <ISourceProxyFactory>(sourceFactory); container.RegisterInstance <ISourceProxyFactoryRegistry>(sourceFactory); container.RegisterInstance <ITargetProxyFactory>(targetFactory); container.RegisterInstance <ITargetProxyFactoryRegister>(targetFactory); }
/// <summary> /// 注册游戏模式 /// </summary> /// <typeparam name="T"></typeparam> public static void RegisterGameMode <T>() where T : IGameMode, new() { mContainer.RegisterInstance <IGameMode>(new T()); }