public void Deserialize(XmlNode node) { foreach (XmlNode childNode in node.ChildNodes) { switch (childNode.Name) { case "Enabled": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { Enabled = temp; } break; } case "Name": Name = childNode.InnerText; break; case "Station": Station = childNode.InnerText; break; case "Description": Description = childNode.InnerText; break; case "Order": { decimal temp; if (Decimal.TryParse(childNode.InnerText, out temp)) { Order = temp; } break; } case "Logo": _logo.Deserialize(childNode); break; } } }
public void Deserialize(XmlNode node) { foreach (XmlNode childNode in node.ChildNodes) { switch (childNode.Name) { case "UniqueID": { Guid temp; if (Guid.TryParse(childNode.InnerText, out temp)) { UniqueID = temp; } } break; case "Name": Name = childNode.InnerText; break; case "Station": Station = childNode.InnerText; break; case "Logo": Logo = new ImageSource(); Logo.Deserialize(childNode); break; case "Day": Day = childNode.InnerText; break; case "Length": Length = childNode.InnerText; break; case "Time": Time = childNode.InnerText; break; case "Rate": { decimal temp; if (Decimal.TryParse(childNode.InnerText, out temp)) { Rate = temp; } } break; case "Spot": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { Spot = temp; } } break; } } }
public void Deserialize(XmlNode node) { bool tempBool; foreach (XmlNode childNode in node.ChildNodes) { switch (childNode.Name) { case "UniqueID": { Guid temp; if (Guid.TryParse(childNode.InnerText, out temp)) { UniqueID = temp; } } break; case "Index": { double temp; if (Double.TryParse(childNode.InnerText, out temp)) { Index = temp; } } break; case "Name": Name = childNode.InnerText; break; case "Logo": Logo = new ImageSource(); Logo.Deserialize(childNode); break; case "Comment": Comment = childNode.InnerText; break; case "TotalWeeks": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { TotalWeeks = temp; } } break; case "ShowLineId": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowLineId = tempBool; } break; case "ShowLogo": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowLogo = tempBool; } break; case "ShowStation": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowStation = tempBool; } break; case "ShowProgram": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowProgram = tempBool; } break; case "ShowDaypart": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowDaypart = tempBool; } break; case "ShowLenght": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowLenght = tempBool; } break; case "ShowTime": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowTime = tempBool; } break; case "ShowRate": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowRate = tempBool; } break; case "ShowCost": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowCost = tempBool; } break; case "ShowTotalSpots": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowTotalSpots = tempBool; } break; case "ShowAverageRate": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowAverageRate = tempBool; } break; case "ShowSpotsX": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowSpotsX = tempBool; } break; case "ShowTotalRow": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowTotalRow = tempBool; } break; case "UseDecimalRates": if (bool.TryParse(childNode.InnerText, out tempBool)) { UseDecimalRates = tempBool; } break; case "ShowSpotsPerWeek": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowSpotsPerWeek = tempBool; } break; case "Programs": foreach (XmlNode programNode in childNode.ChildNodes) { var program = new SnapshotProgram(); program.Deserialize(programNode); Programs.Add(program); } break; case "ActiveWeeks": foreach (XmlNode dataRangeNode in childNode.ChildNodes) { var dateRange = new DateRange(); dateRange.Deserialize(dataRangeNode); ActiveWeeks.Add(dateRange); } break; case "ContractSettings": ContractSettings.Deserialize(childNode); break; } } }
public void Deserialize(XmlNode node) { foreach (XmlNode childNode in node.ChildNodes) { switch (childNode.Name) { case "UniqueID": { Guid temp; if (Guid.TryParse(childNode.InnerText, out temp)) { UniqueID = temp; } } break; case "Index": { double temp; if (Double.TryParse(childNode.InnerText, out temp)) { Index = temp; } } break; case "Name": Name = childNode.InnerText; break; case "Logo": Logo = new ImageSource(); Logo.Deserialize(childNode); break; case "Comment": Comment = childNode.InnerText; break; case "TotalPeriods": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { TotalPeriods = temp; } } break; case "ShowLineId": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowLineId = temp; } } break; case "ShowLogo": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowLogo = temp; } } break; case "ShowStation": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowStation = temp; } } break; case "ShowProgram": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowProgram = temp; } } break; case "ShowDay": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowDay = temp; } } break; case "ShowLenght": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowLenght = temp; } } break; case "ShowTime": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowTime = temp; } } break; case "ShowRate": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowRate = temp; } } break; case "ShowSpots": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowSpots = temp; } } break; case "ShowCost": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowCost = temp; } } break; case "ShowTotalSpots": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowTotalSpots = temp; } } break; case "ShowTotalCost": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowTotalCost = temp; } } break; case "ShowAverageRate": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowAverageRate = temp; } } break; case "ShowSpotsX": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { ShowSpotsX = temp; } } break; case "UseDecimalRates": { bool temp; if (Boolean.TryParse(childNode.InnerText, out temp)) { UseDecimalRates = temp; } } break; case "PositionStation": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { PositionStation = temp; } } break; case "PositionProgram": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { PositionProgram = temp; } } break; case "PositionDay": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { PositionDay = temp; } } break; case "PositionLenght": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { PositionLenght = temp; } } break; case "PositionTime": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { PositionTime = temp; } } break; case "PositionRate": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { PositionRate = temp; } } break; case "PositionSpots": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { PositionSpots = temp; } } break; case "PositionCost": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { PositionCost = temp; } } break; case "SpotType": { int temp; if (Int32.TryParse(childNode.InnerText, out temp)) { SpotType = (SpotType)temp; } } break; case "Programs": foreach (XmlNode programNode in childNode.ChildNodes) { var program = new OptionProgram(); program.Deserialize(programNode); Programs.Add(program); } break; case "ContractSettings": ContractSettings.Deserialize(childNode); break; } } }
public void Deserialize(XmlNode node) { double tempDouble; Guid tempGuid; foreach (XmlAttribute programAttribute in node.Attributes) { switch (programAttribute.Name) { case "Name": _name = programAttribute.Value; break; case "UniqueID": if (Guid.TryParse(programAttribute.Value, out tempGuid)) { UniqueID = tempGuid; } break; case "Station": Station = programAttribute.Value; break; case "Daypart": Daypart = programAttribute.Value; break; case "Day": Day = programAttribute.Value; break; case "Time": Time = programAttribute.Value; break; case "Length": Length = programAttribute.Value; break; case "Rate": if (double.TryParse(programAttribute.Value, out tempDouble)) { Rate = tempDouble; } break; case "Rating": if (double.TryParse(programAttribute.Value, out tempDouble)) { Rating = tempDouble; } break; } } foreach (XmlNode childNode in node.ChildNodes) { switch (childNode.Name) { case "Spots": foreach (XmlNode spotNode in childNode.ChildNodes) { var spot = new Spot(this); spot.Deserialize(spotNode); Spots.Add(spot); } break; case "SummaryItem": SummaryItem.Deserialize(childNode); break; case "Logo": Logo = new ImageSource(); Logo.Deserialize(childNode); break; } } }