コード例 #1
0
ファイル: Program.cs プロジェクト: w01f/VolgaTeam.Dashboard
		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;
				}
		}
コード例 #2
0
        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;
                }
            }
        }