Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeMarker"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="brush">The brush.</param>
 public TimeMarker(string name, Brush brush)
 {
     this.TimeMarkerName  = LocalizationManager.GetString(name);
     this.TimeMarkerBrush = brush;
 }
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call <see cref="M:System.Windows.Controls.Control.ApplyTemplate"/>.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            RadContextMenu menu = this.GetChildByName("PART_categoryMenu") as RadContextMenu;

            if (menu != null)
            {
                menu.ItemClick += this.MenuItemClick;

                menu.ClickToOpen = true;
            }

            RadComboBox timeMarker = this.GetChildByName("PART_TimeMarkers") as RadComboBox;

            if (timeMarker != null)
            {
                timeMarker.ClearSelectionButtonContent = LocalizationManager.GetString("Clear");
            }
            RadScheduler scheduler = Scheduler as RadScheduler;

            if (scheduler != null && !String.IsNullOrEmpty(scheduler.GroupBy) && this.RecurrenceMode == RecurrenceMode.Occurrence)
            {
                this.ResourceTypesVisibility = Visibility.Collapsed;
            }
            var appointment = this.EditedAppointment as AppointmentBase;

            if (appointment != null)
            {
                if (appointment.TimeMarker != null)
                {
                    this.TimeMarker = this.TimeMarkers.SingleOrDefault(tm => tm.TimeMarkerName == appointment.TimeMarker.TimeMarkerName);
                }
                if (appointment.Category != null)
                {
                    this.Category = appointment.Category;
                }
            }
            if (scheduler != null)
            {
                if (this.Categories == null)
                {
                    if (scheduler.Categories != null && scheduler.Categories.Count > 0)
                    {
                        this.Categories = scheduler.Categories;
                    }
                    else
                    {
                        this.Categories = Telerik.Windows.Controls.Scheduler.Categories.AllCategories;
                    }
                }
                this.ResourceTypeModels = new ResourceTypeViewModelCollection();
                foreach (var resourceType in scheduler.ResourceTypes)
                {
                    this.ResourceTypeModels.Add(new ResourceTypeViewModel(resourceType, this.EditedAppointment));
                }
            }

            this.ConfigureDateTimePickers();
            this.ConfigureButtons();
        }