public AddUptimeScheduleWindow(UptimeScheduler uptimeSchedulerToEdit, UptimeScheduler[] allUptimeSchedulers) : this(allUptimeSchedulers) { this.Title = Wsapm.Resources.Wsapm.AddUptimeScheduleWindow_TitleEdit; this.editUptimeSchedulerCopy = uptimeSchedulerToEdit.Copy(); InitUI(this.editUptimeSchedulerCopy); }
public UptimeManager(string full_url) { Key = full_url; CurrentUri = new Uri(full_url); CurrentScheduler = new UptimeScheduler(CurrentUri.OriginalString); CurrentSaver = new SaverScheduler(CurrentUri.OriginalString); Stats = new List <string>(); }
private void buttonOK_Click(object sender, RoutedEventArgs e) { var us = BuildUptimeScheduler(); this.uptimeScheduler = us; this.DialogResult = true; this.Close(); }
private void InitUI(UptimeScheduler uptimeScheduler) { if (this.editUptimeSchedulerCopy != null) { this.checkBoxUptime.IsChecked = this.editUptimeSchedulerCopy.EnableUptimeScheduler; EnableDisableUptimeOptions(); this.dateTimePickerStartTime.Value = this.editUptimeSchedulerCopy.DueTime; this.checkBoxEnableRepeat.IsChecked = this.editUptimeSchedulerCopy.EnableRepeat; this.upDownUptimeDurationHours.Value = this.editUptimeSchedulerCopy.Duration.Hours; this.upDownUptimeDurationMinutes.Value = this.editUptimeSchedulerCopy.Duration.Minutes; var repeat = this.editUptimeSchedulerCopy.RepeatAfter; if (this.editUptimeSchedulerCopy.RepeatAfter.Minutes != 0) { // Minutes. this.comboBoxUptimeInterval.SelectedIndex = 0; this.upDownUptimeInterval.Value = repeat.Minutes; } else if (this.editUptimeSchedulerCopy.RepeatAfter.Hours != 0) { // Hours. this.comboBoxUptimeInterval.SelectedIndex = 1; this.upDownUptimeInterval.Value = repeat.Hours; } else if (this.editUptimeSchedulerCopy.RepeatAfter.Days != 0) { // Days. this.comboBoxUptimeInterval.SelectedIndex = 2; this.upDownUptimeInterval.Value = repeat.Days; } EnableDisableRepeatOptions(); this.checkBoxEnableEndTime.IsChecked = this.editUptimeSchedulerCopy.EnableEndTime; this.dateTimePickerEndTime.Value = this.editUptimeSchedulerCopy.EndTime; EnableDisableEndTimeOptions(); } }
private UptimeScheduler BuildUptimeScheduler() { var scheduler = new UptimeScheduler(); scheduler.EnableUptimeScheduler = this.checkBoxUptime.IsChecked.Value; scheduler.DueTime = this.dateTimePickerStartTime.Value.Value; scheduler.EnableRepeat = this.checkBoxEnableRepeat.IsChecked.Value; var hours = this.upDownUptimeDurationHours.Value.Value; var minutes = this.upDownUptimeDurationMinutes.Value.Value; var duration = new TimeSpan(hours, minutes, 0); scheduler.Duration = duration; if (this.comboBoxUptimeInterval.SelectedIndex == 0) { // Minutes. scheduler.RepeatAfter = TimeSpan.FromMinutes((int)this.upDownUptimeInterval.Value); } else if (this.comboBoxUptimeInterval.SelectedIndex == 1) { // Hours. scheduler.RepeatAfter = TimeSpan.FromHours((int)this.upDownUptimeInterval.Value); } else if (this.comboBoxUptimeInterval.SelectedIndex == 2) { // Days. scheduler.RepeatAfter = TimeSpan.FromDays((int)this.upDownUptimeInterval.Value); } scheduler.EnableEndTime = this.checkBoxEnableEndTime.IsChecked.Value; scheduler.EndTime = this.dateTimePickerEndTime.Value.Value; return(scheduler); }