File: src\Framework\System\Windows\Navigation\NavigationFailedEventArgs.cs
Project: wpf\PresentationFramework.csproj (PresentationFramework)
//-------------------------------------------------------------------------------------------------
// File: NavigationFailedCancelEventArgs.cs
//
// Copyright (C) 2004 by Microsoft Corporation.  All rights reserved.
// 
// Description:
//              This event is fired when an error is encountered during a navigation.
//              The NavigationFailedEventArgs contains the error status code and 
//              the exception that was thrown. By default Handled property is set to false, 
//              which allows the exception to be rethrown. 
//              The event handler can prevent exception from throwing
//              to the user by setting the Handled property to true
//
//              This event is fired on navigation container and refired on the NavigationApplication
//
// History:
//  06/10/06: Microsoft   Created
//
//-------------------------------------------------------------------------------------------------
 
using System.ComponentModel;
using System.Net;
 
namespace System.Windows.Navigation
{
    /// <summary>
    /// Event args for NavigationFailed event
    /// The NavigationFailedEventArgs contains the exception that was thrown.
    /// By default Handled property is set to false.
    /// The event handler can prevent the exception from being throwing to the user by setting 
    /// the Handled property to true
    /// </summary>
    public class NavigationFailedEventArgs : EventArgs
    {
        // Internal constructor        
        internal NavigationFailedEventArgs(Uri uri, Object extraData, Object navigator, WebRequest request, WebResponse response, Exception e)
        {
            _uri = uri;
            _extraData = extraData;
            _navigator = navigator;
            _request = request;
            _response = response;
            _exception = e;
        }
 
        /// <summary>
        /// URI of the markup page to navigate to.
        /// </summary>
        public Uri Uri
        {
            get
            {
                return _uri;
            }
        }       
 
        /// <summary>
        /// Exposes extra data object which was optionally passed as a parameter to Navigate.
        /// </summary>
        public Object ExtraData
        {
            get
            {
                return _extraData;
            }
        }
 
        /// <summary>
        /// The navigator that raised this event
        /// </summary>
        public object Navigator
        {
            get
            {
                return _navigator;
            }
        }
 
        /// <summary>
        /// Exposes the WebRequest used to retrieve content.
        /// </summary>
        public WebRequest WebRequest
        {
            get
            {
                return _request;
            }
        }
 
        /// <summary>
        /// Exposes the WebResponse used to retrieve content.
        /// </summary>
        public WebResponse WebResponse
        {
            get
            {
                return _response;
            }
        }
 
        /// <summary>
        /// Exception that was thrown during the navigation
        /// </summary>
        public Exception Exception
        {
            get 
            { 
                return _exception; 
            }
        }
 
        /// <summary>
        /// Returns a boolean flag indicating if or not this event has been handled.
        /// </summary>
        public bool Handled
        {
            get
            {
                return _handled;
            }
            set
            {
                _handled = value;
            }
        }
 
        Uri _uri;
        Object _extraData;
        Object _navigator;
        WebRequest _request;
        WebResponse _response;
        Exception _exception;
        bool _handled = false;
    }
}