Added a set of interfaces implementing async methods in a plain enough way to support coroutines, RPC and P/Invokes; updated copyright statement for the year 2017

git-svn-id: file:///srv/devel/repo-conversion/nusu@329 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2017-01-21 21:33:55 +00:00
parent 6053f5a877
commit fdf4442163
133 changed files with 789 additions and 459 deletions

View file

@ -0,0 +1,69 @@
#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2017 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#endregion
using System;
namespace Nuclex.Support.Async {
/// <summary>Provides the status of an <see cref="IAsyncTask" /></summary>
public class AsyncStatusEventArgs : EventArgs {
/// <summary>Reusable container that communicates that a task wasn't run</summary>
public static readonly AsyncStatusEventArgs NotStarted = new AsyncStatusEventArgs(
AsyncStatus.NotStarted
);
/// <summary>Reusable container that communicates that a task is running</summary>
public static readonly AsyncStatusEventArgs Running = new AsyncStatusEventArgs(
AsyncStatus.Running
);
/// <summary>Reusable container that communicates success</summary>
public static readonly AsyncStatusEventArgs Success = new AsyncStatusEventArgs(
AsyncStatus.Succeeded
);
/// <summary>Reusable container that communicates a failure</summary>
public static readonly AsyncStatusEventArgs Failure = new AsyncStatusEventArgs(
AsyncStatus.Failed
);
/// <summary>Reusable container that communicates a cancellation</summary>
public static readonly AsyncStatusEventArgs Cancel = new AsyncStatusEventArgs(
AsyncStatus.Cancelled
);
/// <summary>Initializes a new <see cref="IAsyncTask" /> outcome container</summary>
/// <param name="status">Outcome the container will provide</param>
public AsyncStatusEventArgs(AsyncStatus status) {
this.status = status;
}
/// <summary>The status of the <see cref="IAsyncTask" /></summary>
public AsyncStatus Status {
get { return this.status; }
}
/// <summary><see cref="IAsyncTask" /> status stored by the container</summary>
private AsyncStatus status;
}
} // namespace Nuclex.Support.Async