Compiler.CompileAsync
method · Compiler · cAlgo.API Since 5.1
DesktopCLICloud
Compiles an algo asynchronously and calls the passed callback when compilation finishes.
Environment behaviour
Cloud — not supported. Nothing is compiled. Compile returns a failed result with no errors; CompileAsync calls back asynchronously with that failed result.
Overloads
| Signature |
|---|
CompileAsync(string csprojFilePath, Action<CompilationResult> callback) |
CompileAsync(string csprojFilePath, Action<CompilationResult> callback, CompilationOptions options) |
CompileAsync(string csprojFilePath, Action<CompilationResult> callback)
Compiles an algo asynchronously and calls the passed callback when compilation finishes.
CompilationOperation CompileAsync(string csprojFilePath, Action<CompilationResult> callback)
api.Compiler.CompileAsync(csprojFilePath: str, callback: Callable[[CompilationResult], None]) -> CompilationOperation
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
csprojFilePath | string | str | Algo project file path. |
callback | Action<CompilationResult> | Callable[[CompilationResult], None] | Callback that will be called after compilation finished. |
Returns CompilationOperation — CompilationOperation
Examples
var operation = Compiler.CompileAsync(@"Sample cBot\Sample cBot.csproj", result => Print("Compilation succeeded: {0}", result.Succeeded));
Print("Compilation is running: {0}", operation.IsExecuting);
operation = api.Compiler.CompileAsync(r"Sample cBot\Sample cBot.csproj", lambda result: api.Print(f"Compilation succeeded: {result.Succeeded}"))
api.Print(f"Compilation is running: {operation.IsExecuting}")
CompileAsync(string csprojFilePath, Action<CompilationResult> callback, CompilationOptions options)
Compiles an algo asynchronously and calls the passed callback when compilation finishes.
CompilationOperation CompileAsync(string csprojFilePath, Action<CompilationResult> callback, CompilationOptions options)
api.Compiler.CompileAsync(csprojFilePath: str, callback: Callable[[CompilationResult], None], options: CompilationOptions) -> CompilationOperation
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
csprojFilePath | string | str | Algo project file path. |
callback | Action<CompilationResult> | Callable[[CompilationResult], None] | Callback that will be called after compilation finished. |
options | CompilationOptions | CompilationOptions | Compilation options. |
Returns CompilationOperation — CompilationOperation
Examples
var options = new CompilationOptions { IncludeSourceCode = true };
Compiler.CompileAsync(@"Sample cBot\Sample cBot.csproj", result => Print("Compilation succeeded: {0}", result.Succeeded), options);
options = CompilationOptions()
options.IncludeSourceCode = True
api.Compiler.CompileAsync(r"Sample cBot\Sample cBot.csproj", lambda result: api.Print(f"Compilation succeeded: {result.Succeeded}"), options)