using System;
using System.Drawing;
using Cirrious.MvvmCross.Binding.BindingContext;
using Cirrious.MvvmCross.Binding.Touch.Views;
using Cirrious.MvvmCross.Touch.Views;
using CoreFoundation;
using CoreGraphics;
using UIKit;
using Foundation;
using ObjCRuntime;
using CourseRoster.Core.ViewModels;

namespace CourseRoster.iOS.Views
{
    [Register("AllClassesView")]
    public class AllClassesView : MvxTableViewController
    {
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            base.View.BackgroundColor = UIColor.White;

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
            {
                EdgesForExtendedLayout = UIRectEdge.None;
            }


            var source = new MvxStandardTableViewSource(TableView, "TitleText Title;");
            TableView.Source = source;

            var set = this.CreateBindingSet<AllClassesView, AllClassesViewModel>();
            set.Bind(source).To(vm => vm.AllClasses);
            set.Apply();
            TableView.ReloadData();
        }
    }
}