Version

IsAvailableForAutoAssignment Method

Returns whether the color scheme which corresponds to the specified 'baseColor' is available for automatic assignment to an Owner.
Syntax
'Declaration
 
Public Function IsAvailableForAutoAssignment( _
   ByVal baseColor As Color _
) As Boolean
public bool IsAvailableForAutoAssignment( 
   Color baseColor
)

Parameters

baseColor
The color which identifies the Outlook2007ColorScheme instance to be tested.

Return Value

true if the specified baseColor is available for automatic assignment to an Owner; otherwise false.
Remarks

Note: If no color scheme exists which corresponds to the specified baseColor, an exception is thrown.

Example
The following code sample demonstrates how to use the methods and properties of the Outlook2007ColorScheme and Outlook2007ColorSchemeCollection classes.
NOTE: This code sample references a control, Outlook2007ColorSchemeDropDown, which is created by subclassing the UltraComboEditor control; the source code for this control is included in its entirety in the code sample for the Outlook2007ColorScheme class' 'BaseColor' property topic.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports Infragistics.Win.UltraWinEditors

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        '	Set the UltraMonthViewSingle control up to separate owners
        Me.ultraMonthViewSingle1.OwnerDisplayStyle = OwnerDisplayStyle.Separate
        Me.ultraMonthViewSingle1.ActiveOwner = Me.ultraCalendarInfo1.Owners.UnassignedOwner
        Me.ultraMonthViewSingle1.CalendarLook.ViewStyle = ViewStyle.Office2007

        '	Reserve the color schemes which correspond to the Office2007 color schemes
        Dim colorSchemes As Outlook2007ColorSchemeCollection = Me.ultraCalendarLook1.Outlook2007ColorSchemes
        Me.ultraMonthViewSingle1.CalendarLook.Outlook2007ColorSchemes.DisallowAutoAssignment(colorSchemes.BaseColorBlue)
        Me.ultraMonthViewSingle1.CalendarLook.Outlook2007ColorSchemes.DisallowAutoAssignment(colorSchemes.BaseColorBlack)
        Me.ultraMonthViewSingle1.CalendarLook.Outlook2007ColorSchemes.DisallowAutoAssignment(colorSchemes.BaseColorSilver)

        '	Create a new instance of the Outlook2007ColorSchemeDropDown
        ' (see code sample included with the Outlook2007ColorScheme class help topic) 
        Dim dropDown As New Outlook2007ColorSchemeDropDown(Me, Me.ultraCalendarLook1)

        '	Hook the SelectionChangeCommitted event
        AddHandler dropDown.SelectionChangeCommitted, AddressOf Me.Outlook2007ColorSchemeDropDown_SelectionChangeCommitted

    End Sub

    Private Sub Outlook2007ColorSchemeDropDown_SelectionChangeCommitted(ByVal sender As Object, ByVal e As EventArgs)
        Dim dropDown As Outlook2007ColorSchemeDropDown = sender
        If Not (Me.ultraMonthViewSingle1.ActiveOwner Is Nothing) Then

            '	Get a reference to the Outlook2007ColorScheme that was selected by the end user.
            Dim selectedColorScheme As Outlook2007ColorScheme = dropDown.SelectedColorScheme
            Dim calendarLook As UltraCalendarLook = dropDown.CalendarLook
            Dim colorSchemes As Outlook2007ColorSchemeCollection = calendarLook.Outlook2007ColorSchemes

            '	If the color scheme is reserved, and not assigned to this owner, prompt the end user
            Dim result As DialogResult = DialogResult.Yes
            If (colorSchemes.IsAvailableForAutoAssignment(selectedColorScheme.BaseColor) = False) Then

                Dim currentlyAssignedScheme As Outlook2007ColorScheme = Me.ultraMonthViewSingle1.ActiveOwner.Outlook2007ColorScheme
                If Not currentlyAssignedScheme Is Nothing AndAlso Not currentlyAssignedScheme.BaseColor.Equals(selectedColorScheme.BaseColor) Then
                    result = MessageBox.Show(Me, "The color scheme you selected is currently reserved. Do you want to assign it anyway?", "Assign Color Scheme", MessageBoxButtons.YesNo)
                End If

            End If

            '	Assign the color scheme to the Owner's Outlook2007ColorScheme property,
            '	and mark it as unavailable
            If (result = DialogResult.Yes) Then
                Me.ultraMonthViewSingle1.ActiveOwner.Outlook2007ColorScheme = selectedColorScheme
            End If

        End If

    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;
using Infragistics.Win.UltraWinEditors;
using System.Diagnostics;

		private void button1_Click(object sender, System.EventArgs e)
		{
			//	Set the UltraMonthViewSingle control up to separate owners
			this.ultraMonthViewSingle1.OwnerDisplayStyle = OwnerDisplayStyle.Separate;
			this.ultraMonthViewSingle1.ActiveOwner = this.ultraCalendarInfo1.Owners.UnassignedOwner;
			this.ultraMonthViewSingle1.CalendarLook.ViewStyle = ViewStyle.Office2007;

			//	Reserve the color schemes which correspond to the Office2007 color schemes
			Outlook2007ColorSchemeCollection colorSchemes = this.ultraCalendarLook1.Outlook2007ColorSchemes;
			this.ultraMonthViewSingle1.CalendarLook.Outlook2007ColorSchemes.DisallowAutoAssignment( colorSchemes.BaseColorBlue );
			this.ultraMonthViewSingle1.CalendarLook.Outlook2007ColorSchemes.DisallowAutoAssignment( colorSchemes.BaseColorBlack );
			this.ultraMonthViewSingle1.CalendarLook.Outlook2007ColorSchemes.DisallowAutoAssignment( colorSchemes.BaseColorSilver );

			//	Create a new instance of the Outlook2007ColorSchemeDropDown
			//	(see code sample included with the Outlook2007ColorScheme class help topic) 
			Outlook2007ColorSchemeDropDown dropDown = new Outlook2007ColorSchemeDropDown( this, this.ultraCalendarLook1 );

			//	Hook the SelectionChangeCommitted event
			dropDown.SelectionChangeCommitted += new EventHandler( this.Outlook2007ColorSchemeDropDown_SelectionChangeCommitted );
		}

		private void Outlook2007ColorSchemeDropDown_SelectionChangeCommitted( object sender, EventArgs e )
		{
			Outlook2007ColorSchemeDropDown dropDown = sender as Outlook2007ColorSchemeDropDown;
			if ( this.ultraMonthViewSingle1.ActiveOwner != null )
			{
				//	Get a reference to the Outlook2007ColorScheme that was selected by the end user.
				Outlook2007ColorScheme selectedColorScheme = dropDown.SelectedColorScheme;
				UltraCalendarLook calendarLook = dropDown.CalendarLook;
				Outlook2007ColorSchemeCollection colorSchemes = calendarLook.Outlook2007ColorSchemes;

				//	If the color scheme is reserved, and not assigned to this owner, prompt the end user
				DialogResult result = DialogResult.Yes;
				if ( colorSchemes.IsAvailableForAutoAssignment(selectedColorScheme.BaseColor) == false )
				{
					Outlook2007ColorScheme currentlyAssignedScheme = this.ultraMonthViewSingle1.ActiveOwner.Outlook2007ColorScheme;
					if ( currentlyAssignedScheme != null &&
						 currentlyAssignedScheme.BaseColor != selectedColorScheme.BaseColor )
						result = MessageBox.Show( this, "The color scheme you selected is currently reserved. Do you want to assign it anyway?", "Assign Color Scheme", MessageBoxButtons.YesNo );
				}

				//	Assign the color scheme to the Owner's Outlook2007ColorScheme property,
				//	and mark it as unavailable
				if ( result == DialogResult.Yes )
					this.ultraMonthViewSingle1.ActiveOwner.Outlook2007ColorScheme = selectedColorScheme;
			}
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also