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); }
public static IEnumerable <ParameterBase> ToParameters(this PageControlPart pageControlPart) { yield return(new SimpleParameter("ID", pageControlPart.ID)); yield return(new ScriptBlockParameter("SubObjects", pageControlPart.Properties.SubPageLink.ToInvocations() .Concat(pageControlPart.Properties.SubPageView.TableFilter.ToInvocations()))); foreach (var parameter in pageControlPart.AllProperties.WithAValue.SelectMany(p => p.ToParameters())) { yield return(parameter); } }
public static void Write(this PageControlPart partPageControl, CSideWriter writer, int propertyIndentation) { var debt = 0; var controlID = BuildControlPart(partPageControl.ID.ToString(), 4, ref debt); var controlIndentation = BuildControlPart(partPageControl.IndentationLevel.AsString(), 4, ref debt); var controlType = BuildControlPart("Part", 10, ref debt); var declaration = string.Format("{{ {0};{1};{2};", controlID, controlIndentation, controlType); writer.WriteLine(declaration); //var idLength = Math.Max(partPageControl.ID.ToString().Length, 4); //var id = partPageControl.ID.ToString().PadRight(idLength); //var idAndIndentation = string.Format("{0};{1}", id, partPageControl.IndentationLevel.ToString()); //var idAndIndentationAndType = string.Format("{{ {0};Part", idAndIndentation.PadRight(9)); //writer.WriteLine("{0};", idAndIndentationAndType.PadRight(22)); writer.Indent(propertyIndentation); partPageControl.Properties.Write(PropertiesStyle.Field, writer); writer.WriteLine("}"); writer.Unindent(); writer.InnerWriter.WriteLine(); }