// -----------------------------------------------------------------------------------------
        public void CreateDetailSubsection(ContainedDetail Detail)
        {
            var Title = (Detail is Link ? Link.__ClassDefinitor.Name : Detail.Kind.Name) + ": " + Detail.Designation.NameCaption
                        + (Detail is Table ? " [Structure: " + Detail.Designation.Definitor.Name.RemoveNewLines() + "]" : "");

            this.CreateTextLabel("detail-title", Title);

            var Representator = Detail.OwnerIdea.VisualRepresentators.FirstOrDefault();
            var Look          = (Representator != null
                        ? Detail.OwnerIdea.GetDetailLook(Detail.Designation, Representator.MainSymbol)
                        : null);

            if (Detail is Link && this.Configuration.CompositeIdea_DetailsIncludeLinksTarget &&
                !((Link)Detail).Target.ToStringAlways().IsAbsent())
            {
                this.CreateDetailContent((Link)Detail);
            }
            else
            if (Detail is Attachment && this.Configuration.CompositeIdea_DetailsIncludeAttachmentsContent &&
                ((Attachment)Detail).Content.NullDefault(new byte[0]).Length > 0)
            {
                this.CreateDetailContent((Attachment)Detail);
            }
            else
            if (Detail is Table && ((Table)Detail).Count > 0 &&
                this.Configuration.CompositeIdea_DetailsIncludeTablesData)
            {
                this.CreateDetailContent((Table)Detail, (TableAppearance)Look);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fixes individual detail-designator. Returns indication of change.
        /// </summary>
        private static bool ModelRev1_FixDetail(ContainedDetail Evaluated)
        {
            var LinkDet = Evaluated as InternalLink;

            if (LinkDet == null)
            {
                return(false);
            }

            var BoxedProp = InternalLink.__TargetProperty.GetStoreBoxContainer(LinkDet);

            if (BoxedProp == null)
            {
                return(false);
            }

            var StoredBytes = BoxedProp.GetStoredValueBytes();

            if (StoredBytes == null)
            {
                return(false);
            }

            var StoredPropName = StoredBytes.BytesToString();

            if (MModelClassDefinitor.DeclaredMemberDefinitors.ContainsKey(StoredPropName))
            {
                return(false);
            }

            foreach (var MembDef in MModelClassDefinitor.DeclaredMemberDefinitors)
            {
                if (((MembDef.Value.DeclaringDefinitor == null ? "" : MembDef.Value.DeclaringDefinitor.Name) +
                     "." + MembDef.Value.TechName) == StoredPropName)
                {
                    LinkDet.TargetProperty = MembDef.Value as MModelPropertyDefinitor;
                    return(true);
                }
            }

            return(false);
        }
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        public bool AppendPastedDetail(Idea Target, string DetailName, string MimeType, byte[] DetailContent)
        {
            if (DetailName.IsAbsent() || MimeType.IsAbsent() || DetailContent == null || DetailContent.Length < 1)
            {
                return(false);
            }

            ContainedDetail Detail = null;

            if (MimeType.StartsWith("text/"))
            {
                var Owner   = Ownership.Create <IdeaDefinition, Idea>(Target);
                var Content = DetailContent.BytesToString();
                if (Content.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase))
                {
                    var NewLink = new ResourceLink(Target, new Assignment <DetailDesignator>(
                                                       DomainServices.CreateLinkDesignation(
                                                           Owner,
                                                           DetailName),
                                                       true));
                    NewLink.TargetLocation = Content;
                    Detail = NewLink;
                }
                else
                if (MimeType.EndsWith("/tsv") || MimeType.EndsWith("/csv"))
                {
                    var Delimiter = (MimeType.EndsWith("/csv")
                                         ? General.GetCurrentTextListDelimiter()
                                         : "\t");
                    var TextRecords = General.LoadStreamDelimitedIntoStrings(Content.StringToStream(), Delimiter);

                    var TypingResult = DomainServices.GenerateTypedRecordsList(TextRecords.Item1);

                    var TableDef = DomainServices.CreateCompatibleTableDefinition(Target.OwnerComposition.CompositeContentDomain,
                                                                                  DetailName + " - TableDef",
                                                                                  TypingResult.Item2, TextRecords.Item2);
                    var Designator = new TableDetailDesignator(Owner, TableDef, true, DetailName, DetailName.TextToIdentifier());
                    var NewTable   = new Table(Target, Designator.Assign <DetailDesignator>(true));
                    foreach (var DataRecord in TypingResult.Item1)
                    {
                        NewTable.Add(new TableRecord(NewTable, DataRecord));
                    }

                    Detail = NewTable;
                }
            }

            if (Detail == null)
            {
                var Route = new Uri(DetailName, UriKind.RelativeOrAbsolute);
                Detail = this.CreateIdeaDetailAttachment(Ownership.Create <IdeaDefinition, Idea>(Target),
                                                         Target, DetailName, Route, DetailContent, MimeType);
                if (Detail == null)
                {
                    return(false);
                }
            }

            Target.Details.AddNew(Detail);

            return(true);
        }
Exemplo n.º 4
0
        // -----------------------------------------------------------------------------------------
        public void CreateDetailSubsection(ReportStandardPagesMaker PagesMaker, double LocalNestingMargin, ContainedDetail Detail)
        {
            var Result = new StackPanel();

            var TitleBorder = new Border();

            TitleBorder.Margin            = new Thickness(0, 0, 0, 0);
            TitleBorder.BorderBrush       = this.Configuration.FmtCardLinesForeground;
            TitleBorder.BorderThickness   = new Thickness(LINES_CARD_THICKNESS);
            TitleBorder.VerticalAlignment = VerticalAlignment.Stretch;
            var Title = (Detail is Link ? Link.__ClassDefinitor.Name : Detail.Kind.Name) + ": " + Detail.Designation.NameCaption
                        + (Detail is Table ? " [Structure: " + Detail.Designation.Definitor.Name.RemoveNewLines() + "]" : "");

            TitleBorder.Child = CreateText(Title,
                                           this.Configuration.FmtCardFieldLabel, HorizontalAlignment.Stretch, VerticalAlignment.Top,
                                           this.Configuration.FmtFieldLabelBackground);

            var GroupKey = "Detail_" + (new Random()).Next().ToString();

            PagesMaker.AppendContent(TitleBorder, false, GroupKey);

            FrameworkElement Content = null;
            var Representator        = Detail.OwnerIdea.VisualRepresentators.FirstOrDefault();
            var Look = (Representator != null
                        ? Detail.OwnerIdea.GetDetailLook(Detail.Designation, Representator.MainSymbol)
                        : null);

            if (Detail is Link && this.Configuration.CompositeIdea_DetailsIncludeLinksTarget &&
                !((Link)Detail).Target.ToStringAlways().IsAbsent())
            {
                Content = CreateDetailContent((Link)Detail);
            }
            else
            if (Detail is Attachment && this.Configuration.CompositeIdea_DetailsIncludeAttachmentsContent &&
                ((Attachment)Detail).Content.NullDefault(new byte[0]).Length > 0)
            {
                Content = CreateDetailContent((Attachment)Detail);
            }
            else
            if (Detail is Table && ((Table)Detail).Count > 0 &&
                this.Configuration.CompositeIdea_DetailsIncludeTablesData)
            {
                // Notice that no Content is returned (records appended to pages-maker inside)
                CreateDetailContent(PagesMaker, LocalNestingMargin, GroupKey, (Table)Detail, (TableAppearance)Look);
            }

            if (Content != null)
            {
                var Container = new Border();
                Container.BorderThickness = new Thickness(LINES_CARD_THICKNESS);
                Container.BorderBrush     = this.Configuration.FmtCardLinesForeground;
                Container.Child           = Content;

                PagesMaker.AppendContent(Container, false, GroupKey);
            }
        }
Exemplo n.º 5
0
 // ---------------------------------------------------------------------------------------------------------------------------------------------------------
 public DetailEditingCard(bool IsPreexistent, Assignment <DetailDesignator> Designator, ContainedDetail Detail)
     : base(IsPreexistent, Designator)
 {
     this.DetailContent = Detail;
 }