packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Shell/CommonFileDialogs/CommonFileDialogControlCollection.cs
/// <summary>
/// Inserts an dialog control at the specified index.
/// </summary>
/// <param name="index">The location to insert the control.</param>
/// <param name="control">The item to insert.</param>
/// <permission cref="System.InvalidOperationException">A control with 
/// the same name already exists in this collection -or- 
/// the control is being hosted by another dialog -or- the associated dialog is 
/// showing and cannot be modified.</permission>
Inserts an dialog control at the specified index.
Inserts an dialog control at the specified index .
protected override void InsertItem(int index, T control)
        {
            if (Items.Contains(control))
            {
                throw new InvalidOperationException(
                    LocalizedMessages.DialogControlCollectionMoreThanOneControl);
            }
            if (control.HostingDialog != null)
            {
                throw new InvalidOperationException(
                    LocalizedMessages.DialogControlCollectionRemoveControlFirst);
            }
            if (!hostingDialog.IsCollectionChangeAllowed())
            {
                throw new InvalidOperationException(
                    LocalizedMessages.DialogControlCollectionModifyingControls);
            }
            if (control is CommonFileDialogMenuItem)
            {
                throw new InvalidOperationException(
                    LocalizedMessages.DialogControlCollectionMenuItemControlsCannotBeAdded);
            }
            control.HostingDialog = hostingDialog;
            base.InsertItem(index, control);
            hostingDialog.ApplyCollectionChanged();
        }
protected override void InsertItem ( int index , T control ) { if ( Items . Contains ( control ) ) { throw new InvalidOperationException ( LocalizedMessages . DialogControlCollectionMoreThanOneControl ) ; } if ( control . HostingDialog != null ) { throw new InvalidOperationException ( LocalizedMessages . DialogControlCollectionRemoveControlFirst ) ; } if ( ! hostingDialog . IsCollectionChangeAllowed ( ) ) { throw new InvalidOperationException ( LocalizedMessages . DialogControlCollectionModifyingControls ) ; } if ( control is CommonFileDialogMenuItem ) { throw new InvalidOperationException ( LocalizedMessages . DialogControlCollectionMenuItemControlsCannotBeAdded ) ; } control . HostingDialog = hostingDialog ; base . InsertItem ( index , control ) ; hostingDialog . ApplyCollectionChanged ( ) ; }
Inserts an dialog control at the specified index.
Inserts an dialog control at the specified index .
// Check for duplicates, lack of host,  // and during-show adds. // Reparent, add control. // Notify that we've added a control.
index
int
The location to insert the control.
The location to insert the control .
control
T
The item to insert.
The item to insert .
permission
A control with
the same name already exists in this collection -or
the control is being hosted by another dialog -or- the associated dialog is
showing and cannot be modified.
A control with the same name already exists in this collection - or the control is being hosted by another dialog - or - the associated dialog is showing and cannot be modified .