SolutionServer

References
public class SolutionServer
This class provides all methods and properties concerning past document solutions and how to start new ones.

Constructors

SolutionServer

#
Create a new Solution instance.
public SolutionServer(
document
Owner document.
)

Fields

_triggerViewportUpdatesOnCompletedSolution

#
[EditorBrowsable(EditorBrowsableState.Never)] public static bool _triggerViewportUpdatesOnCompletedSolution

MaximumHistoryCount

#
Gets the maximum number of solution history records that will be kept. This field is constant and set to 10000 or thereabouts.
public const int MaximumHistoryCount = 8192

Properties

EnableSolutions

#
Gets or sets whether solutions are allowed. Setting this will neither abort nor trigger any solutions, that is the responsibility of the caller.
public static bool EnableSolutions { get; set; }

State

#
Gets the state of this server.
public ServerState State { get; }

Methods

DelayedExpire

#
Call this method if you want the document to expire your object and start a new solution some time in the near future. This method is good for objects which tend to generate frequent expiration waves due to (typically) UI events such as mouse-moves or key-presses. This method does one of three things:

  1. If no solution is currently running, it expires the object immediately and starts a new solution.

2. If another solution has only just started a short while ago, it will allow that solution to continue. The object will be expired and a new solution will be started once the current solution completes.

3. If another solution is running and has been running for a while, it will be cancelled. The object will be expired and a new solution will be started immediately.

public void DelayedExpire(
obj
Object to expire.
)

Start

#
Start a new document solution. If another solution is currently running on the same document, that solution will be cancelled. This method returns as soon as objects are beginning to solve, ie. when the Phase is set to Running. You should use this overload if this solution runs as part of another solution on a different document. Be sure to share the Solution.Source of that containing solution, so that cancellation may be synchronised.
public Task<Solution> Start(
source,
Optional existing cancellation source.
mode = SolutionMode.Regular
Solutution mode.
)
Task object running the solution or a cancelled task if no solution could be started.

Start

#
Start a new document solution. If another solution is currently running, that solution will be cancelled. Although not _immediately_, this method returns as soon as objects are beginning to solve, ie. when the Phase is set to Running.
public Task<Solution> Start(
mode = SolutionMode.Regular
Solutution mode.
)
Task object running the solution or null if there is no solution actually running.

StartWait

#
Start a new solution and solve it on the calling thread. You should never call this function while on the UI thread.
public Solution StartWait()

StartWait

#
Start a new solution and solve it on the calling thread. You should never call this function while on the UI thread. You should use this overload if this solution runs as part of another solution on a different document. Be sure to share the Solution.Source of that containing solution, so that cancellation may be synchronised.
public Solution StartWait()

Stop

#
Attempt to abort the current solution. This happens automatically if a new solution is started. If no solution is currently running, nothing will happen.
public void Stop()

Events

EnabledChanged

#
Raised whenever the EnableSolutions property changes. The sender and arguments are always null, given that this is a static event.
public static event EventHandler EnabledChanged

SolutionAboutToStart

#
The SolutionAboutToStart event is raised before a new solution kicks off. If you want to expire objects prior to a solution, you must do so from within this event.
public event EventHandler<SolutionIdEventArgs> SolutionAboutToStart

SolutionCancelled

#
The SolutionCancelled event is raised when a solution is aborted. This event will always be followed by the SolutionStopped event.
public event EventHandler<SolutionEventArgs> SolutionCancelled

SolutionCompleted

#
The SolutionCompleted event is raised when a solution completes successfully. This event will always be followed by the SolutionStopped event.
public event EventHandler<SolutionEventArgs> SolutionCompleted

SolutionFaulted

#
The SolutionException event is raised when a solution is terminated by an unhandled exception. This event will always be followed by the SolutionCancelled and SolutionStopped events.
public event EventHandler<SolutionExceptionEventArgs> SolutionFaulted

SolutionStarted

#
The SolutionStarted event is raised whenever a new solution starts.
public event EventHandler<SolutionEventArgs> SolutionStarted

SolutionStopped

#
The SolutionStopped event is raised whenever a solution terminates. Whenever there is a SolutionStarted event there will always be a matching solutionStopped event.
public event EventHandler<SolutionEventArgs> SolutionStopped