Class Job
Main class dealing with a file job
Inheritance
Inherited Members
Namespace: DuetControlServer.FileExecution
Assembly: DuetControlServer.dll
Syntax
public static class Job
Remarks
Lock this class whenever it is accessed (except for Diagnostics(StringBuilder))
Properties
FileLength
Returns the length of the file being printed in bytes
Declaration
public static long FileLength { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
IsAborted
Indicates if the file print has been aborted
Declaration
public static bool IsAborted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsCancelled
Indicates if the file print has been cancelled
Declaration
public static bool IsCancelled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsFileSelected
Indicates if a file has been selected for printing
Declaration
public static bool IsFileSelected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsPaused
Indicates if the file print has been paused
Declaration
public static bool IsPaused { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsProcessing
Indicates if a print is live
Declaration
public static bool IsProcessing { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsSimulating
Indicates if a file is being simulated
Declaration
public static bool IsSimulating { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This is volatile to allow fast access without locking the class first
Methods
Abort()
Abort the current print asynchronously. This is called when the print could not complete as expected
Declaration
public static void Abort()
AbortAsync()
Abort the current print asynchronously. This is called when the print could not complete as expected
Declaration
public static async Task AbortAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Asynchronous task |
Cancel()
Cancel the current print (e.g. when M0/M1 is called)
Declaration
public static void Cancel()
CancelAsync()
Cancel the current print (e.g. when M0/M1 is called)
Declaration
public static async Task CancelAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Asynchronous task |
Diagnostics(StringBuilder)
Print diagnostics of this class
Declaration
public static async Task Diagnostics(StringBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
System.Text.StringBuilder | builder | String builder |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Asynchronous task |
GetFilePosition()
Get the current file position
Declaration
public static async Task<long> GetFilePosition()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int64> | File position |
Lock()
Lock this class
Declaration
public static IDisposable Lock()
Returns
Type | Description |
---|---|
System.IDisposable | Disposable lock |
LockAsync()
Lock this class asynchronously
Declaration
public static Task<IDisposable> LockAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.IDisposable> | Disposable lock |
Pause(Nullable<Int64>, PrintPausedReason)
Called when the print is being paused
Declaration
public static void Pause(long? filePosition, PrintPausedReason pauseReason)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int64> | filePosition | File position where the print was paused |
PrintPausedReason | pauseReason | Reason why the print has been paused |
Resume()
Resume a file print
Declaration
public static void Resume()
Run()
Perform actual print jobs
Declaration
public static async Task Run()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SelectFile(String, Boolean)
Start a new file print
Declaration
public static async Task SelectFile(string fileName, bool simulating = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | File to print |
System.Boolean | simulating | Whether the file is being simulated |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Asynchronous task |
Remarks
This class has to be locked when this method is called
SetFilePosition(Int64)
Set the current file position
Declaration
public static async Task SetFilePosition(long filePosition)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | filePosition | New file position |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | File position |