Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// An IAsyncResult to be used with INavigationContentLoaders
- /// </summary>
- public class NavigationAsyncResult : IAsyncResult
- {
- /// <summary>
- /// The content of the navigation.
- /// This will be created by BeginLoad and returned by EndLoad
- /// </summary>
- public object Content { get; set; }
- /// <summary>
- /// Keeps track of whether or not this operation has been cancelled.
- /// </summary>
- public bool Cancelled { get; set; }
- /// <summary>
- /// Marks this Async operation as complete
- /// </summary>
- public void Complete()
- {
- IsCompleted = true;
- (AsyncWaitHandle as AutoResetEvent).Set();
- }
- /// <summary>
- /// Tracks an Exception that may have occured during processing.
- /// </summary>
- public Exception Error { get; set; }
- /// <summary>
- /// Creates a new NavigationAsyncResult
- /// </summary>
- /// <param name="asyncState">A user-defined object that qualifies or contains information about an asynchronous operation.</param>
- public NavigationAsyncResult(object asyncState)
- {
- AsyncState = asyncState;
- AsyncWaitHandle = new AutoResetEvent(false);
- CompletedSynchronously = false;
- IsCompleted = false;
- Cancelled = false;
- }
- #region IAsyncResult Members
- /// <summary>
- /// Gets a user-defined object that qualifies or contains information about an asynchronous operation.
- /// </summary>
- public object AsyncState { get; private set; }
- /// <summary>
- /// A wait handle that is used to wait for an asynchronous operation to complete.
- /// </summary>
- public WaitHandle AsyncWaitHandle { get; private set; }
- /// <summary>
- /// Gets a value that indicates whether the asynchronous operation completed synchronously.
- /// </summary>
- public bool CompletedSynchronously { get; set; }
- /// <summary>
- /// Gets a value that indicates whether the asynchronous operation has completed.
- /// </summary>
- public bool IsCompleted { get; private set; }
- #endregion
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement