using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Sched.CustomDialogs
{
    /// <summary>
    /// Interaction logic for TimetableViewDialog.xaml
    /// </summary>
    public partial class TimetableViewDialog : Window
    {
        public TimetableViewDialog(ObservableCollection<object> lessons)
        {
            InitializeComponent();
            TT.LoadLessons(lessons);
            SC.SizeChanged += SC_SizeChanged;
            TT.IsEnabled = false;   //to prevent user from editing outside the MainWindow
        }

        private void SC_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            double newWidth = e.NewSize.Width;
            var SCViewer = sender as ScrollViewer;
            if (SCViewer.VerticalScrollBarVisibility == ScrollBarVisibility.Visible)
            {
                newWidth -= SystemParameters.VerticalScrollBarWidth;
            }
            TT.Width = newWidth;
        }
    }
}
