NavigationEventHandler Delegate

Definition

Represents the method that will handle navigation events in IIS Manager.

public delegate void NavigationEventHandler(System::Object ^ sender, NavigationEventArgs ^ e);
public delegate void NavigationEventHandler(object sender, NavigationEventArgs e);
type NavigationEventHandler = delegate of obj * NavigationEventArgs -> unit
Public Delegate Sub NavigationEventHandler(sender As Object, e As NavigationEventArgs)

Parameters

sender
Object

The source of the event.

e
NavigationEventArgs

A NavigationEventArgs that contains the event data.

Examples

The following example adds the custom navigation event handler OnNavigationServiceNavigationPerformed.

public MRUTaskList(IServiceProvider serviceProvider) {

    _serviceProvider = serviceProvider;

    INavigationService navigationService =
        (INavigationService)_serviceProvider.GetService(
        typeof(INavigationService));
    navigationService.NavigationPerformed +=
        new NavigationEventHandler(
        OnNavigationServiceNavigationPerformed);

    // Make sure we have enough buckets for path 
    // types and initialize them.

    Array configurationPathTypes =
        Enum.GetValues(typeof(ConfigurationPathType));
    _features = new MRUList<MRUPageInfo>[
        configurationPathTypes.Length];
    for (int i = 0; i < _features.Length; i++) {
        _features[i] = new MRUList<MRUPageInfo>(MAX_COUNT);
    }

    LoadPreferences();
}

private void OnNavigationServiceNavigationPerformed(
    object sender, NavigationEventArgs e) {
    NavigationItem item = e.NewItem;
    if (e.IsNew && (item != null) &&
        (item.PageType != null)) {
        // Ignore Home page navigations
        if (String.Equals(item.PageType.Name, "Homepage",
            StringComparison.OrdinalIgnoreCase)) {
            return;
        }

        MRUList<MRUPageInfo> features =
            _features[(int)item.ConfigurationPath.PathType];
        features.Add(new MRUPageInfo(
            item.PageType.AssemblyQualifiedName));
    }
} 

Remarks

The NavigationEventHandler delegate enables custom modules to take action when navigation occurs.

When you create a NavigationEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see Events and Delegates.

Applies to