Esempio n. 1
0
		public override void ViewDidLoad ()
		{
			this.AddOption ("Year", SelectYear);
			this.AddOption ("Month", SelectMonth);
			this.AddOption ("Month Names", SelectMonthNames);
			this.AddOption ("Year Numbers", SelectYearNumbers);
			this.AddOption ("Flow", SelectFlow);
			this.AddOption ("Week view", SelectWeekView);

			base.ViewDidLoad ();

			NSCalendar calendar = new NSCalendar (NSCalendarType.Gregorian);
			calendar.FirstWeekDay = 2;
			NSDate date = NSDate.Now;
			NSDateComponents components = new NSDateComponents ();
			components.Year = -10;
			NSDate minDate = calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0);
			components.Year = 10;
			NSDate maxDate = calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0);

			this.CalendarView = new TKCalendar (this.View.Bounds);
			this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			this.View.AddSubview (this.CalendarView);

			this.calendarDelegate = new CalendarDelegate(this);

			this.CalendarView.Delegate = calendarDelegate;
			this.CalendarView.ViewMode = TKCalendarViewMode.Year;
			this.CalendarView.Calendar = calendar;
			this.CalendarView.MinDate = minDate;
			this.CalendarView.MaxDate = maxDate;
			this.CalendarView.NavigateToDate (date, false);
		}
Esempio n. 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
// >> getting-started-calendar-cs
            TKCalendar calendarView = new TKCalendar(this.View.Bounds);

            calendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View.AddSubview(calendarView);
// << getting-started-calendar-cs

            calendarDelegate = new CalendarDelegate();

// >> getting-started-assigndatasource-cs
            calendarView.DataSource = new CalendarDataSource(this);
// << getting-started-assigndatasource-cs

// >> getting-started-event-cs
            events = new List <TKCalendarEvent> ();
            NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian);
            NSDate     date     = NSDate.Now;

            Random r = new Random();

            for (int i = 0; i < 3; i++)
            {
                TKCalendarEvent ev = new TKCalendarEvent();
                ev.Title = "Sample event";
                NSDateComponents components = calendar.Components(NSCalendarUnit.Day | NSCalendarUnit.Month | NSCalendarUnit.Year, date);
                components.Day = r.Next() % 20;
                ev.StartDate   = calendar.DateFromComponents(components);
                ev.EndDate     = calendar.DateFromComponents(components);
                ev.EventColor  = UIColor.Red;
                events.Add(ev);
            }
// << getting-started-event-cs

// >> getting-started-minmaxdate-cs
            calendarView.MinDate = TKCalendar.DateWithYear(2010, 1, 1, calendar);
            calendarView.MaxDate = TKCalendar.DateWithYear(2016, 12, 31, calendar);
// << getting-started-minmaxdate-cs

//			calendarDelegate.events = this.events;
            calendarView.Delegate = calendarDelegate;

// >> getting-started-navigatetodate-cs
            NSDateComponents newComponents = new NSDateComponents();

            newComponents.Year  = 2015;
            newComponents.Month = 5;
            newComponents.Day   = 1;
            NSDate newDate = calendarView.Calendar.DateFromComponents(newComponents);

// >> navigation-navigate-cs
            calendarView.NavigateToDate(newDate, true);
// << navigation-navigate-cs
// << getting-started-navigatetodate-cs

            calendarView.ReloadData();
        }
Esempio n. 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.tableViewDataSource = new TableViewDataSource(this);

            this.TableView = new UITableView(new RectangleF());
            this.TableView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.TableView.RegisterClassForCellReuse(typeof(UITableViewCell), new NSString("cell"));
            this.TableView.DataSource = this.tableViewDataSource;
            this.View.AddSubview(this.TableView);

            NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian);

            calendar.FirstWeekDay = 2;

            NSDateComponents components = new NSDateComponents();

            components.Year = -10;
            NSDate minDate = calendar.DateByAddingComponents(components, NSDate.Now, (NSCalendarOptions)0);

            components.Year = 10;
            NSDate maxDate = calendar.DateByAddingComponents(components, NSDate.Now, (NSCalendarOptions)0);

            this.calendarDelegate   = new CalendarDelegate(this);
            this.calendarDataSource = new CalendarDataSource(this);

            this.CalendarView = new TKCalendar(new RectangleF());
            this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.CalendarView.Calendar         = calendar;
            this.CalendarView.Delegate         = calendarDelegate;
            this.CalendarView.DataSource       = calendarDataSource;
            // >> navigation-minmaxdate-cs
            this.CalendarView.MinDate = minDate;
            this.CalendarView.MaxDate = maxDate;
            // << navigation-minmaxdate-cs
            this.CalendarView.AllowPinchZoom = true;

            TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;

            presenter.Style.TitleCellHeight = 40;
            presenter.HeaderIsSticky        = true;

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                presenter.WeekNumbersHidden = true;
                // >> customizations-ipad-cs
                this.CalendarView.Theme = new TKCalendarIPadTheme();
                // << customizations-ipad-cs
                presenter.Update(true);
            }
            else
            {
                presenter.WeekNumbersHidden = false;
            }

            this.View.AddSubview(this.CalendarView);
        }
Esempio n. 4
0
        public override void ViewDidLoad()
        {
            this.AddOption("Flip Effect", SelectFlipEffect);
            this.AddOption("Float Effect", SelectedFloatEffect);
            this.AddOption("Fold Effect", SelectedFoldEffect);
            this.AddOption("Rotate Effect", SelectedRotateEffect);
            this.AddOption("Card Effect", SelectedCardEffect);
            this.AddOption("Scroll Effect", SelectedScrollEffect);

            base.ViewDidLoad();

            this.calendarDelegate  = new CalendarDelegate(this);
            this.presenterDelegate = new CalendarPresenterDelegate(this);

            UIToolbar toolbar = new UIToolbar(new CGRect(0, this.View.Frame.Size.Height - 44, this.View.Bounds.Size.Width, 44));

            toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.View.AddSubview(toolbar);

            UIBarButtonItem buttonPrev = new UIBarButtonItem("Prev month", UIBarButtonItemStyle.Plain, this, new Selector("PrevTouched"));
            UIBarButtonItem buttonNext = new UIBarButtonItem("Next month", UIBarButtonItemStyle.Plain, this, new Selector("NextTouched"));
            UIBarButtonItem space      = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, this, null);

            toolbar.Items = new UIBarButtonItem[] { buttonPrev, space, buttonNext };

            CGRect rect = new CGRect(0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - toolbar.Frame.Size.Height);

            this.CalendarView = new TKCalendar(rect);
            this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            this.CalendarView.Delegate         = calendarDelegate;
            this.CalendarView.AllowPinchZoom   = false;
            this.View.AddSubview(CalendarView);

            NSDate           date       = NSDate.Now;
            NSDateComponents components = new NSDateComponents();

            components.Year           = -1;
            this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None);
            components.Year           = 1;
            this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None);

            // >> transitions-monthpresenter-cs
            TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;

            presenter.TransitionMode = TKCalendarTransitionMode.Flip;
            // << transitions-monthpresenter-cs
            presenter.Delegate = new CalendarPresenterDelegate(this);
            // >> transitions-transitionvertical-cs
            presenter.TransitionIsVertical = true;
            // << transitions-transitionvertical-cs
            presenter.ContentView.BackgroundColor = this.Colors [ColorIndex];
            // >> transitions-transitionduration-cs
            presenter.TransitionDuration = 2;
            // << transitions-transitionduration-cs
            this.TransitionMode = TKCalendarTransitionMode.Flip;
        }
Esempio n. 5
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			this.tableViewDataSource = new TableViewDataSource (this);

			this.TableView = new UITableView (new RectangleF ());
			this.TableView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
			this.TableView.RegisterClassForCellReuse (typeof(UITableViewCell), new NSString("cell"));
			this.TableView.DataSource = this.tableViewDataSource;
			this.View.AddSubview (this.TableView);

			NSCalendar calendar = new NSCalendar (NSCalendarType.Gregorian);
			calendar.FirstWeekDay = 2;

			NSDateComponents components = new NSDateComponents ();
			components.Year = -10;
			NSDate minDate = calendar.DateByAddingComponents (components, NSDate.Now, (NSCalendarOptions)0);
			components.Year = 10;
			NSDate maxDate = calendar.DateByAddingComponents (components, NSDate.Now, (NSCalendarOptions)0);

			this.calendarDelegate = new CalendarDelegate (this);
			this.calendarDataSource = new CalendarDataSource (this);

			this.CalendarView = new TKCalendar (new RectangleF());
			this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			this.CalendarView.Calendar = calendar;
			this.CalendarView.Delegate = calendarDelegate;
			this.CalendarView.DataSource = calendarDataSource;
			this.CalendarView.MinDate = minDate;
			this.CalendarView.MaxDate = maxDate;
			this.CalendarView.AllowPinchZoom = true;

			TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;
			presenter.Style.TitleCellHeight = 40;
			presenter.HeaderIsSticky = true;

			if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
				presenter.WeekNumbersHidden = true;
				this.CalendarView.Theme = new TKCalendarIPadTheme ();
				presenter.Update (true);
			} else {
				presenter.WeekNumbersHidden = false;
			}

			this.View.AddSubview (this.CalendarView);
		}
Esempio n. 6
0
        public override void ViewDidLoad()
        {
            this.AddOption("Year", SelectYear);
            this.AddOption("Month", SelectMonth);
            this.AddOption("Month Names", SelectMonthNames);
            this.AddOption("Year Numbers", SelectYearNumbers);
            this.AddOption("Flow", SelectFlow);
            this.AddOption("Week view", SelectWeekView);

            base.ViewDidLoad();

            NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian);

            calendar.FirstWeekDay = 2;
            NSDate           date       = NSDate.Now;
            NSDateComponents components = new NSDateComponents();

            components.Year = -10;
            NSDate minDate = calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0);

            components.Year = 10;
            NSDate maxDate = calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0);

            this.CalendarView = new TKCalendar(this.View.Bounds);
            this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View.AddSubview(this.CalendarView);

            this.calendarDelegate = new CalendarDelegate(this);

            this.CalendarView.Delegate = calendarDelegate;
            this.CalendarView.ViewMode = TKCalendarViewMode.Year;
            this.CalendarView.Calendar = calendar;
            this.CalendarView.MinDate  = minDate;
            this.CalendarView.MaxDate  = maxDate;
            // >> view-modes-pinchzoom-cs
            this.CalendarView.AllowPinchZoom = false;
            // << view-modes-pinchzoom-cs
            this.CalendarView.NavigateToDate(date, false);

            // >> view-modes-presenter-cs
            TKCalendarYearPresenter presenter = (TKCalendarYearPresenter)this.CalendarView.Presenter;

            presenter.Columns = 3;
            // << view-modes-presenter-cs
        }
		public override void ViewDidLoad ()
		{
			this.AddOption ("Flip Effect", SelectFlipEffect);
			this.AddOption ("Float Effect", SelectedFloatEffect);
			this.AddOption ("Fold Effect", SelectedFoldEffect);
			this.AddOption ("Rotate Effect", SelectedRotateEffect);
			this.AddOption ("Card Effect", SelectedCardEffect);
			this.AddOption ("Scroll Effect", SelectedScrollEffect);

			base.ViewDidLoad ();

			this.calendarDelegate  = new CalendarDelegate (this); 
			this.presenterDelegate = new CalendarPresenterDelegate (this);

			UIToolbar toolbar = new UIToolbar (new CGRect (0, this.View.Frame.Size.Height - 44, this.View.Bounds.Size.Width, 44));
			toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
			this.View.AddSubview (toolbar);

			UIBarButtonItem buttonPrev = new UIBarButtonItem("Prev month", UIBarButtonItemStyle.Plain, this, new Selector("PrevTouched"));
			UIBarButtonItem buttonNext = new UIBarButtonItem("Next month", UIBarButtonItemStyle.Plain, this, new Selector("NextTouched"));
			UIBarButtonItem space = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, this, null);
			toolbar.Items = new UIBarButtonItem[] { buttonPrev, space, buttonNext };

			CGRect rect = new CGRect (0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - toolbar.Frame.Size.Height);
			this.CalendarView = new TKCalendar (rect);
			this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
			this.CalendarView.Delegate = calendarDelegate;
			this.CalendarView.AllowPinchZoom = false;
			this.View.AddSubview (CalendarView);

			NSDate date = NSDate.Now;
			NSDateComponents components = new NSDateComponents ();
			components.Year = -1;
			this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None);
			components.Year = 1;
			this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None);

			TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;
			presenter.TransitionMode = TKCalendarTransitionMode.Flip;
			presenter.Delegate = new CalendarPresenterDelegate (this);
			presenter.ContentView.BackgroundColor = this.Colors [ColorIndex];
			this.TransitionMode = TKCalendarTransitionMode.Flip;
		}
Esempio n. 8
0
        public override void ViewDidLoad()
        {
            this.AddOption("Single date selection", SelectSingleMode);
            this.AddOption("Multiple dates selection", SelectMultipleMode);
            this.AddOption("Date range selection", SelectRangeMode);

            this.SelectedOption = 2;

            base.ViewDidLoad();

            this.calendarDelegate = new CalendarDelegate(this);

            this.CalendarView = new TKCalendar(this.View.Bounds);
            this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.CalendarView.Delegate         = calendarDelegate;
            this.CalendarView.SelectionMode    = TKCalendarSelectionMode.Range;
            this.View.AddSubview(this.CalendarView);

            NSDateComponents components = new NSDateComponents();

            components.Day = 1;

            NSDate date = NSDate.Now;

            this.UnselectableDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0);

            components.Day = 3;
            NSDate startDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0);

            components.Day = 6;
            NSDate endDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0);

            components.Year           = -5;
            this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0);

            components.Year           = 5;
            this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0);

            this.CalendarView.SelectedDatesRange = new TKDateRange(startDate, endDate);
        }
Esempio n. 9
0
        public override void ViewDidLoad()
        {
            this.AddOption ("Single date selection", SelectSingleMode);
            this.AddOption ("Multiple dates selection", SelectMultipleMode);
            this.AddOption ("Date range selection", SelectRangeMode);

            this.SelectedOption = 2;

            base.ViewDidLoad ();

            this.calendarDelegate = new CalendarDelegate (this);

            this.CalendarView = new TKCalendar (this.View.Bounds);
            this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.CalendarView.Delegate = calendarDelegate;
            this.CalendarView.SelectionMode = TKCalendarSelectionMode.Range;
            this.View.AddSubview (this.CalendarView);

            NSDateComponents components = new NSDateComponents ();
            components.Day = 1;

            NSDate date = NSDate.Now;
            this.UnselectableDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0);

            components.Day = 3;
            NSDate startDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0);

            components.Day = 6;
            NSDate endDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0);

            components.Year = -5;
            this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0);

            components.Year = 5;
            this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0);

            this.CalendarView.SelectedDatesRange = new TKDateRange (startDate, endDate);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.calendarDelegate  = new CalendarDelegate (this);
            this.presenterDelegate = new CalendarPresenterDelegate (this);

            UIToolbar toolbar = new UIToolbar (new CGRect (0, this.View.Frame.Size.Height - 44, this.View.Bounds.Size.Width, 44));
            toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            this.View.AddSubview (toolbar);

            UIBarButtonItem buttonPrev = new UIBarButtonItem("Prev month", UIBarButtonItemStyle.Plain, this, new Selector("PrevTouched"));
            UIBarButtonItem buttonNext = new UIBarButtonItem("Next month", UIBarButtonItemStyle.Plain, this, new Selector("NextTouched"));
            UIBarButtonItem space = new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, this, null);
            toolbar.Items = new UIBarButtonItem[] { buttonPrev, space, buttonNext };

            CGRect rect = new CGRect (0, 0, this.View.Bounds.Size.Width, this.View.Bounds.Size.Height - toolbar.Frame.Size.Height);
            this.CalendarView = new TKCalendar (rect);
            this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            this.CalendarView.Delegate = calendarDelegate;
            this.CalendarView.AllowPinchZoom = false;
            this.View.AddSubview (CalendarView);

            TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter;
            presenter.TransitionMode = TKCalendarTransitionMode.Flip;
            presenter.Delegate = new CalendarPresenterDelegate (this);
            presenter.ContentView.BackgroundColor = this.Colors [ColorIndex];
            this.TransitionMode = TKCalendarTransitionMode.Flip;
        }