예제 #1
0
 private void SetDailyPane(ICustomTrigger _trigger)
 {
     chkRepeat.IsChecked         = _trigger.Interval == 0;
     cbCadencyUnit.SelectedValue = _trigger.IntervalUnit;
     txtCadency.Text             = _trigger.Interval.ToString();
     cbLifeUnit.SelectedValue    = _trigger.LifeUnit;
     txtLife.Text = _trigger.Life.ToString();
 }
예제 #2
0
        private void EditTrigger(ICustomTrigger _trigger)
        {
            txtName.Text        = _trigger.Name;
            txtGroup.Text       = _trigger.Group;
            dtStartDate.Text    = _trigger.StartDate.ToString("dd/MM/yyyy");
            txtStartHour.Text   = _trigger.StartDate.ToString("HH:mm");
            chkActive.IsChecked = trigger.Active;

            if (_trigger.Period == PeriodType.Giornaliero)
            {
                rbDaily.IsChecked = true;
                SetDailyPane(_trigger);
            }
            if (_trigger.Period == PeriodType.Settimanale)
            {
                rbWeekly.IsChecked = true;
                SetDailyPane(_trigger);
                foreach (var day in _trigger.WeekDays)
                {
                    if (!chkLun.IsChecked.Value)
                    {
                        chkLun.IsChecked = day == DayOfWeek.Monday;
                    }
                    if (!chkMar.IsChecked.Value)
                    {
                        chkMar.IsChecked = day == DayOfWeek.Tuesday;
                    }
                    if (!chkMer.IsChecked.Value)
                    {
                        chkMer.IsChecked = day == DayOfWeek.Wednesday;
                    }
                    if (!chkGio.IsChecked.Value)
                    {
                        chkGio.IsChecked = day == DayOfWeek.Thursday;
                    }
                    if (!chkVen.IsChecked.Value)
                    {
                        chkVen.IsChecked = day == DayOfWeek.Friday;
                    }
                    if (!chkSab.IsChecked.Value)
                    {
                        chkSab.IsChecked = day == DayOfWeek.Saturday;
                    }
                    if (!chkDom.IsChecked.Value)
                    {
                        chkDom.IsChecked = day == DayOfWeek.Sunday;
                    }
                }
            }
            if (_trigger.Period == PeriodType.Mensile)
            {
                txtMonthDay.Text = _trigger.StartDate.Day.ToString();
            }
        }
예제 #3
0
 public TriggerWindow(ICustomTrigger _trigger, bool isNew, Action <ICustomTrigger> onSave = null)
 {
     InitializeComponent();
     trigger = _trigger;
     IsNew   = isNew;
     OnSave  = onSave;
     cbCadencyUnit.ItemsSource = Enum.GetValues(typeof(IntervalUnit));
     cbLifeUnit.ItemsSource    = Enum.GetValues(typeof(IntervalUnit));
     chkLun.IsChecked          = false;
     chkMar.IsChecked          = false;
     chkMer.IsChecked          = false;
     chkGio.IsChecked          = false;
     chkVen.IsChecked          = false;
     chkSab.IsChecked          = false;
     chkDom.IsChecked          = false;
     txtName.IsEnabled         = isNew;
     txtGroup.IsEnabled        = isNew;
     if (!isNew)
     {
         EditTrigger(trigger);
     }
 }