SolutionServer
ReferencesThis class provides all methods and properties concerning past document solutions and how to start new ones.
Constructors
Fields
_triggerViewportUpdatesOnCompletedSolution
#[EditorBrowsable(EditorBrowsableState.Never)]
public static bool _triggerViewportUpdatesOnCompletedSolution
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.
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:
- 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.
Parameters:
| obj (IDocumentObject) | Object to expire. |
Start
#public Task<Solution> Start(CancellationTokenSource source, SolutionMode mode = SolutionMode.Regular)
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.
Parameters:
| source (CancellationTokenSource) | Optional existing cancellation source. |
| mode (SolutionMode = SolutionMode.Regular) | Solutution mode. |
Returns: 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.
Parameters:
| mode (SolutionMode = SolutionMode.Regular) | Solutution mode. |
Returns: 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.
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.
Parameters:
| source (CancellationTokenSource) | |
| mode (SolutionMode = SolutionMode.Regular) |
Stop
#public void 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.
Events
EnabledChanged
#Raised whenever the EnableSolutions property changes. The sender and arguments are always null, given that this is a static event.
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.
SolutionCancelled
#The SolutionCancelled event is raised when a solution is aborted. This event will always be followed by the SolutionStopped event.
SolutionCompleted
#The SolutionCompleted event is raised when a solution completes successfully. This event will always be followed by the SolutionStopped event.
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.
SolutionStopped
#The SolutionStopped event is raised whenever a solution terminates. Whenever there is a SolutionStarted event there will always be a matching solutionStopped event.