public XElement ToXml(IToXmlContext ctx) { return(new XElement("CombinedUserChartPart", new XAttribute("ShowData", ShowData), new XAttribute("AllowChangeShowData", AllowChangeShowData), new XAttribute("CombinePinnedFiltersWithSameLabel", CombinePinnedFiltersWithSameLabel), new XAttribute("UseSameScale", UseSameScale), UserCharts.Select(uc => new XElement("UserChart", new XAttribute("Guid", ctx.Include(uc)))))); }
public void FromXml(XElement element, IFromXmlContext ctx) { var newUserCharts = element.Elements("UserChart").Select(uc => (UserChartEntity)ctx.GetEntity(Guid.Parse(uc.Attribute("Guid") !.Value))).ToList(); ShowData = element.Attribute("ShowData")?.Value.ToBool() ?? false; AllowChangeShowData = element.Attribute("AllowChangeShowData")?.Value.ToBool() ?? false; CombinePinnedFiltersWithSameLabel = element.Attribute("CombinePinnedFiltersWithSameLabel")?.Value.ToBool() ?? false; UseSameScale = element.Attribute("UseSameScale")?.Value.ToBool() ?? false; UserCharts.Synchronize(newUserCharts); }
public void FromXml(XElement element, IFromXmlContext ctx) { ShowData = element.Attribute(nameof(ShowData))?.Value.ToBool() ?? false; AllowChangeShowData = element.Attribute(nameof(AllowChangeShowData))?.Value.ToBool() ?? false; CombinePinnedFiltersWithSameLabel = element.Attribute(nameof(CombinePinnedFiltersWithSameLabel))?.Value.ToBool() ?? false; UseSameScale = element.Attribute(nameof(UseSameScale))?.Value.ToBool() ?? false; UserCharts.Synchronize(element.Elements("UserChart").ToList(), (cuce, elem) => { cuce.UserChart = (UserChartEntity)ctx.GetEntity(Guid.Parse(elem.Attribute("Guid") !.Value)); cuce.IsQueryCached = elem.Attribute(nameof(cuce.IsQueryCached))?.Value.ToBool() ?? false; });
public XElement ToXml(IToXmlContext ctx) { return(new XElement("CombinedUserChartPart", ShowData ? new XAttribute(nameof(ShowData), ShowData) : null, AllowChangeShowData ? new XAttribute(nameof(AllowChangeShowData), AllowChangeShowData) : null, CombinePinnedFiltersWithSameLabel ? new XAttribute(nameof(CombinePinnedFiltersWithSameLabel), CombinePinnedFiltersWithSameLabel) : null, UseSameScale ? new XAttribute(nameof(UseSameScale), UseSameScale) : null, UserCharts.Select(uc => new XElement("UserChart", new XAttribute("Guid", ctx.Include(uc.UserChart)), uc.IsQueryCached ? new XAttribute(nameof(uc.IsQueryCached), uc.IsQueryCached) : null)) )); }
public override string ToString() { return(UserCharts.ToString(", ")); }