Inheritance: FragmentRootControlProvider
		public ListItemSelectionItemPatternIsSelectedEvent (MonthCalendarListItemProvider itemProvider)
			: base (itemProvider, 
			        SelectionItemPatternIdentifiers.IsSelectedProperty)
		{
			this.dataGridProvider = itemProvider.DataGridProvider;
			this.selected = dataGridProvider.IsItemSelected (itemProvider);
		}
示例#2
0
        // We can only allow removing from selection on the endpoints.
        // Winforms GUI doesn't even allow this.
        public void RemoveFromSelection(MonthCalendarListItemProvider itemProvider)
        {
            if (!CanSelectMultiple)
            {
                throw new InvalidOperationException();
            }

            SelectionRange range = calendar.SelectionRange;

            if (range.Start == range.End)
            {
                throw new InvalidOperationException();
            }

            if (range.Start == itemProvider.Date)
            {
                range.Start = range.Start.AddDays(1);
                return;
            }

            if (range.End == itemProvider.Date)
            {
                range.End = range.End.AddDays(-1);
                return;
            }

            throw new InvalidOperationException();
        }
		public SelectionItemPatternElementRemovedEvent (MonthCalendarListItemProvider itemProvider)
			: base (itemProvider, 
			        SelectionItemPatternIdentifiers.ElementRemovedFromSelectionEvent)
		{
			this.dataGridProvider = itemProvider.DataGridProvider;
			this.selected = dataGridProvider.IsItemSelected (itemProvider);
		}
示例#4
0
        private void AddChildren()
        {
            MonthCalendarListItemProvider item;
            SelectionRange range = calendar.GetDisplayRange(false);

            for (DateTime d = range.Start;
                 d <= range.End; d = d.AddDays(1))
            {
                int days = (d - range.Start).Days;
                int r    = (int)System.Math.Floor((double)days
                                                  / (double)MonthCalendarProvider.DaysInWeek);
                int c = days - (r * MonthCalendarProvider.DaysInWeek);

                item = new MonthCalendarListItemProvider(
                    this, calendarProvider, Control, d, r, c);
                item.Initialize();

                AddChildProvider(item);
                gridChildren.Add(d, item);
            }

            backButton = new MonthCalendarButtonProvider(
                this, MonthCalendarButtonProvider.ButtonDirection.Back);
            backButton.Initialize();
            AddChildProvider(backButton);

            forwardButton = new MonthCalendarButtonProvider(
                this, MonthCalendarButtonProvider.ButtonDirection.Forward);
            forwardButton.Initialize();
            AddChildProvider(forwardButton);
        }
示例#5
0
        public bool IsItemSelected(MonthCalendarListItemProvider itemProvider)
        {
            SelectionRange range = calendar.SelectionRange;

            return(range.Start <= itemProvider.Date &&
                   range.End >= itemProvider.Date);
        }
示例#6
0
        // The behavior of this will be a little wonky as selection
        // must be continuous.
        public void AddToSelection(MonthCalendarListItemProvider itemProvider)
        {
            if (!CanSelectMultiple)
            {
                throw new InvalidOperationException();
            }

            if (IsItemSelected(itemProvider))
            {
                return;
            }

            SelectionRange range = calendar.SelectionRange;

            int proposedDays = (range.End - itemProvider.Date).Days;

            if (range.Start > itemProvider.Date)
            {
                if (proposedDays > calendar.MaxSelectionCount)
                {
                    throw new InvalidOperationException();
                }

                range.Start = itemProvider.Date;
            }

            proposedDays = (itemProvider.Date - range.Start).Days;
            if (range.End < itemProvider.Date)
            {
                if (proposedDays > calendar.MaxSelectionCount)
                {
                    throw new InvalidOperationException();
                }

                range.End = itemProvider.Date;
            }

            calendar.SelectionRange = range;
        }
		private void AddChildren ()
		{
			MonthCalendarListItemProvider item;
			SelectionRange range = calendar.GetDisplayRange (false);

			for (DateTime d = range.Start;
			     d <= range.End; d = d.AddDays (1)) {
				int days = (d - range.Start).Days;
				int r = (int)System.Math.Floor ((double)days
					/ (double)MonthCalendarProvider.DaysInWeek);
				int c = days - (r * MonthCalendarProvider.DaysInWeek);

				item = new MonthCalendarListItemProvider (
					this, calendarProvider, Control, d, r, c);
				item.Initialize ();

				AddChildProvider (item);
				gridChildren.Add (d, item);
			}

			backButton = new MonthCalendarButtonProvider (
				this, MonthCalendarButtonProvider.ButtonDirection.Back);
			backButton.Initialize ();
			AddChildProvider (backButton);

			forwardButton = new MonthCalendarButtonProvider (
				this, MonthCalendarButtonProvider.ButtonDirection.Forward);
			forwardButton.Initialize ();
			AddChildProvider (forwardButton);
		}
		public bool IsItemSelected (MonthCalendarListItemProvider itemProvider)
		{
			SelectionRange range = calendar.SelectionRange;
			return (range.Start <= itemProvider.Date
			        && range.End >= itemProvider.Date);
		}
		public void SelectItem (MonthCalendarListItemProvider itemProvider)
		{
			calendar.SelectionRange
				= new SelectionRange (itemProvider.Date,
			                              itemProvider.Date);
		}
		public MonthCalendarListItemEditProvider (MonthCalendarListItemProvider listItemProvider,
		                                          Control control)
			: base (control)
		{
			this.listItemProvider = listItemProvider;
		}
		public ListItemValueProviderBehavior (FragmentControlProvider provider,
		                                      MonthCalendarListItemProvider itemProvider)
			: base (provider)
		{
			this.itemProvider = itemProvider;
		}
		public ListItemSelectionItemProviderBehavior (MonthCalendarListItemProvider provider)
			: base (provider)
		{
			this.itemProvider = provider;
		}
		public ListItemTableItemProviderBehavior (MonthCalendarListItemProvider itemProvider)
			: base (itemProvider)
		{
		}
		public ListItemSelectionItemPatternElementSelectedEvent (MonthCalendarListItemProvider itemProvider)
			: base (itemProvider, 
			        SelectionItemPatternIdentifiers.ElementSelectedEvent)
		{
			this.dataGridProvider = itemProvider.DataGridProvider;
		}
示例#15
0
 public void SelectItem(MonthCalendarListItemProvider itemProvider)
 {
     calendar.SelectionRange
         = new SelectionRange(itemProvider.Date,
                              itemProvider.Date);
 }
		// The behavior of this will be a little wonky as selection
		// must be continuous.
		public void AddToSelection (MonthCalendarListItemProvider itemProvider)
		{
			if (!CanSelectMultiple) {
				throw new InvalidOperationException ();
			}
			
			if (IsItemSelected (itemProvider)) {
				return;
			}

			SelectionRange range = calendar.SelectionRange;

			int proposedDays = (range.End - itemProvider.Date).Days;
			if (range.Start > itemProvider.Date) {
				if (proposedDays > calendar.MaxSelectionCount) {
					throw new InvalidOperationException ();
				}

				range.Start = itemProvider.Date;
			}

			proposedDays = (itemProvider.Date - range.Start).Days;
			if (range.End < itemProvider.Date) {
				if (proposedDays > calendar.MaxSelectionCount) {
					throw new InvalidOperationException ();
				}

				range.End = itemProvider.Date;
			}
			
			calendar.SelectionRange = range;
		}
		// We can only allow removing from selection on the endpoints.
		// Winforms GUI doesn't even allow this.
		public void RemoveFromSelection (MonthCalendarListItemProvider itemProvider)
		{
			if (!CanSelectMultiple) {
				throw new InvalidOperationException ();
			}

			SelectionRange range = calendar.SelectionRange;
			if (range.Start == range.End) {
				throw new InvalidOperationException ();
			}
			
			if (range.Start == itemProvider.Date) {
				range.Start = range.Start.AddDays (1);
				return;
			}
			
			if (range.End == itemProvider.Date) {
				range.End = range.End.AddDays (-1);
				return;
			}

			throw new InvalidOperationException ();
		}
		public ListItemGridItemProviderBehavior (MonthCalendarListItemProvider itemProvider)
			: base (itemProvider)
		{
			this.itemProvider = itemProvider;
		}
 public MonthCalendarListItemEditProvider(MonthCalendarListItemProvider listItemProvider,
                                          Control control)
     : base(control)
 {
     this.listItemProvider = listItemProvider;
 }