using System.Windows;
using DevExpress.Xpf.Scheduler;
using DevExpress.XtraScheduler;
using BS.Shared.DataContracts.Compact;

namespace BeWo.Scheduler.View
{
    public partial class AbsenceTimeEditForm
    {
        public AbsenceTimeEditForm() 
        {
            InitializeComponent();
        }

        public AbsenceTimeEditForm(SchedulerControl schedulerControl, Appointment appointment, CompactEmployeeDC employee)
            : base(schedulerControl, appointment)
        {
            InitializeComponent();

            LabelEdit.ItemsSource = Controller.Storage.AppointmentStorage.Labels;
            LabelEdit.EditValue = Controller.Label;

            if (employee != null)
                LblEmployee.Content = employee.ToString();
        }
        
        private void button_ok_Click(object sender, RoutedEventArgs e)
        {
			
			//if (Appointment.RecurrenceInfo != null)
			//	ViewModel.ApplyChangesToChangedOccurencyCustomFields(emp, res, Appointment.RecurrenceIndex.ToString(), Appointment.RecurrenceInfo.Id);

            ApplyChanges();
        }
        
        private void button_cancel_Click(object sender, RoutedEventArgs e)
        {
            Cancel();
        }

        private void button_delete_Click(object sender, RoutedEventArgs e)
        {
            DeleteAppointment();
        }
        
        private void labelEdit_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
        {
            Controller.Label = e.NewValue as AppointmentLabel;
        }
    }
}
