Пример #1
0
        private void UpdateWindowHeader()
        {
            string result;
            string subject = string.Empty;
            bool   allDay  = false;

            if (_appointment != null)
            {
                subject = _appointment.Subject;
                allDay  = chkAllDay.IsChecked.Value;
            }
            if (String.IsNullOrEmpty(subject))
            {
                subject = C1Localizer.GetString("EditAppointment", "Untitled", "Untitled");
            }
            if (allDay)
            {
                result = C1Localizer.GetString("EditAppointment", "Event", "Event") + " - " + subject;
            }
            else
            {
                result = C1Localizer.GetString("EditAppointment", "Appointment", "Appointment") + " - " + subject;
            }

            Header = result;
        }
Пример #2
0
 private void endCalendar_DateTimeChanged(object sender, NullablePropertyChangedEventArgs <DateTime> e)
 {
     if (_appointment != null)
     {
         DateTime end = endCalendar.DateTime.Value;
         if (_appointment.AllDayEvent)
         {
             end = end.AddDays(1);
         }
         if (end < Appointment.Start)
         {
             endCalendar.BorderBrush     = endCalendar.Foreground = new SolidColorBrush(Colors.Red);
             endCalendar.BorderThickness = new Thickness(2);
             ToolTipService.SetToolTip(endCalendar, C1Localizer.GetString("Exceptions", "StartEndValidationFailed", "The End value should be greater than Start value."));
             PART_DialogSaveButton.IsEnabled = false;
         }
         else
         {
             _appointment.End = end;
             if (!PART_DialogSaveButton.IsEnabled)
             {
                 PART_DialogSaveButton.IsEnabled = true;
                 endCalendar.ClearValue(Control.ForegroundProperty);
                 endCalendar.ClearValue(Control.BorderBrushProperty);
                 endCalendar.ClearValue(Control.BorderThicknessProperty);
                 endCalendar.ClearValue(ToolTipService.ToolTipProperty);
             }
         }
     }
 }
Пример #3
0
 private void UpdateTitle()
 {
     if (_parentWindow != null)
     {
         string title = String.Empty;
         ReadOnlyObservableCollection <Reminder> rems = Scheduler.ActiveReminders;
         if (rems == null || rems.Count == 0)
         {
             title = C1Localizer.GetString("ShowReminders", "Title", "Reminders");
         }
         else
         {
             if (rems.Count == 1)
             {
                 title = C1Localizer.GetString("ShowReminders", "OneReminder", "1 Reminder");
             }
             else
             {
                 title = string.Format(C1Localizer.GetString("ShowReminders",
                                                             "RemindersNumber", "{0} Reminders"), rems.Count);
             }
         }
         if (_parentWindow is Window)
         {
             ((Window)_parentWindow).Title = title;
         }
         else
         {
             ((C1Window)_parentWindow).Header = title;
         }
     }
 }
 private void occurences_ValueChanged(object sender, PropertyChangedEventArgs <double> e)
 {
     if (_isLoaded)
     {
         Validate();
         if ((int)occurences.Value == 0)
         {
             occurences.BorderBrush     = occurences.Foreground = new SolidColorBrush(Colors.Red);
             occurences.BorderThickness = new Thickness(2);
             string error = String.Format(C1Localizer.GetString("ValidationErrors",
                                                                "NumberIsOutOfRange", "Please enter value in the range: {0}."), (string)("1 - 999"));
             ToolTipService.SetToolTip(occurences, error);
         }
     }
 }
 private void ValidateYearly()
 {
     if (IsValidDayMonth())
     {
         PART_DialogOkButton.IsEnabled = true;
         YearlyDetails12.ClearValue(Control.ForegroundProperty);
         YearlyDetails12.ClearValue(Control.BorderBrushProperty);
         YearlyDetails12.ClearValue(Control.BorderThicknessProperty);
         YearlyDetails12.ClearValue(ToolTipService.ToolTipProperty);
         YearlyDetails11.ClearValue(Control.ForegroundProperty);
         YearlyDetails11.ClearValue(Control.BorderBrushProperty);
         YearlyDetails11.ClearValue(Control.BorderThicknessProperty);
         YearlyDetails11.ClearValue(ToolTipService.ToolTipProperty);
     }
     else
     {
         PART_DialogOkButton.IsEnabled   = false;
         YearlyDetails11.BorderBrush     = YearlyDetails12.BorderBrush =
             YearlyDetails11.Foreground  = YearlyDetails12.Foreground = new SolidColorBrush(Colors.Red);
         YearlyDetails11.BorderThickness = YearlyDetails12.BorderThickness = new Thickness(2);
         int max   = 31;
         int month = YearlyDetails12.SelectedIndex + 1;
         if (month == 4 || month == 6 || month == 9 || month == 11)
         {
             max = 30;
         }
         if (month == 2)
         {
             max = 29;
         }
         string error = String.Format(C1Localizer.GetString("ValidationErrors",
                                                            "NumberIsOutOfRange", "Please enter value in the range: {0}."), (string)("1 - " + max));
         ToolTipService.SetToolTip(YearlyDetails12, error);
         ToolTipService.SetToolTip(YearlyDetails11, error);
     }
 }