public void TemplateSetup() { Ctx.AddIterator("NodeConfigProperty", _ => _.Graph.NodeItems.OfType <ShellNodeTypeNode>()); Ctx.AddIterator("GetSelectionCommand", _ => _.Graph.NodeItems.OfType <ShellChildItemTypeNode>().Where(x => x["Typed"])); Ctx.TryAddNamespace("Invert.Core"); Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); }
public void TemplateSetup() { Ctx.AddIterator("NodeConfigProperty", _ => _.Graph.NodeItems.OfType <ShellNodeConfig>()); Ctx.AddIterator("GetSelectionCommand", _ => _.Graph.AllGraphItems.OfType <ShellNodeConfigSection>().Where(x => x.IsTyped && x.SectionType == ShellNodeConfigSectionType.ChildItems)); Ctx.TryAddNamespace("Invert.Core"); Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); }
public void TemplateSetup() { this.Ctx.TryAddNamespace("uFrame.Kernel"); this.Ctx.TryAddNamespace("uFrame.MVVM"); this.Ctx.TryAddNamespace("uFrame.MVVM.Bindings"); this.Ctx.TryAddNamespace("uFrame.Serialization"); if (Ctx.IsDesignerFile) { Ctx.SetBaseType(typeof(ViewComponent)); } foreach (var property in Ctx.Data.View.Element.PersistedItems.OfType <ITypedItem>()) { var type = InvertApplication.FindTypeByNameExternal(property.RelatedTypeName); if (type == null) { continue; } Ctx.TryAddNamespace(type.Namespace); } Ctx.AddIterator("ExecuteCommandOverload", _ => _.View.Element.LocalCommands); //Ctx.AddIterator("ExecuteCommand", _ => _.View.Element.InheritedCommandsWithLocal.Where(p => string.IsNullOrEmpty(p.RelatedTypeName))); ////Ctx.AddIterator("ExecuteCommandOverload", _ => _.View.Element.InheritedCommandsWithLocal); //Ctx.AddIterator("ExecuteCommandWithArg", _ => _.View.Element.InheritedCommandsWithLocal.Where(p => !string.IsNullOrEmpty(p.RelatedTypeName) && p.OutputCommand == null)); }
public void TemplateSetup() { this.Ctx.TryAddNamespace("uFrame.IOC"); this.Ctx.TryAddNamespace("uFrame.Kernel"); this.Ctx.TryAddNamespace("uFrame.MVVM"); foreach (var property in Ctx.Data.PersistedItems.OfType <ITypedItem>()) { var type = InvertApplication.FindTypeByNameExternal(property.RelatedTypeName); if (type == null) { continue; } Ctx.TryAddNamespace(type.Namespace); } if (Ctx.IsDesignerFile) { Ctx.CurrentDeclaration.BaseTypes.Add(typeof(MonoBehaviour).ToCodeReference()); Ctx.SetBaseType(typeof(SystemLoader)); } //Ctx.AddIterator("InstanceProperty", node => node.Instances); Ctx.AddIterator("ControllerProperty", node => node.GetContainingNodesInProject(Ctx.Data.Project).OfType <ElementNode>()); }
public void TemplateSetup() { Ctx.AddIterator("NodeConfigProperty", _ => _.Graph.NodeItems.OfType <ShellNodeConfig>()); Ctx.AddIterator("GetSelectionCommand", _ => _.Graph.AllGraphItems.OfType <ShellNodeConfigSection>().Where(x => x.IsTyped && x.SectionType == ShellNodeConfigSectionType.ChildItems)); //Ctx.TryAddNamespace("Invert.Core"); //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); Ctx.TryAddNamespace("uFrame.Editor"); Ctx.TryAddNamespace("uFrame.Editor.Configurations"); Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); Ctx.TryAddNamespace("uFrame.Editor.GraphUI"); Ctx.TryAddNamespace("uFrame.Editor.GraphUI.Drawers"); Ctx.TryAddNamespace("uFrame.Editor.TypesSystem"); Ctx.TryAddNamespace("uFrame.IOC"); }
public void TemplateSetup() { // Support inheritance Ctx.CurrentDeclaration.BaseTypes.Clear(); if (!SimpleClassNode.IsStruct) { if (Ctx.IsDesignerFile) { if (SimpleClassNode.BaseNode != null) { Ctx.CurrentDeclaration.BaseTypes.Add((SimpleClassNode.BaseNode.Name).ToCodeReference()); } Ctx.CurrentDeclaration.BaseTypes.Add(typeof(IJSonSerializable)); } else { Ctx.SetBaseType((SimpleClassNode.Node.Name + "Base").ToCodeReference()); } } else { if (SimpleClassNode.BaseNode != null) { throw new TemplateException(Ctx.Item.Name + " is Struct, but BaseNode = " + SimpleClassNode.BaseNode.FullName); } Ctx.CurrentDeclaration.IsClass = false; Ctx.CurrentDeclaration.IsStruct = true; if (Ctx.IsDesignerFile) { Ctx.CurrentDeclaration.Name = Ctx.Data.Node.Name.Clean(); Ctx.CurrentDeclaration.BaseTypes.Add(typeof(IJSonSerializable)); } } foreach (var property in Ctx.Data.ChildItemsWithInherited.OfType <ITypedItem>()) { var type = InvertApplication.FindTypeByNameExternal(property.RelatedTypeName); if (type == null) { continue; } Ctx.TryAddNamespace(type.Namespace); } Ctx.AddIterator("Property", node => node.Properties); Ctx.AddIterator("Collection", node => node.Collections); }
public void TemplateSetup() { foreach (var property in Ctx.Data.ChildItemsWithInherited.OfType <ITypedItem>()) { var type = InvertApplication.FindTypeByNameExternal(property.RelatedTypeName); if (type == null) { continue; } Ctx.TryAddNamespace(type.Namespace); } Ctx.AddIterator("Property", node => node.Properties); Ctx.AddIterator("Collection", node => node.Collections); }
public void TemplateSetup() { //Ctx.TryAddNamespace("Invert.Core"); //Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); Ctx.TryAddNamespace("uFrame.Editor.Configurations"); Ctx.TryAddNamespace("uFrame.Editor.Core"); Ctx.TryAddNamespace("uFrame.Editor.Graphs.Data"); var i = new CodeTypeDeclaration(Ctx.Data.ReferenceClassName) { IsInterface = true, Attributes = MemberAttributes.Public, IsPartial = true, }; i.BaseTypes.Add(new CodeTypeReference(typeof(IDiagramNodeItem))); i.BaseTypes.Add(new CodeTypeReference(typeof(IConnectable))); Ctx.Namespace.Types.Add(i); if (Ctx.Data.Inheritable && Ctx.IsDesignerFile) { Ctx.CurrentDeclaration.BaseTypes.Clear(); Ctx.CurrentDeclaration.BaseTypes.Add(typeof(GenericInheritableNode)); } if (Ctx.IsDesignerFile && Ctx.Data.IsClass) { Ctx.CurrentDeclaration.BaseTypes.Add(typeof(IClassTypeNode)); } Ctx.AddIterator("PossibleReferenceItems", _ => _.Sections.Where(p => p.SectionType == ShellNodeConfigSectionType.ReferenceItems)); Ctx.AddIterator("ReferenceSectionItems", _ => _.Sections.Where(p => p.SectionType == ShellNodeConfigSectionType.ReferenceItems)); Ctx.AddIterator("SectionItems", _ => _.Sections.Where(p => p.SectionType == ShellNodeConfigSectionType.ChildItems)); Ctx.AddIterator("InputSlotId", _ => _.InputSlots); Ctx.AddIterator("InputSlot", _ => _.InputSlots); Ctx.AddIterator("OutputSlotId", _ => _.OutputSlots); Ctx.AddIterator("OutputSlot", _ => _.OutputSlots); Ctx.AddCondition("AllowMultipleOutputs", _ => !_.Inheritable); Ctx.AddCondition("ClassName", _ => Ctx.Data.IsClass); //Ctx.AddIterator("CustomSelectorItems", _ => _.CustomSelectors); foreach (var item in Ctx.Data.IncludedInSections) { Ctx.CurrentDeclaration.BaseTypes.Add(item.ReferenceClassName); } }
public void TemplateSetup() { foreach (var property in Ctx.Data.PersistedItems.OfType <ITypedItem>()) { var type = InvertApplication.FindTypeByNameExternal(property.RelatedTypeName); if (type == null) { continue; } Ctx.TryAddNamespace(type.Namespace); } if (Ctx.IsDesignerFile) { Ctx.CurrentDeclaration.BaseTypes.Add(typeof(MonoBehaviour).ToCodeReference()); } Ctx.AddIterator("ControllerProperty", node => node.Children.OfType <ElementNode>()); }
public virtual void TemplateSetup() { if (Ctx.IsDesignerFile) { Ctx.SetBaseType(typeof(ViewComponent)); } foreach (var property in Ctx.Data.View.Element.PersistedItems.OfType <ITypedItem>()) { var type = InvertApplication.FindTypeByNameExternal(property.RelatedTypeName); if (type == null) { continue; } Ctx.TryAddNamespace(type.Namespace); } Ctx.AddIterator("ExecuteCommandOverload", _ => _.View.Element.LocalCommands); }
public void TemplateSetup() { this.Ctx.TryAddNamespace("uFrame.Kernel"); this.Ctx.TryAddNamespace("uFrame.MVVM"); this.Ctx.TryAddNamespace("uFrame.MVVM.Bindings"); this.Ctx.TryAddNamespace("uFrame.Serialization"); foreach (var property in Ctx.Data.ChildItems.OfType <ITypedItem>()) { var type = InvertApplication.FindTypeByNameExternal(property.RelatedTypeName); if (type == null) { continue; } Ctx.TryAddNamespace(type.Namespace); } Ctx.AddIterator("Property", node => node.Properties); Ctx.AddIterator("Collection", node => node.Collections); }
public void TemplateSetup() { Ctx.TryAddNamespace("Invert.Core.GraphDesigner"); if (Ctx.Data.Inheritable && Ctx.IsDesignerFile) { Ctx.CurrentDeclaration.BaseTypes.Clear(); Ctx.CurrentDeclaration.BaseTypes.Add(typeof(GenericInheritableNode)); } Ctx.AddIterator("PossibleReferenceItems", _ => _.Sections.Where(p => p.SourceItem is ShellNodeTypeReferenceSection)); Ctx.AddIterator("ReferenceSectionItems", _ => _.Sections.Where(p => p.SourceItem is ShellNodeTypeReferenceSection)); Ctx.AddIterator("SectionItems", _ => _.Sections.Where(p => p.SourceItem is ShellSectionNode)); Ctx.AddIterator("InputSlot", _ => _.InputSlots); Ctx.AddIterator("OutputSlot", _ => _.OutputSlots); Ctx.AddCondition("AllowMultipleOutputs", _ => !_.Inheritable); //Ctx.AddIterator("CustomSelectorItems", _ => _.CustomSelectors); foreach (var item in Ctx.Data.IncludedInSections) { Ctx.CurrentDeclaration.BaseTypes.Add(item.ReferenceClassName); } }
public virtual void TemplateSetup() { // Let the Dll Know about uFrame Binding Specific Types uFrameBindingType.ObservablePropertyType = typeof(IObservableProperty); uFrameBindingType.UFGroupType = typeof(UFGroup); uFrameBindingType.ICommandType = typeof(ISignal); foreach (var property in Ctx.Data.Element.PersistedItems.OfType <ITypedItem>()) { var type = InvertApplication.FindTypeByNameExternal(property.RelatedTypeName); if (type == null) { continue; } Ctx.TryAddNamespace(type.Namespace); } if (Ctx.IsDesignerFile && Ctx.Data.BaseNode == null) { Ctx.SetBaseType(typeof(ViewBase)); } // Add namespaces based on the types used for properties Ctx.AddIterator("ViewComponentProperty", _ => _.OutputsTo <ViewComponentNode>()); // Add the iterators for template method/property if (Ctx.Data.BaseNode == null) { Ctx.AddIterator("ExecuteCommand", _ => _.Element.InheritedCommandsWithLocal.Where(p => !p.HasArgument)); Ctx.AddIterator("ExecuteCommandOverload", _ => _.Element.InheritedCommandsWithLocal); Ctx.AddIterator("ExecuteCommandWithArg", _ => _.Element.InheritedCommandsWithLocal.Where( p => p.HasArgument && p.OutputCommand == null)); } else { Ctx.AddIterator("ExecuteCommand", _ => _.Element.LocalCommands.Where(p => !p.HasArgument)); Ctx.AddIterator("ExecuteCommandOverload", _ => _.Element.LocalCommands); Ctx.AddIterator("ExecuteCommandWithArg", _ => _.Element.LocalCommands.Where( p => p.HasArgument && p.OutputCommand == null)); } Ctx.AddIterator("ResetProperty", _ => _.SceneProperties); Ctx.AddIterator("CalculateProperty", _ => _.SceneProperties); Ctx.AddIterator("GetPropertyObservable", _ => _.SceneProperties); Ctx.AddCondition("ViewModelProperty", _ => !_.IsDerivedOnly); Ctx.AddCondition("DefaultIdentifier", _ => !_.IsDerivedOnly); Ctx.AddCondition("ViewModelType", _ => !_.IsDerivedOnly); if (Ctx.IsDesignerFile) { return; } // For each binding lets do some magic foreach (var item in Ctx.Data.Bindings) { // Cast the source of our binding (ie: Property, Collection, Command..etc) var source = item.SourceItem as ITypedItem; if (source == null) { continue; } // Grab the uFrame Binding Type var bindingType = item.BindingType; // Create the binding signature based on the Method Info bindingType.CreateBindingSignature(new CreateBindingSignatureParams( Ctx.CurrentDeclaration, _ => source.RelatedTypeName.ToCodeReference(), Ctx.Data, source) { Ctx = Ctx, BindingsReference = item, DontImplement = true }); } }