Base interface that can be run via the RunningOperation class.
interface
|
IOperation
|
extends
|
IConfigurable
|
||
IDisposable
|
|||||
IOperationOps
|
|||||
IValidatable
|
|||||
base of
|
Operation
|
A class that implements the IOperation interface performs a lengthy task. Typically, this task will be executed in a background thread. Running background operations are represented by instances of the RunningOperation class.
A running background operation provides its current progress via an IProgressMonitor object that has been passed to its Run method.
When a background operation is executed, the following tasks are performed:
Run
method
is
called
and
the
operation
performs
the
actual
work,
providing
the
its
current
progress
using
the
given
IProgressMonitor
object.
See also:
IProgressMonitorReturns the lifecycle state of this object.
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
ILifecycleState.LifecycleState
|
Returns the human-readable name of this background operation.
property
|
Name
{
get
}
|
||
type
|
string
|
||
value
|
|
The name. |
Shall the background operation cancel?
property
|
ShallCancel
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
the
operation
shall
cancel,
false
if
not. |
Remarks:
Once
Cancel
has
been
called,
this
property
will
return
true
.
The weight of this operation.
property
|
Weight
{
get
}
|
||
type
|
int32
|
||
value
|
|
The weight of this operation. |
Remarks:
This value is only used for reporting progress when combining multiple operations.
Acquires a strong reference to this disposable object.
[OwnerReturn, ThreadSafe]
|
||||
method
|
AcquireTry
()
|
|||
type
|
IDisposable
|
|||
returns
|
this
if
a
new
strong
reference
has
been
acquired,
null
if
this
object
is
already
being
disposed.
|
|||
inherited
|
IDisposable.AcquireTry
|
Remarks:
The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Returns an IOperation object that simultaneously executes this operation and the given one.
[OwnerReturn, OwnerThis]
|
||||
method
|
And
([Owner]
IOperation operation)
|
|||
type
|
IOperation
|
|||
params
|
operation
|
[not-null]
|
The other operation. | |
returns
|
|
The resulting IOperation object. | ||
inherited
|
IOperationOps.And
|
Requests that the running background operation gracefully terminates.
method
|
Cancel
()
|
Remarks:
An IOperation is free to honor a cancel request or to ignore it. Cancelling a background operation should be considered as a hint to terminate as soon as possible.
Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.
[Dispose, OwnerThis, ThreadSafe]
|
||||
method
|
Dispose
()
|
|||
inherited
|
IDisposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
Runs the operation.
method
|
Run
(IProgressMonitor progress)
|
||
params
|
progress
|
[not-null]
|
The progress monitor object to use. |
Returns an IOperation object that executes this operation, followed by the given operation.
[OwnerReturn, OwnerThis]
|
||||
method
|
Then
([Owner]
IOperation operation)
|
|||
type
|
IOperation
|
|||
params
|
operation
|
[not-null]
|
The other operation. | |
returns
|
|
The resulting IOperation object. | ||
inherited
|
IOperationOps.Then
|
Returns the configuration value that describes this object.
method
|
ToConfig
()
|
||
type
|
ConfigValue
|
||
returns
|
|
The configuration value. | |
inherited
|
IConfigurable.ToConfig
|
Remarks:
All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.
The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.
Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.
Validates the state of this object.
method
|
Validate
(Validator validator)
|
||
params
|
validator
|
[not-null]
|
The validator object. |
inherited
|
IValidatable.Validate
|
Runs the operation in a new background thread.
[OwnerReturn, OwnerThis]
|
||||
method
|
RunBackground
()
|
|||
type
|
RunningOperation
|
|||
returns
|
|
The RunningOperation object that represents the running background operation. |
Runs the operation in a new background thread blocks the calling thread until it has finished, while displaying a simple progress indicator in the console.
[OwnerThis]
|
||||
method
|
RunTerminal
()
|
|||
type
|
TinmanError
|
|||
returns
|
The
error
if
the
background
operation
has
failed,
null
if
it
has
finished
successfully.
|
Remarks:
This method is intended to be used for testing.