/// <summary> /// Returns a human-readable string representation of the tag. /// </summary> /// <returns>The tag as a string</returns> public override string ToString() { if (TagName != null) { var tagName = TagName.ToUpper(CultureInfo.InvariantCulture); return(IsInputElement ? String.Format("{0} ({1})", tagName, InputType) : tagName); } return(string.Empty); }
internal void TranslateAttributes(CssBox box) { string t = TagName.ToUpper(); foreach (string att in Attributes.Keys) { string value = Attributes[att]; switch (att) { case HtmlConstants.align: if (value == HtmlConstants.left || value == HtmlConstants.center || value == HtmlConstants.right || value == HtmlConstants.justify) { box.TextAlign = value; } else { box.VerticalAlign = value; } break; case HtmlConstants.background: box.BackgroundImage = value; break; case HtmlConstants.bgcolor: box.BackgroundColor = value; break; case HtmlConstants.border: box.BorderWidth = TranslateLength(value); if (t == HtmlConstants.TABLE) { ApplyTableBorder(box, value); } else { box.BorderStyle = CssConstants.Solid; } break; case HtmlConstants.bordercolor: box.BorderColor = value; break; case HtmlConstants.cellspacing: box.BorderSpacing = TranslateLength(value); break; case HtmlConstants.cellpadding: ApplyTablePadding(box, value); break; case HtmlConstants.color: box.Color = value; break; case HtmlConstants.dir: box.Direction = value; break; case HtmlConstants.face: box.FontFamily = value; break; case HtmlConstants.height: box.Height = TranslateLength(value); break; case HtmlConstants.hspace: box.MarginRight = box.MarginLeft = TranslateLength(value); break; case HtmlConstants.nowrap: box.WhiteSpace = CssConstants.Nowrap; break; case HtmlConstants.size: if (t == HtmlConstants.HR) { box.Height = TranslateLength(value); } break; case HtmlConstants.valign: box.VerticalAlign = value; break; case HtmlConstants.vspace: box.MarginTop = box.MarginBottom = TranslateLength(value); break; case HtmlConstants.width: box.Width = TranslateLength(value); break; } } }
private async void CreateNewTag() { if (TagName != null) { var numberOfEqualTags = Tags.Select(x => x).Where(t => t.Name.ToUpper().Equals(TagName.ToUpper())).ToArray().Count(); if (numberOfEqualTags > 0) { await m_popupDialog.Dialog.ShowMessageAsync(this, $"Kan ikke legge til {TagName}", $"{TagName} kan ikke legges til fordi det eksisterer allerede en tag med samme navn"); return; } Tags.Add(await m_foodFacade.AddTag(new Tag() { Name = TagName })); TagName = ""; OnPropertyChanged(nameof(TagName)); m_viewDisabler.Disable("Laster...", RefreshTag()); } }