using System;
using System.Linq;
using System.Windows.Forms;
using Telerik.WinControls.UI;

namespace RadScheduler
{
    public partial class Form1 : Form
    {
        private ConferenceRepository _repository;

        public Form1()
        {
            InitializeComponent(); 
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            _repository = new ConferenceRepository();

            //our conference is one day
            SchedulerDayView dayView = radScheduler1.GetDayView();
            dayView.DayCount = 1;
            dayView.StartDate = new DateTime(2013, 5, 17);

            //display the hours between 8am and 7pm in half hour chunks
            dayView.RulerStartScale = 8;
            dayView.RulerEndScale = 19;
            dayView.WorkTime = new TimeInterval(TimeSpan.FromHours(8), TimeSpan.FromHours(19));
            dayView.RangeFactor = ScaleRange.HalfHour;
            
            //set the binding source to our repository data
            conferenceRepositoryBindingSource.DataSource = _repository;

            //view the schedule grouped by resource
            radScheduler1.GroupType = GroupType.Resource;
        }

        private void radButton1_Click(object sender, EventArgs e)
        {
            _repository.PersistRepository();
            MessageBox.Show("Saved");
        }

    }
}
