Ejemplo n.º 1
0
        public override void ReadXml(XmlReader reader)
        {
            if (!reader.ReadToDescendant("CronTabs"))
            {
                throw new XmlException("Could not find CronTabs element");
            }
            var selTabName = reader.GetAttribute("SelectedCronBuilder");

            CronTab.SelectedTab = CronTab.TabPages[selTabName];

            if (!reader.ReadToFollowing("Minutes"))
            {
                throw new XmlException("Could not find Minutes element");
            }
            MinutesValue.ReadXml(reader);

            if (!reader.ReadToFollowing("Hourly"))
            {
                throw new XmlException("Could not find Hourly element");
            }
            HourlyValue.ReadXml(reader);

            if (!reader.ReadToFollowing("Daily"))
            {
                throw new XmlException("Could not find Daily element");
            }
            DailyValue.ReadXml(reader);

            if (!reader.ReadToFollowing("Weekly"))
            {
                throw new XmlException("Could not find Weekly element");
            }
            WeeklyValue.ReadXml(reader);

            if (!reader.ReadToFollowing("Monthly"))
            {
                throw new XmlException("Could not find Monthly element");
            }
            MonthlyValue.ReadXml(reader);

            if (!reader.ReadToFollowing("Yearly"))
            {
                throw new XmlException("Could not find Yearly element");
            }
            YearlyValue.ReadXml(reader);
        }
Ejemplo n.º 2
0
        public override void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("CronTabs");
            writer.WriteAttributeString("SelectedCronBuilder", CronTab.SelectedTab.Name);

            {
                writer.WriteStartElement("Minutes");
                MinutesValue.WriteXml(writer);
                writer.WriteEndElement();
            }

            {
                writer.WriteStartElement("Hourly");
                HourlyValue.WriteXml(writer);
                writer.WriteEndElement();
            }

            {
                writer.WriteStartElement("Daily");
                DailyValue.WriteXml(writer);
                writer.WriteEndElement();
            }

            {
                writer.WriteStartElement("Weekly");
                WeeklyValue.WriteXml(writer);
                writer.WriteEndElement();
            }

            {
                writer.WriteStartElement("Monthly");
                MonthlyValue.WriteXml(writer);
                writer.WriteEndElement();
            }

            {
                writer.WriteStartElement("Yearly");
                YearlyValue.WriteXml(writer);
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReportDownloadedEventArgs"/> class.
        /// </summary>
        /// <param name="report">
        /// The report.
        /// </param>
        /// <param name="timestamp">
        /// The timestamp.
        /// </param>
        /// <param name="exception">Exception.</param>
        public ReportDownloadedEventArgs(BandwidthReport report, DateTime timestamp, Exception exception)
        {
            this.monthly = new List<MonthlyValue>();
            this.daily = new List<DailyValue>();
            this.Timestamp = timestamp;

            if (null != exception)
            {
                this.Error = exception;
                return;
            }

            report.Monthly.Each((value) =>
                {
                    var monthlyValue = new MonthlyValue(value);
                    this.monthly.Add(monthlyValue);
                });

            report.Daily.Each((value) =>
            {
                var dailyValue = new DailyValue(value);
                this.daily.Add(dailyValue);
            });
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReportDownloadedEventArgs"/> class.
        /// </summary>
        /// <param name="report">
        /// The report.
        /// </param>
        /// <param name="timestamp">
        /// The timestamp.
        /// </param>
        /// <param name="exception">Exception.</param>
        public ReportDownloadedEventArgs(BandwidthReport report, DateTime timestamp, Exception exception)
        {
            this.monthly   = new List <MonthlyValue>();
            this.daily     = new List <DailyValue>();
            this.Timestamp = timestamp;

            if (null != exception)
            {
                this.Error = exception;
                return;
            }

            report.Monthly.Each((value) =>
            {
                var monthlyValue = new MonthlyValue(value);
                this.monthly.Add(monthlyValue);
            });

            report.Daily.Each((value) =>
            {
                var dailyValue = new DailyValue(value);
                this.daily.Add(dailyValue);
            });
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DailyFilter"/> class.
 /// </summary>
 /// <param name="dailyValue">
 /// The daily value.
 /// </param>
 public DailyFilter(DailyValue dailyValue)
 {
     this.Date      = dailyValue.Timestamp;
     this.Timestamp = this.Date.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern, CultureInfo.CurrentCulture);
 }