Skip to content

Dracaltech/sample-csharp-cli

Repository files navigation

sample-csharp-cli

Dracal // SDK code sample for C# on CLI

Assumptions

Running this repository requires you to have installed:

  • .NET (version >= 8.0)
  • Visual Studio (version >= 2022)
  • DracalView (version >= 3.2.x)
    • Specifically, dracal-usb-get needs to be accessible from your PATH environment variable (more info in the documentation how-to).

Script may need to be adjusted depending on your instrument's # of outputs (currently assumed: 3 outputs). See script comments for details.

Simple usage

Run by

  • Using the Play button (Visual Studio)
  • Build and run using the command line:
dotnet run sample-csharp-cli.sln

Run mode

While the main code sample is in App.cs, you'll find an alternative version in AppRunMode.cs which allows for a continuous stream of measurement outputs.

To run it, you'll want to switch the Startup object:

  • Open the project's properties (right-click on sample-csharp-cli.csproj > Properties)
  • In Application > General, open the dropdown under Startup object and instead of App, select AppRunMode.

From there, you can use the same instructions as above ⤴️ to run it.

Sample output

Normal mode

Temperature (C): 99.39
RH......... (%): 21.5
Pressure. (kPa): 54.16
Temperature (F): 210.90201

C:\dev\dracal\sample-csharp-cli\bin\Debug\net8.0\sample-csharp-cli.exe (process 36996) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .

Run mode

2024-04-26 14:27:21:
Temperature (C): 100.44
RH......... (%): 22.56
Pressure. (kPa): 45.06
Temperature (F): 212.792

2024-04-26 14:27:22:
Temperature (C): 100.44
RH......... (%): 22.59
Pressure. (kPa): 45.08
Temperature (F): 212.792

C:\dev\dracal\sample-csharp-cli\bin\Debug\net8.0\sample-csharp-cli.exe (process 22780) exited with code -1073741510.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .

About

Dracal // SDK code sample for C# on CLI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages