示例#1
0
 public void RemoveSubGameObjects(List <GameObject> gameObjects)
 {
     foreach (GameObject ga in gameObjects)
     {
         SubObjects.Remove(ga);
     }
 }
示例#2
0
        protected override IEnumerable <Query> CreateItems()
        {
            var query = new Query(ID, Name);

            SetObjectProperties(query);

            query.Properties.Description = Description;
            query.Properties.Permissions.Set(Permissions);
            query.Properties.ReadState       = ReadState;
            query.Properties.TopNumberOfRows = TopNumberOfRows;
            query.Properties.CaptionML.Set(CaptionML);
            query.Properties.OnBeforeOpen.Set(OnBeforeOpen);

            if (AutoCaption)
            {
                query.AutoCaption();
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                query.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                query.Properties.OrderBy.AddRange(subObjects.OfType <QueryOrderByLine>());
                query.Elements.AddRange(subObjects.OfType <QueryElement>());
                query.Code.Functions.AddRange(subObjects.OfType <Function>());
                query.Code.Variables.AddRange(subObjects.OfType <Variable>());
                query.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(query);
        }
        protected override IEnumerable <QueryElement> CreateItems()
        {
            var indentation = GetIndentation();

            var dataItemQueryElement = new DataItemQueryElement(DataItemTable, ID, Name, indentation);

            dataItemQueryElement.Properties.DataItemLinkType = DataItemLinkType;
            dataItemQueryElement.Properties.Description      = Description;
            dataItemQueryElement.Properties.SQLJoinType      = SQLJoinType;
            yield return(dataItemQueryElement);

            var variables = new List <PSVariable>()
            {
                new PSVariable("ElementIndentation", indentation + 1)
            };

            var subObjects = SubObjects?.InvokeWithContext(null, variables).Select(o => o.BaseObject) ?? Enumerable.Empty <object>();

            dataItemQueryElement.Properties.DataItemTableFilter.AddRange(subObjects.OfType <TableFilterLine>());
            dataItemQueryElement.Properties.DataItemLink.AddRange(subObjects.OfType <QueryDataItemLinkLine>());

            foreach (var childElement in subObjects.OfType <QueryElement>())
            {
                yield return(childElement);
            }
        }
示例#4
0
        protected override IEnumerable <PageControlBase> CreateItems()
        {
            var groupPageControl = new PageControlGroup(ID, GetIndentation(), GroupType);

            var variables = new List <PSVariable>()
            {
                new PSVariable("ControlIndentation", groupPageControl.IndentationLevel + 1)
            };
            var subObjects = SubObjects?.InvokeWithContext(null, variables).Select(o => o.BaseObject) ?? Enumerable.Empty <object>();

            groupPageControl.Properties.ActionList.AddRange(subObjects.OfType <PageActionBase>());
            groupPageControl.Properties.CaptionML.Set(CaptionML);
            groupPageControl.Properties.Description           = Description;
            groupPageControl.Properties.Name                  = Name;
            groupPageControl.Properties.Editable              = Editable;
            groupPageControl.Properties.Enabled               = Enabled;
            groupPageControl.Properties.FreezeColumnID        = FreezeColumnID;
            groupPageControl.Properties.IndentationColumnName = IndentationColumnName;
            groupPageControl.Properties.IndentationControls.Set(IndentationControls);
            groupPageControl.Properties.InstructionalTextML.Set(InstructionalTextML);
            groupPageControl.Properties.Layout     = Layout;
            groupPageControl.Properties.ShowAsTree = NullableBooleanFromSwitch(nameof(ShowAsTree));
            groupPageControl.Properties.Visible    = Visible;
            groupPageControl.AutoCaption(AutoCaption);

            yield return(groupPageControl);

            foreach (var childControl in subObjects.OfType <PageControlBase>())
            {
                yield return(childControl);
            }
        }
示例#5
0
        protected override IEnumerable <Function> CreateItems()
        {
            var function = new Function(ID, Name);

            function.Local = Local;
#if NAV2016
            function.TryFunction = NullableBooleanFromSwitch(nameof(TryFunction));
#endif
            function.ReturnValue.Name       = ReturnValueName;
            function.ReturnValue.Type       = ReturnValueType;
            function.ReturnValue.DataLength = ReturnValueDataLength ?? function.ReturnValue.DefaultDataLength;
            function.ReturnValue.Dimensions = ReturnValueDimensions;


            if (SubObjects != null)
            {
                var subObjects = SubObjects
                                 .Invoke()
                                 .Select(o => o.BaseObject);

                function.Variables.AddRange(subObjects.OfType <Variable>());
                function.Parameters.AddRange(subObjects.OfType <Parameter>());
                function.CodeLines.AddRange(subObjects.OfType <string>());
            }

            yield return(function);
        }
示例#6
0
        protected override IEnumerable <Function> CreateItems()
        {
            var function = new Function(ID, Name);

            function.Local = Local;
#if NAV2016
            function.TryFunction = NullableBooleanFromSwitch(nameof(TryFunction));
#endif
            function.ReturnValue.Name       = ReturnValueName;
            function.ReturnValue.Type       = ReturnValueType;
            function.ReturnValue.DataLength = ReturnValueDataLength ?? function.ReturnValue.DefaultDataLength;
            function.ReturnValue.Dimensions = ReturnValueDimensions;

            function.Event = EventPublisherSubscriber.Subscriber;
            function.EventPublisherObject.Type = EventPublisherObjectType;
            function.EventPublisherObject.ID   = EventPublisherObjectID;
            function.EventPublisherElement     = EventPublisherElement;
            function.EventFunction             = EventFunction;
            function.OnMissingLicense          = OnMissingLicense;
            function.OnMissingPermission       = OnMissingPermission;

            if (SubObjects != null)
            {
                var subObjects = SubObjects
                                 .Invoke()
                                 .Select(o => o.BaseObject);

                function.Variables.AddRange(subObjects.OfType <Variable>());
                function.Parameters.AddRange(subObjects.OfType <Parameter>());
                function.CodeLines.AddRange(subObjects.OfType <string>());
            }

            yield return(function);
        }
示例#7
0
        protected override IEnumerable <Function> CreateItems()
        {
            var function = new Function(ID, Name);

            function.Local = Local;
#if NAV2018
            function.FunctionVisibility = FunctionVisibility;
            function.ServiceEnabled     = NullableBooleanFromSwitch(nameof(ServiceEnabled));
#endif

#if NAV2016
            function.TryFunction = NullableBooleanFromSwitch(nameof(TryFunction));
#endif
            function.ReturnValue.Name       = ReturnValueName;
            function.ReturnValue.Type       = ReturnValueType;
            function.ReturnValue.DataLength = ReturnValueDataLength ?? function.ReturnValue.DefaultDataLength;
            function.ReturnValue.Dimensions = ReturnValueDimensions;

            function.Event         = EventPublisherSubscriber.Publisher;
            function.EventType     = EventType.Business;
            function.IncludeSender = NullableBooleanFromSwitch(nameof(IncludeSender));

            if (SubObjects != null)
            {
                var subObjects = SubObjects
                                 .Invoke()
                                 .Select(o => o.BaseObject);

                function.Variables.AddRange(subObjects.OfType <Variable>());
                function.Parameters.AddRange(subObjects.OfType <Parameter>());
                function.CodeLines.AddRange(subObjects.OfType <string>());
            }

            yield return(function);
        }
示例#8
0
        protected override IEnumerable <PageControlBase> CreateItems()
        {
            var containerPageControl = new PageControlContainer(ID, 0, ContainerType.GetValueOrDefault(PageControlContainerType.ContentArea));

            containerPageControl.Properties.CaptionML.Set(CaptionML);
            containerPageControl.Properties.Description = Description;
            containerPageControl.Properties.Name        = Name;
            containerPageControl.AutoCaption(AutoCaption);
            yield return(containerPageControl);

            var variables = new List <PSVariable>()
            {
                new PSVariable("ControlIndentation", 1)
            };
            var subObjects = SubObjects?
                             .InvokeWithContext(null, variables)
                             .Select(o => o.BaseObject)
                             .Cast <PageControlBase>()
                             ?? Enumerable.Empty <PageControlBase>();

            foreach (var childControl in subObjects)
            {
                yield return(childControl);
            }
        }
示例#9
0
        void IGameViewModel.LoadScene(Game game)
        {
            var scene = new Scene();

            _modelEntity = game.ContentManager.Load <Model>(File.FilePath, uploadBatch: null).CreateEntity();
            scene.Entities.Add(_modelEntity);

            //var enclosingBoundingBox = _modelEntity.GetEnclosingBoundingBox();

            //cameraEntity.Components.Add(new ArcballCameraController(
            //    enclosingBoundingBox.GetCenter(),
            //    Vector3.Distance(enclosingBoundingBox.Min, enclosingBoundingBox.Max) / 1.5f));

            game.Scene = scene;

            _animations = new List <AnimationComponent>();
            _animations.AddRange(_modelEntity.Components.OfType <AnimationComponent>());

            // If this is a skin file, load "external" animations.
            _externalAnimations = new List <AnimationComponent>();
            if (_w3dFile.HLod != null && _w3dFile.HLod.Header.Name.EndsWith("_SKN", System.StringComparison.OrdinalIgnoreCase))
            {
                var namePrefix   = _w3dFile.HLod.Header.Name.Substring(0, _w3dFile.HLod.Header.Name.LastIndexOf('_') + 1);
                var parentFolder = Path.GetDirectoryName(_w3dFile.FilePath);
                var pathPrefix   = Path.Combine(parentFolder, namePrefix);
                foreach (var animationFileEntry in File.FileSystem.GetFiles(parentFolder))
                {
                    if (!animationFileEntry.FilePath.StartsWith(pathPrefix, System.StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }

                    var animationModel = game.ContentManager.Load <Model>(animationFileEntry.FilePath, uploadBatch: null);
                    foreach (var animation in animationModel.Animations)
                    {
                        var externalAnimationComponent = new AnimationComponent
                        {
                            Animation = animation
                        };
                        _modelEntity.Components.Add(externalAnimationComponent);
                        _externalAnimations.Add(externalAnimationComponent);
                    }
                }
            }

            SubObjects.Add(new ModelViewModel());

            foreach (var animation in _animations)
            {
                SubObjects.Add(new AnimationViewModel(animation, "Animations"));
            }

            foreach (var animation in _externalAnimations)
            {
                SubObjects.Add(new AnimationViewModel(animation, "External Animations"));
            }

            SelectedSubObject = SubObjects[0];
        }
示例#10
0
        protected override IEnumerable <PageControlBase> CreateItems()
        {
            var partPageControl = new PageControlPart(ID, GetIndentation());

#if NAV2015
            partPageControl.Properties.AccessByPermission.Set(AccessByPermission);
#endif
#if NAV2017
            partPageControl.Properties.ApplicationArea.Set(ApplicationArea);
#endif
            partPageControl.Properties.CaptionML.Set(CaptionML);
            partPageControl.Properties.Description = Description;
            partPageControl.Properties.Editable    = Editable;
            partPageControl.Properties.Enabled     = Enabled;
#if NAV2018
            partPageControl.Properties.EntityName    = EntityName;
            partPageControl.Properties.EntitySetName = EntitySetName;
#endif
            partPageControl.Properties.Name     = Name;
            partPageControl.Properties.PartType = PartType;

            if (ChartPartID != null)
            {
                partPageControl.Properties.PartType    = PageControlPartType.Chart;
                partPageControl.Properties.ChartPartID = ChartPartID;
            }
            else if (PagePartID != null)
            {
                // If PartType has been assigned a value explicitly, overwrite that value with
                // "Page". If previously, PartType was null, leave the value as is.
                if (partPageControl.Properties.PartType.HasValue)
                {
                    partPageControl.Properties.PartType = PageControlPartType.Page;
                }
                partPageControl.Properties.PagePartID = PagePartID;
            }
            else if (SystemPartID != null)
            {
                partPageControl.Properties.PartType     = PageControlPartType.System;
                partPageControl.Properties.SystemPartID = SystemPartID;
            }

            partPageControl.Properties.ProviderID        = ProviderID;
            partPageControl.Properties.ShowFilter        = NullableBooleanFromSwitch(nameof(ShowFilter));
            partPageControl.Properties.SubPageView.Key   = SubPageViewKey;
            partPageControl.Properties.SubPageView.Order = SubPageViewOrder;
            partPageControl.Properties.ToolTipML.Set(ToolTipML);
#if NAV2015
            partPageControl.Properties.UpdatePropagation = UpdatePropagation;
#endif
            partPageControl.Properties.Visible = Visible;
            partPageControl.AutoCaption(AutoCaption);

            var subObjects = SubObjects?.Invoke().Select(o => o.BaseObject) ?? Enumerable.Empty <object>();
            partPageControl.Properties.SubPageLink.AddRange(subObjects.OfType <RunObjectLinkLine>());
            partPageControl.Properties.SubPageView.TableFilter.AddRange(subObjects.OfType <TableFilterLine>());

            yield return(partPageControl);
        }
示例#11
0
        protected override IEnumerable <Table> CreateItems()
        {
            var table = new Table(ID, Name);

            SetObjectProperties(table);

            table.Properties.CaptionML.Set(CaptionML);
            table.Properties.DataCaptionFields.AddRange(DataCaptionFields ?? new string[] { });
#if NAV2018
            table.Properties.DataClassification = DataClassification;
#endif
            table.Properties.DataPerCompany  = NullableBooleanFromSwitch(nameof(DataPerCompany));
            table.Properties.Description     = Description;
            table.Properties.DrillDownPageID = DrillDownPageID;
#if NAV2016
            table.Properties.ExternalName   = ExternalName;
            table.Properties.ExternalSchema = ExternalSchema;
#endif
            table.Properties.LinkedInTransaction = NullableBooleanFromSwitch(nameof(LinkedInTransaction));
            table.Properties.LinkedObject        = NullableBooleanFromSwitch(nameof(LinkedObject));
            table.Properties.LookupPageID        = LookupPageID;
#if NAV2018
            table.Properties.ObsoleteState  = ObsoleteState;
            table.Properties.ObsoleteReason = ObsoleteReason;
#endif
            table.Properties.OnInsert.Set(OnInsert);
            table.Properties.OnModify.Set(OnModify);
            table.Properties.OnDelete.Set(OnDelete);
            table.Properties.OnRename.Set(OnRename);
            table.Properties.PasteIsValid = NullableBooleanFromSwitch(nameof(PasteIsValid));
            table.Properties.Permissions.Set(Permissions);
#if NAVBC
            table.Properties.ReplicateData = NullableBooleanFromSwitch(nameof(ReplicateData));
#endif
#if NAV2016
            table.Properties.TableType = TableType;
#endif

            if (AutoCaption)
            {
                table.AutoCaption();
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                table.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                table.Fields.AddRange(subObjects.OfType <TableField>());
                table.FieldGroups.AddRange(subObjects.OfType <TableFieldGroup>());
                table.Keys.AddRange(subObjects.OfType <TableKey>());
                table.Code.Functions.AddRange(subObjects.OfType <Function>());
                table.Code.Variables.AddRange(subObjects.OfType <Variable>());
                table.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(table);
        }
示例#12
0
        protected override IEnumerable <Report> CreateItems()
        {
            var report = new Report(ID, Name);

            SetObjectProperties(report);

            report.Properties.CaptionML.Set(CaptionML);
#if NAV2015
            report.Properties.DefaultLayout = DefaultLayout;
#endif
            report.Properties.Description = Description;
            report.Properties.EnableExternalAssemblies = NullableBooleanFromSwitch(nameof(EnableExternalAssemblies));
            report.Properties.EnableExternalImages     = NullableBooleanFromSwitch(nameof(EnableExternalImages));
            report.Properties.EnableHyperlinks         = NullableBooleanFromSwitch(nameof(EnableHyperlinks));
            report.Properties.OnInitReport.Set(OnInitReport);
            report.Properties.OnPreReport.Set(OnPreReport);
            report.Properties.OnPostReport.Set(OnPostReport);
            report.Properties.PaperSourceDefaultPage = PaperSourceDefaultPage;
            report.Properties.PaperSourceFirstPage   = PaperSourceFirstPage;
            report.Properties.PaperSourceLastPage    = PaperSourceLastPage;
            report.Properties.Permissions.Set(Permissions);
#if NAV2015
            report.Properties.PreviewMode = PreviewMode;
#endif
            report.Properties.ProcessingOnly   = NullableBooleanFromSwitch(nameof(ProcessingOnly));
            report.Properties.ShowPrintStatus  = NullableBooleanFromSwitch(nameof(ShowPrintStatus));
            report.Properties.TransactionType  = TransactionType;
            report.Properties.UseRequestPage   = NullableBooleanFromSwitch(nameof(UseRequestPage));
            report.Properties.UseSystemPrinter = NullableBooleanFromSwitch(nameof(UseSystemPrinter));
#if NAV2015
            report.Properties.WordMergeDataItem = WordMergeDataItem;
#endif

            report.RdlData.CodeLines.Set(RdlData?.BaseObject);
#if NAV2015
            report.WordLayout.CodeLines.Set(WordLayout?.BaseObject);
#endif

            ProcessRequestPage(report);

            if (AutoCaption)
            {
                report.AutoCaption();
            }

            var subObjects = SubObjects?.Invoke().Select(o => o.BaseObject) ?? Enumerable.Empty <object>();
            report.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
            report.Labels.AddRange(subObjects.OfType <ReportLabel>());
            report.Elements.AddRange(subObjects.OfType <ReportElement>());
            report.Code.Functions.AddRange(subObjects.OfType <Function>());
            report.Code.Variables.AddRange(subObjects.OfType <Variable>());
            report.Code.Events.AddRange(subObjects.OfType <Event>());

            yield return(report);
        }
        protected override IEnumerable <XmlPort> CreateItems()
        {
            var xmlPort = new XmlPort(ID, Name);

            SetObjectProperties(xmlPort);

            xmlPort.Properties.CaptionML.Set(CaptionML);
            xmlPort.Properties.DefaultFieldsValidation = NullableBooleanFromSwitch(nameof(DefaultFieldsValidation));
            xmlPort.Properties.DefaultNamespace        = DefaultNamespace;
            xmlPort.Properties.Direction      = Direction;
            xmlPort.Properties.Encoding       = Encoding;
            xmlPort.Properties.FieldDelimiter = FieldDelimiter;
            xmlPort.Properties.FieldSeparator = FieldSeparator;
            xmlPort.Properties.FileName       = FileName;
            xmlPort.Properties.Format         = Format;
            xmlPort.Properties.FormatEvaluate = FormatEvaluate;
            xmlPort.Properties.InlineSchema   = NullableBooleanFromSwitch(nameof(InlineSchema));
#if NAV2016
            xmlPort.Properties.Namespaces.Set(Namespaces);
#endif
            xmlPort.Properties.OnInitXMLport.Set(OnInitXmlPort);
            xmlPort.Properties.OnPreXMLport.Set(OnPreXmlPort);
            xmlPort.Properties.OnPostXMLport.Set(OnPostXmlPort);
            xmlPort.Properties.Permissions.Set(Permissions);
            xmlPort.Properties.PreserveWhiteSpace  = NullableBooleanFromSwitch(nameof(PreserveWhitespace));
            xmlPort.Properties.RecordSeparator     = RecordSeparator;
            xmlPort.Properties.TableSeparator      = TableSeparator;
            xmlPort.Properties.TextEncoding        = TextEncoding;
            xmlPort.Properties.TransactionType     = TransactionType;
            xmlPort.Properties.UseDefaultNamespace = NullableBooleanFromSwitch(nameof(UseDefaultNamespace));
            xmlPort.Properties.UseLax         = NullableBooleanFromSwitch(nameof(UseLax));
            xmlPort.Properties.UseRequestPage = NullableBooleanFromSwitch(nameof(UseRequestPage));
            xmlPort.Properties.XmlVersionNo   = XmlVersionNo;

            ProcessRequestPage(xmlPort);

            if (AutoCaption)
            {
                xmlPort.AutoCaption();
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                xmlPort.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                xmlPort.Nodes.AddRange(subObjects.OfType <XmlPortNode>());
                xmlPort.Code.Functions.AddRange(subObjects.OfType <Function>());
                xmlPort.Code.Variables.AddRange(subObjects.OfType <Variable>());
                xmlPort.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(xmlPort);
        }
示例#14
0
 public void Serialize(BinaryWriter writer)
 {
     Header.Serialize(writer);
     Vertices.ForEach(vertex => vertex.Serialize(writer));
     Normals.ForEach(normal => normal.Serialize(writer));
     Faces.ForEach(face => face.Serialize(writer));
     SubObjects.ForEach(subObject => subObject.Serialize(writer));
     PartAnimations?.ForEach(partAnimation => partAnimation.Serialize(writer));
     CollisionPlaneVectors.ForEach(plane => plane.Serialize(writer));
     CollisionVolumes.ForEach(volume => volume.Serialize(writer));
     Materials.ForEach(material => material.Serialize(writer));
 }
示例#15
0
        public virtual void Erase()
        {
            Transaction trans = _database.TransactionManager.TopTransaction;
            Entity      ent   = (Entity)trans.GetObject(this.BaseObject, OpenMode.ForWrite);

            ent.Erase();

            foreach (DrawingObject drawingObject in SubObjects.Values)
            {
                drawingObject.Erase();
            }
            SubObjects.Clear();
        }
示例#16
0
        public IniFileContentViewModel(FileSystemEntry file)
            : base(file)
        {
            _iniDataContext = new IniDataContext(file.FileSystem);
            _iniDataContext.LoadIniFile(file);

            foreach (var objectDefinition in _iniDataContext.Objects)
            {
                SubObjects.Add(new ObjectDefinitionIniEntryViewModel(objectDefinition));
            }

            foreach (var particleSystem in _iniDataContext.ParticleSystems)
            {
                SubObjects.Add(new ParticleSystemIniEntryViewModel(particleSystem));
            }
        }
示例#17
0
        private int CalculateLength()
        {
            using (MemoryStream buffer = new MemoryStream())
                using (BinaryWriter writer = new BinaryWriter(buffer))
                {
                    Vertices.ForEach(vertex => vertex.Serialize(writer));
                    Normals.ForEach(normal => normal.Serialize(writer));
                    Faces.ForEach(face => face.Serialize(writer));
                    SubObjects.ForEach(subObject => subObject.Serialize(writer));
                    CollisionPlaneVectors.ForEach(collisionPlane => collisionPlane.Serialize(writer));
                    CollisionVolumes.ForEach(collisionVolume => collisionVolume.Serialize(writer));
                    Materials.ForEach(material => material.Serialize(writer));

                    return((int)buffer.Length);
                }
        }
示例#18
0
        protected override IEnumerable <MenuSuite> CreateItems()
        {
            var menusuite = new MenuSuite(ID, Name);

            SetObjectProperties(menusuite);

            menusuite
            .Nodes
            .AddRange(
                SubObjects?
                .Invoke()
                .Select(o => o.BaseObject)
                .Cast <MenuSuiteNode>() ?? Enumerable.Empty <MenuSuiteNode>()
                );

            yield return(menusuite);
        }
        protected override IEnumerable <TableRelationLine> CreateItems()
        {
            var result = new TableRelationLine(TableName)
            {
                FieldName = FieldName
            };

            var subObjects =
                SubObjects?
                .Invoke()
                .Select(o => o.BaseObject)
                ?? Enumerable.Empty <object>();

            result.Conditions.AddRange(subObjects.OfType <TableRelationCondition>());
            result.TableFilter.AddRange(subObjects.OfType <TableRelationTableFilterLine>());

            yield return(result);
        }
示例#20
0
        /// <summary>
        /// When null is given, the default SubObject
        /// </summary>
        /// <param name="mat"></param>
        /// <returns></returns>
        public SubObject GetOrCreateSubObject(OBJMaterial mat)
        {
            if (mat == null)
            {
                return(DefaultSubObject);
            }
            for (int i = 0; i < SubObjects.Count; i++)
            {
                if (SubObjects[i].Material == mat)
                {
                    return(SubObjects[i]);
                }
            }

            SubObject obj = new SubObject();

            SubObjects.Add(obj);

            obj.Material = mat;

            return(obj);
        }
        protected override IEnumerable <Codeunit> CreateItems()
        {
            var codeunit = new Codeunit(ID, Name);

            SetObjectProperties(codeunit);

#if !NAV2016
            codeunit.Properties.CFRONTMayUsePermissions = NullableBooleanFromSwitch(nameof(CFrontMayUsePermissions));
#endif
#if NAV2016
            codeunit.Properties.EventSubscriberInstance = EventSubscriberInstance;
#endif
            codeunit.Properties.Permissions.Set(Permissions);
            codeunit.Properties.SingleInstance = NullableBooleanFromSwitch(nameof(SingleInstance));
            codeunit.Properties.Subtype        = SubType;
            codeunit.Properties.TableNo        = TableNo;
            codeunit.Properties.TestIsolation  = TestIsolation;
#if NAV2017
            codeunit.Properties.TestPermissions = TestPermissions;
#endif

            if (OnRun != null)
            {
                var subObjects = OnRun.Invoke().Select(o => o.BaseObject);
                codeunit.Properties.OnRun.CodeLines.AddRange(subObjects.OfType <string>());
                codeunit.Properties.OnRun.Variables.AddRange(subObjects.OfType <Variable>());
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                codeunit.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                codeunit.Code.Functions.AddRange(subObjects.OfType <Function>());
                codeunit.Code.Variables.AddRange(subObjects.OfType <Variable>());
                codeunit.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(codeunit);
        }
示例#22
0
        protected override IEnumerable <Function> CreateItems()
        {
            var function = new Function(ID, Name);

            function.Local = Local;
#if NAV2018
            function.FunctionVisibility = FunctionVisibility;
            function.ServiceEnabled     = NullableBooleanFromSwitch(nameof(ServiceEnabled));
#endif

#if NAV2016
            function.TryFunction = NullableBooleanFromSwitch(nameof(TryFunction));
#endif
            function.ReturnValue.Name       = ReturnValueName;
            function.ReturnValue.Type       = ReturnValueType;
            function.ReturnValue.DataLength = ReturnValueDataLength ?? function.ReturnValue.DefaultDataLength;
            function.ReturnValue.Dimensions = ReturnValueDimensions;

            function.HandlerFunctions = HandlerFunctions;
            function.TestFunctionType = TestFunctionType;
            function.TransactionModel = TransactionModel;
#if NAV2017
            function.TestPermissions = TestPermissions;
#endif

            if (SubObjects != null)
            {
                var subObjects = SubObjects
                                 .Invoke()
                                 .Select(o => o.BaseObject);

                function.Variables.AddRange(subObjects.OfType <Variable>());
                function.Parameters.AddRange(subObjects.OfType <Parameter>());
                function.CodeLines.AddRange(subObjects.OfType <string>());
            }

            yield return(function);
        }
示例#23
0
        public override void BeforeEdit()
        {
            SubObjects.Clear();
            try
            {
                if (Value != null && Value.Contains($"\"Type\":\"{nameof(MenuItem)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <MenuItem>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(ModelSetting)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <ModelSetting>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(DisplaySetting)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <DisplaySetting>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(DataGridSetting)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <DataGridSetting>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(DataGridHandlerSetting)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <DataGridHandlerSetting>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(DialogOptions)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <DialogOptions>(Value));
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"Error in {System.Reflection.MethodBase.GetCurrentMethod().Name}: {ex.Message}");
            }

            base.BeforeEdit();
        }
示例#24
0
        protected override IEnumerable <ReportElement> CreateItems()
        {
            var element = new DataItemReportElement(DataItemTable, ID, IndentationLevel);

            element.Name = Name;

            element.Properties.CalcFields.AddRange(CalcFields);
            element.Properties.DataItemLinkReference   = DataItemLinkReference;
            element.Properties.DataItemTableView.Key   = DataItemTableViewKey;
            element.Properties.DataItemTableView.Order = DataItemTableViewOrder;
            element.Properties.MaxIteration            = MaxIteration;
            element.Properties.OnPreDataItem.Set(OnPreDataItem);
            element.Properties.OnAfterGetRecord.Set(OnAfterGetRecord);
            element.Properties.OnPostDataItem.Set(OnPostDataItem);
            element.Properties.PrintOnlyIfDetail = NullableBooleanFromSwitch(nameof(PrintOnlyIfDetail));
            element.Properties.ReqFilterFields.AddRange(ReqFilterFields);
            element.Properties.ReqFilterHeadingML.Set(ReqFilterHeadingML);
#if NAV2015
            element.Properties.Temporary = NullableBooleanFromSwitch(nameof(Temporary));
#endif

            yield return(element);

            var variables = new List <PSVariable>()
            {
                new PSVariable("ElementIndentation", element.IndentationLevel + 1)
            };
            var subObjects = SubObjects?.InvokeWithContext(null, variables).Select(o => o.BaseObject) ?? Enumerable.Empty <object>();

            element.Properties.DataItemLink.AddRange(subObjects.OfType <ReportDataItemLinkLine>());
            element.Properties.DataItemTableView.TableFilter.AddRange(subObjects.OfType <TableFilterLine>());

            foreach (var subObject in subObjects.OfType <ReportElement>())
            {
                yield return(subObject);
            }
        }
示例#25
0
 public T[] GetGameObjects <T>() where T : GameObject
 {
     return(ElementAcquisitor.GetElements <T>(SubObjects.ToArray()));
 }
示例#26
0
        protected override IEnumerable <Page> CreateItems()
        {
            var page = new Page(ID, Name);

            SetObjectProperties(page);

            page.Properties.AutoSplitKey = NullableBooleanFromSwitch(nameof(AutoSplitKey));
            page.Properties.CaptionML.Set(CaptionML);
            page.Properties.CardPageID      = CardPageID;
            page.Properties.DataCaptionExpr = DataCaptionExpr;
            page.Properties.DataCaptionFields.AddRange(DataCaptionFields ?? new string[] { });
            page.Properties.DelayedInsert = NullableBooleanFromSwitch(nameof(DelayedInsert));
            page.Properties.DeleteAllowed = NullableBooleanFromSwitch(nameof(DeleteAllowed));
            page.Properties.Description   = Description;
            page.Properties.Editable      = NullableBooleanFromSwitch(nameof(Editable));
            page.Properties.InsertAllowed = NullableBooleanFromSwitch(nameof(InsertAllowed));
            page.Properties.InstructionalTextML.Set(InstructionalTextML);
            page.Properties.LinksAllowed     = NullableBooleanFromSwitch(nameof(LinksAllowed));
            page.Properties.ModifyAllowed    = NullableBooleanFromSwitch(nameof(ModifyAllowed));
            page.Properties.MultipleNewLines = NullableBooleanFromSwitch(nameof(MultipleNewLines));
            page.Properties.OnAfterGetCurrRecord.Set(OnAfterGetCurrRecord);
            page.Properties.OnAfterGetRecord.Set(OnAfterGetRecord);
            page.Properties.OnClosePage.Set(OnClosePage);
            page.Properties.OnDeleteRecord.Set(OnDeleteRecord);
            page.Properties.OnFindRecord.Set(OnFindRecord);
            page.Properties.OnInit.Set(OnInit);
            page.Properties.OnInsertRecord.Set(OnInsertRecord);
            page.Properties.OnModifyRecord.Set(OnModifyRecord);
            page.Properties.OnNewRecord.Set(OnNewRecord);
            page.Properties.OnNextRecord.Set(OnNextRecord);
            page.Properties.OnOpenPage.Set(OnOpenPage);
            page.Properties.OnQueryClosePage.Set(OnQueryClosePage);
            page.Properties.PageType = PageType;
            page.Properties.Permissions.Set(Permissions);
            page.Properties.PopulateAllFields = NullableBooleanFromSwitch(nameof(PopulateAllFields));
            page.Properties.PromotedActionCategoriesML.Set(PromotedActionCategoriesML);
            page.Properties.RefreshOnActivate     = NullableBooleanFromSwitch(nameof(RefreshOnActivate));
            page.Properties.SaveValues            = NullableBooleanFromSwitch(nameof(SaveValues));
            page.Properties.ShowFilter            = NullableBooleanFromSwitch(nameof(ShowFilter));
            page.Properties.SourceTable           = SourceTable;
            page.Properties.SourceTableTemporary  = NullableBooleanFromSwitch(nameof(SourceTableTemporary));
            page.Properties.SourceTableView.Key   = SourceTableViewKey;
            page.Properties.SourceTableView.Order = SourceTableViewOrder;

            if (AutoCaption)
            {
                page.AutoCaption();
            }

            if (SubObjects != null)
            {
                var subObjects = SubObjects.Invoke().Select(o => o.BaseObject);
                page.Controls.AddRange(subObjects.OfType <PageControlBase>());
                page.Properties.ActionList.AddRange(subObjects.OfType <PageActionBase>());
                page.Properties.SourceTableView.TableFilter.AddRange(subObjects.OfType <TableFilterLine>());
                page.Code.Documentation.CodeLines.AddRange(subObjects.OfType <string>());
                page.Code.Functions.AddRange(subObjects.OfType <Function>());
                page.Code.Variables.AddRange(subObjects.OfType <Variable>());
                page.Code.Events.AddRange(subObjects.OfType <Event>());
            }

            yield return(page);
        }