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 NodeConfig <TNodeData> AddNode <TNodeData>(this IQFrameworkContainer container, string tag = null) where TNodeData : GenericNode { var config = container.AddNode <TNodeData, ScaffoldNode <TNodeData> .ViewModel, ScaffoldNode <TNodeData> .Drawer>(tag); return(config); }
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); }
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 void Init(IQFrameworkContainer container) { EasyIMGUI.Label().Text("账户信息").FontSize(12).Parent(this); var boxLayout = new VerticalLayout("box").Parent(this); var logoutBtn = EasyIMGUI.Button().Text("注销") .Visible(PackageKitLoginState.Logined.Value) .Parent(boxLayout); var loginView = new LoginView() .Self(self => self.Visible = PackageKitLoginState.LoginViewVisible.Value) .Parent(boxLayout); var registerView = new RegisterView() .Self(self => self.Visible = PackageKitLoginState.RegisterViewVisible.Value) .Parent(boxLayout); PackageKitLoginState.Logined.Bind(value => { logoutBtn.Visible = value; }).AddTo(mDisposableList); logoutBtn.OnClick(mControllerNode.SendCommand <LogoutCommand>); PackageKitLoginState.LoginViewVisible.Bind(value => { loginView.Visible = value; }).AddTo(mDisposableList); PackageKitLoginState.RegisterViewVisible.Bind(value => { registerView.Visible = value; }) .AddTo(mDisposableList); }
public void Init(IQFrameworkContainer container) { mRootLayout = new RootLayout(); mFrameworkInfoLayout = new RootLayout(); var frameworkData = mPackageDatas.Find(packageData => packageData.Name == "Framework"); var frameworkVersion = string.Format("QFramework:{0}", frameworkData.Version); mFrameworkInfoLayout // Framework 层 .HorizontalLayout() .Label(150) .Text.Value(frameworkVersion) .End() .Toggle() .Text.Value("Version Check") .On.Bind(() => VersionCheck) .End() .End() // end horizontal // 工具栏 .Toolbar(ToolbarIndex, ToolbarNames) .Index.Bind(() => ToolbarIndex) .End() .End(); mFrameworkInfoLayout.BindViewModel(this); }
public void Init(IQFrameworkContainer container) { mRootLayout = EasyIMGUI.Vertical(); var verticalLayout = EasyIMGUI.Vertical() .AddTo(mRootLayout); EasyIMGUI.Label().Text("技术支持").FontBold().FontSize(12).AddTo(verticalLayout); new AdvertisementItemView("官方文档:《QFramework 使用指南 2020》", "https://qframework.cn/doc") .AddTo(verticalLayout); new AdvertisementItemView("官方 qq 群:623597263", "https://shang.qq.com/wpa/qunwpa?idkey=706b8eef0fff3fe4be9ce27c8702ad7d8cc1bceabe3b7c0430ec9559b3a9ce6") .AddTo(verticalLayout); new AdvertisementItemView("提问/提需求/提 Bug/社区", "https://qframework.cn/community") .AddTo(verticalLayout); new AdvertisementItemView("github", "https://github.com/liangxiegame/QFramework") .AddTo(verticalLayout); new AdvertisementItemView("gitee", "https://gitee.com/liangxiegame/QFramework") .AddTo(verticalLayout); new AdvertisementItemView("Unity 开发者进阶班级:小班", "https://liangxiegame.com/zhuanlan/list/89064995-924f-43cd-b236-3eb3eaa01aa0") .AddTo(verticalLayout); }
public void Init(IQFrameworkContainer container) { var expendLayout = new TreeNode(false, LocaleText.UserInfo) .AddTo(this); var verticalLyaout = new VerticalLayout("box"); expendLayout.Add2Spread(verticalLyaout); AccountModel.Subject .StartWith(AccountModel.State) .Subscribe(state => { verticalLyaout.Clear(); if (state.Logined) { new ButtonView("注销", () => { AccountModel.Effects.Logout(); }).AddTo(verticalLyaout); } else { if (state.InLoginView) { new LoginView().AddTo(verticalLyaout); } else { new RegisterView().AddTo(verticalLyaout); } } }); }
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 NodeConfig <TGraphNode> AddGraph <TGraphType, TGraphNode>(this IQFrameworkContainer container, string name) where TGraphType : IGraphData where TGraphNode : GenericNode, new() { container.Register <IGraphData, TGraphType>(name); return(AddNode <TGraphNode>(container, name)); }
public static GraphItemViewModel GetNodeViewModel(this IQFrameworkContainer container, IGraphItem item, DiagramViewModel diagram) { var vm = InvertApplication.Container.ResolveRelation <ViewModel>(item.GetType(), item, diagram) as GraphItemViewModel; return(vm); }
public static IQFrameworkContainer Connectable <TSource, TTarget>(this IQFrameworkContainer container, bool oneToMany = true) where TSource : class, IConnectable where TTarget : class, IConnectable { return(Connectable <TSource, TTarget>(container, Color.white, oneToMany)); }
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); } }
public void Dispose() { TypeEventSystem.UnRegister <IEditorStrangeMVCCommand>(OnCommandExecute); Container.Clear(); Container = null; }
public void Dispose() { OnDispose(); mTypeEventSystem.UnRegisterEvent <TCommand>(OnCommandExecute); mTypeEventSystem.Clear(); Container.Clear(); Container = null; }
private static void InitializeContainer(IQFrameworkContainer container) { container.RegisterInstance(container); container.InjectAll(); SignalEvent <ISystemResetEvents>(_ => _.SystemRestarted()); }
//public static IEnumerable<IDiagramNode> GetContainingNodesInProject(this IGraphFilter filter, IProjectRepository repository) //{ // return GetContainerNodesInProjectInternal(filter, repository).Distinct(); //} //private static IEnumerable<IDiagramNode> GetContainerNodesInProjectInternal(IGraphFilter filter, IProjectRepository repository) //{ // foreach (var item in repository.Graphs) // { // var positionData = item.PositionData; // FilterLocations locations; // if (positionData.Positions.TryGetValue(filter.Identifier, out locations)) // { // foreach (var node in repository.NodeItems) // { // if (node == filter) continue; // if (locations.Keys.Contains(node.Identifier)) // { // yield return node; // } // } // } // } //} //public static IEnumerable<IDiagramNode> GetParentNodes(this IDiagramNode node) //{ // foreach (var item in node.Project.PositionData.Positions) // { // if (item.Value.Keys.Contains(node.Identifier)) // { // yield return node.Project.NodeItems.FirstOrDefault(p => p.Identifier == item.Key); // } // } //} //public static IEnumerable<IDiagramNode> GetContainingNodesResursive(this IDiagramFilter filter, INodeRepository repository) //{ // foreach (var item in filter.GetContainingNodes(repository)) // { // yield return item; // if (item is IDiagramFilter) // { // var result = GetContainingNodesResursive(item as IDiagramFilter, repository); // foreach (var subItem in result) // yield return subItem; // } // } //} public static void RegisterFilterNode <TFilterData, TAllowedItem>(this IQFrameworkContainer container) { if (!FilterExtensions.AllowedFilterNodes.ContainsKey(typeof(TFilterData))) { FilterExtensions.AllowedFilterNodes.Add(typeof(TFilterData), new List <Type>()); } FilterExtensions.AllowedFilterNodes[typeof(TFilterData)].Add(typeof(TAllowedItem)); }
public static IQFrameworkContainer AddTypeItem <TNodeData>(this IQFrameworkContainer container) where TNodeData : ITypedItem { container.AddItem <TNodeData>(); container.RegisterChildGraphItem <TNodeData, ScaffoldNodeTypedChildItem <TNodeData> .ViewModel, ScaffoldNodeTypedChildItem <TNodeData> .Drawer>(); return(container); }
public static IQFrameworkContainer RegisterConnectionStrategy <TConnectionStrategy>( this IQFrameworkContainer container) where TConnectionStrategy : IConnectionStrategy, new() { container.RegisterInstance <IConnectionStrategy>(new TConnectionStrategy(), typeof(TConnectionStrategy).Name); return(container); }
public static void RegisterFilterNode(this IQFrameworkContainer container, Type filter, Type tnode) { if (!FilterExtensions.AllowedFilterNodes.ContainsKey(filter)) { FilterExtensions.AllowedFilterNodes.Add(filter, new List <Type>()); } FilterExtensions.AllowedFilterNodes[filter].Add(tnode); }
public void Init(IQFrameworkContainer container) { var frameworkData = mPackageDatas.Find(packageData => packageData.Name == "Framework"); var frameworkVersion = string.Format("QFramework:{0}", frameworkData.Version); mEGORootLayout = new VerticalLayout(); var frameworkInfoLayout = new HorizontalLayout("box") .AddTo(mEGORootLayout); new EGO.Framework.LabelView(frameworkVersion) .Width(150) .FontBold() .FontSize(12) .AddTo(frameworkInfoLayout); new ToggleView(LocaleText.VersionCheck, VersionCheck) // .FontSize(12) // .FontBold() .AddTo(frameworkInfoLayout) .Toggle.Bind(newValue => VersionCheck = newValue); new ToolbarView(ToolbarIndex) .Menus(ToolbarNames.ToList()) .AddTo(mEGORootLayout) .Index.Bind(newIndex => ToolbarIndex = newIndex); new HeaderView() .AddTo(mEGORootLayout); var packageList = new VerticalLayout("box") .AddTo(mEGORootLayout); var scroll = new ScrollLayout() .Height(240) .AddTo(packageList); new EGO.Framework.SpaceView(2).AddTo(scroll); mOnToolbarIndexChanged = () => { scroll.Clear(); foreach (var packageData in SelectedPackageType) { new EGO.Framework.SpaceView(2).AddTo(scroll); new PackageView(packageData).AddTo(scroll); } }; foreach (var packageData in SelectedPackageType) { new EGO.Framework.SpaceView(2).AddTo(scroll); new PackageView(packageData).AddTo(scroll); } }
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); }
public static IQFrameworkContainer Connectable <TSource, TTarget>(this IQFrameworkContainer container, Color color, bool oneToMany = true) where TSource : class, IConnectable where TTarget : class, IConnectable { container.RegisterConnectable <TSource, TTarget>(); //if (oneToMany) return(container); }
public void Init(IQFrameworkContainer container) { mRootLayout = new VerticalLayout("box"); new EGO.Framework.SpaceView(6).AddTo(mRootLayout); // 命名空间 var nameSpaceLayout = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.Namespace) .FontSize(12) .FontBold() .Width(200) .AddTo(nameSpaceLayout); new TextView(mUiKitSettingData.Namespace) .AddTo(nameSpaceLayout) .Content.Bind(content => mUiKitSettingData.Namespace = content); // UI 生成的目录 new EGO.Framework.SpaceView(6).AddTo(mRootLayout); var uiScriptGenerateDirLayout = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.UIScriptGenerateDir) .FontSize(12) .FontBold() .Width(200) .AddTo(uiScriptGenerateDirLayout); new TextView(mUiKitSettingData.UIScriptDir) .AddTo(uiScriptGenerateDirLayout) .Content.Bind(content => mUiKitSettingData.UIScriptDir = content); new EGO.Framework.SpaceView(6).AddTo(mRootLayout); var uiPanelPrefabDir = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.UIPanelPrefabDir) .FontSize(12) .FontBold() .Width(200) .AddTo(uiPanelPrefabDir); new TextView(mUiKitSettingData.UIPrefabDir) .AddTo(uiPanelPrefabDir) .Content.Bind(content => mUiKitSettingData.UIPrefabDir = content); new EGO.Framework.SpaceView(6).AddTo(mRootLayout); new ButtonView(LocaleText.Apply, () => { mUiKitSettingData.Save(); }) .AddTo(mRootLayout); }
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()); }
public static IQFrameworkContainer Connectable <TSource, TTarget>(this IQFrameworkContainer container, Color color, bool oneToMany = true) where TSource : class, IConnectable where TTarget : class, IConnectable { container.RegisterConnectable <TSource, TTarget>(); //if (oneToMany) //container.RegisterInstance<IConnectionStrategy>(new CustomInputOutputStrategy<TSource, TTarget>(color), typeof(TSource).Name + "_" + typeof(TTarget).Name + "Connection"); //else //{ // container.RegisterInstance<IConnectionStrategy>(new OneToOneConnectionStrategy<TSource, TTarget>(), typeof(TSource).Name + "_" + typeof(TTarget).Name + "Connection"); //} return(container); }
protected override void ConfigureService(IQFrameworkContainer container) { InstalledPackageVersions.Reload(); // 注册好 model var model = new PackageManagerModel { Repositories = PackageInfosRequestCache.Get().PackageRepositories }; Container.RegisterInstance(model); Container.Register <IPackageManagerServer, PackageManagerServer>(); }
public static void Init(IQFrameworkContainer container = null) { if (container == null) { mContainer = new QFrameworkContainer(); } else { mContainer = container; } new BindingServiceBundle(mContainer) .Start(); }
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()); }