public MonthGridView(FMCalendar calendarMonthView, DateTime month)
		{
			_calendarMonthView = calendarMonthView;
			_currentMonth = month.Date;

			BackgroundColor = _calendarMonthView.MonthBackgroundColor;
		}
Exemple #2
0
        public MonthGridView(FMCalendar calendarMonthView, DateTime month)
        {
            _calendarMonthView = calendarMonthView;
            _currentMonth      = month.Date;

            BackgroundColor = _calendarMonthView.MonthBackgroundColor;
        }
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();
 
            await RefreshView();

            myEventList = recipientListItemAdapter.getEventsByEmployeeID(IoC.UserInfo.EmployeeID, eventItemAdapter);
            myEventList = filterEvents();
            fmCalendar = new FMCalendar(View.Bounds);

            View.BackgroundColor = UIColor.White;

            // Specify selection color
            fmCalendar.SelectionColor = UIColor.Red;

            // Specify today circle Color
            fmCalendar.TodayCircleColor = UIColor.Red;

            // Customizing appearance
            fmCalendar.LeftArrow = UIImage.FromFile("leftArrow.png");
            fmCalendar.RightArrow = UIImage.FromFile("rightArrow.png");

            fmCalendar.MonthFormatString = "MMMM yyyy";

            // Shows Sunday as last day of the week
            fmCalendar.SundayFirst = false;

            // Mark with a dot dates that fulfill the predicate
            //for (int i = 0; i < myEventList.Count; )
            List<int> daysofyear = getDateList();
            fmCalendar.IsDayMarkedDelegate = (date) =>
            {

                if (daysofyear.Contains(date.DayOfYear))
                {
                    return true;
                }
                else
                    return false;
                //  return date.DayOfYear == myEventList.EventDate.DayOfYear;                
            };

                    // Turn gray dates that fulfill the predicate
            fmCalendar.IsDateAvailable = (date) =>
            {
                return (date >= DateTime.Today);
            };

            fmCalendar.DateSelected += (date) =>
            {
                List<EventItem> EventsOnDate = filterEventsByDate(myEventList, date);

                CalendarListController eventList = new CalendarListController(EventsOnDate);
                NavigationController.PushViewController(eventList, true);
            };

            // Add FMCalendar to SuperView
            fmCalendar.Center = this.View.Center;
            this.View.AddSubview(fmCalendar);
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			fmCalendar = new FMCalendar (View.Bounds);

			View.BackgroundColor = UIColor.White;

			// Specify selection color
			fmCalendar.SelectionColor = UIColor.Red;

			// Specify today circle Color
			fmCalendar.TodayCircleColor = UIColor.Red;

			// Customizing appearance
			fmCalendar.LeftArrow = UIImage.FromFile ("leftArrow.png");
			fmCalendar.RightArrow = UIImage.FromFile ("rightArrow.png");

			fmCalendar.MonthFormatString = "MMMM yyyy";

			// Shows Sunday as last day of the week
			fmCalendar.SundayFirst = false;

			// Mark with a dot dates that fulfill the predicate
			fmCalendar.IsDayMarkedDelegate = (date) => 
			{
				return date.Day % 2 == 0;
			};

			// Turn gray dates that fulfill the predicate
			fmCalendar.IsDateAvailable = (date) =>
			{
				return (date >= DateTime.Today);
			};

			fmCalendar.MonthChanged = (date) => 
			{
				Console.WriteLine ("Month changed {0}", date.Date);
			};

			fmCalendar.DateSelected += (date) => 
			{
				Console.WriteLine ("Date selected: {0}", date);
			};

			// Add FMCalendar to SuperView
			fmCalendar.Center = this.View.Center;
			this.View.AddSubview (fmCalendar);
		}
Exemple #5
0
        public MonthView()
            : base()
        {
            this.occurrencesByDate = PopulateOccurrences();

            this.Root = new RootElement("History");
            this.calendar = CreateCalendar();
            this.Occurrences = new Section("Completions");
            this.MissedGoals = new Section("Missed Goals");

            var c = new UIViewElement("", this.calendar, false);

            Root.Add(new Section("") { c });
            Root.Add(Occurrences);
            Root.Add(MissedGoals);
        }
        public static FMCalendar GetPreconfiguredInstance(
            CGRect frame, Action<DateTime> dateSelected)
        {
            _calendar = new FMCalendar (frame);

            _calendar.LeftArrow = UIImage.FromBundle("left_arrow.png");
            _calendar.RightArrow = UIImage.FromBundle("right_arrow.png");
            _calendar.SelectionColor = Colors.Accent;
            _calendar.TodayCircleColor = Colors.Accent;

            _calendar.MonthFormatString = "MMMM yyyy";
            _calendar.SundayFirst = true;

            _calendar.DateSelected = date =>
            {
                    DeselectUnavailableDate(date);
                    dateSelected?.Invoke(date);
            };
            _calendar.IsDateAvailable = date => 
                date >= DateTime.Today;

            return _calendar;
        }
        public override async void ViewDidLoad()
        {
			Console.WriteLine ("Creating calendar update task...");
			using (new NetworkActivityUtil ()) {
				var calUpdateTask = RestAPI.UpdateCalendar (DateTime.Today);
				Console.WriteLine ("Setting up FMCalendar.");

				//------- color conversion (Hex to Dec)-------------
				// Teal UIColor.FromRGB(51, 206, 197)
				// Light Blue  UIColor.FromRGB(147,229,219)
				//--------------------------------------------------
				base.ViewDidLoad ();

				fmCalendar = new FMCalendar (View.Bounds);
            
				// Light Blue
				fmCalendar.MonthBackgroundColor = UIColor.FromRGB (153, 204, 204);
            
				// Mark the previous selection as white
				fmCalendar.SelectionColor = UIColor.White;
            
				// Teal
				fmCalendar.TodayCircleColor = UIColor.FromRGB (51, 206, 197);

				// Customizing appearance
				fmCalendar.LeftArrow = UIImage.FromFile ("leftArrow.png");
				fmCalendar.RightArrow = UIImage.FromFile ("rightArrow.png");

				fmCalendar.MonthFormatString = "MMMM yyyy";

				// Shows Sunday as last day of the week
				fmCalendar.SundayFirst = true;

				// Mark with a dot dates that fulfill the predicate
				fmCalendar.IsDayMarkedDelegate = (date) => {
					return Database.DB.EventCountForDate (date) > 0;
				};

				// Gray out past days
				fmCalendar.IsDateAvailable = (date) => {
					return (date >= DateTime.Today);
				};

				// What action to take when months are changed
				fmCalendar.MonthChanged = async (date) => {
					using (new NetworkActivityUtil()) {
						await RestAPI.UpdateCalendar (date);
					}
					RedrawCalendar ();
				};

				fmCalendar.DateSelected += (date) => {
					segueDate = date;
					PerformSegue ("segueCalDay", this);
				};

				// Add FMCalendar to SuperView
				fmCalendar.Center = new CGPoint (this.View.Bounds.Width / 2, this.View.Bounds.Height / 1.7);
				this.View.AddSubview (fmCalendar);

				Console.WriteLine ("Calling await on calendar update task");
				await calUpdateTask;
			}
			RedrawCalendar();
        }
Exemple #8
0
        private FMCalendar CreateCalendar()
        {
            var cal = new FMCalendar(
                new CoreGraphics.CGRect(View.Bounds.Location,
                                        new CoreGraphics.CGSize(View.Bounds.Width,
                                                                View.Bounds.Height*.4f)
                                       ));

            View.BackgroundColor = UIColor.White;
            cal.SelectionColor = UIColor.Blue;
            cal.TodayCircleColor = UIColor.Red;

            cal.MonthFormatString = "MMMM yyyy";
            cal.SundayFirst = true;

            cal.IsDayMarkedDelegate = (date) => occurrencesByDate.ContainsKey(date);
            cal.IsDateAvailable = (date) => occurrencesByDate.ContainsKey(date.Date);
            cal.DateSelected += (date) => ShowOccurrencesforDay(date);

            return cal;
        }
		public MonthGridView(FMCalendar calendarMonthView, DateTime month)
		{
			_calendarMonthView = calendarMonthView;
			_currentMonth = month.Date;
		}