Ejemplo n.º 1
0
        private HtmlNode CreateLegende(HtmlDocument doc, Options options)
        {
            var res = HtmlWriterService.CreateDiv(doc, "legend");

            HtmlNode content = doc.CreateElement("table");

            foreach (var typeRelation in options.TypesRelation)
            {
                var row = doc.CreateElement("tr");

                HtmlNode colorCell = doc.CreateElement("td");
                HtmlNode color     = doc.CreateElement("div");
                color.SetAttributeValue("style", string.Format("background-color:#{0:X2}{1:X2}{2:X2};", typeRelation.LinkColor.Value.R, typeRelation.LinkColor.Value.G, typeRelation.LinkColor.Value.B));
                colorCell.AppendChild(color);
                row.AppendChild(colorCell);

                HtmlNode label = doc.CreateElement("td");
                label.AppendChild(doc.CreateTextNode(typeRelation.Nom));
                row.AppendChild(label);
                content.AppendChild(row);
            }

            res.AppendChild(content);
            return(res);
        }
Ejemplo n.º 2
0
        private HtmlNode GenerateListeRpCommuns(HtmlDocument doc, Partenaire partenaire)
        {
            var res = HtmlWriterService.CreateDiv(doc, "r-d r-r");

            foreach (var rp in partenaire.RpsCommuns)
            {
                var link = doc.CreateElement("a");
                link.SetAttributeValue("href", rp.Url);
                link.AppendChild(doc.CreateTextNode(rp.Titre));
                res.AppendChild(link);
            }

            return(res);
        }
Ejemplo n.º 3
0
        private HtmlNode GenerateRelationNode(HtmlDocument doc, Partenaire partenaire)
        {
            var res = HtmlWriterService.CreateDiv(doc, "rel", string.Format("top:{0}px;left:{1}px", partenaire.Position.Y, partenaire.Position.X));
            //var portrait = HtmlWriterService.CreateDiv(doc, "r-p");
            var frame    = HtmlWriterService.CreateDiv(doc, "r-f");
            var checkBox = doc.CreateElement("input");

            checkBox.SetAttributeValue("type", "checkbox");
            checkBox.SetAttributeValue("id", partenaire.Nom ?? string.Empty);
            frame.AppendChild(checkBox);
            if (partenaire.RpsCommuns.Any())
            {
                frame.AppendChild(GenerateListeRpCommuns(doc, partenaire));
            }
            var portrait = doc.CreateElement("label");

            portrait.AddClass("r-p");
            portrait.SetAttributeValue("for", partenaire.Nom ?? string.Empty);

            var portraitImage = doc.CreateElement("img");

            portraitImage.SetAttributeValue("src", partenaire.AvatarLink);
            portrait.AppendChild(portraitImage);

            var userName = doc.CreateElement("div");

            userName.AddClass("r-n");
            userName.AppendChild(doc.CreateTextNode(partenaire.Nom ?? string.Empty));

            frame.AppendChild(portrait);

            if (partenaire.Position.Y > PersoY)
            {
                res.AppendChild(frame);
                res.AppendChild(userName);
            }
            else
            {
                res.AppendChild(userName);
                res.AppendChild(frame);
            }
            if (!string.IsNullOrWhiteSpace(partenaire.Description))
            {
                var userDesc = HtmlWriterService.CreateDiv(doc, "r-d");
                userDesc.AppendChild(doc.CreateTextNode(partenaire.Description));
                frame.AppendChild(userDesc);
            }
            return(res);
        }