Language - C Sharp Windows Mono: Difference between revisions

From Phidgets Support
No edit summary
(Redirected page to Language - C Sharp)
 
Line 1: Line 1:
[[Category:Language]]{{NoTitle}}
#REDIRECT [[Language - C Sharp]]
{|
|style="vertical-align:middle; width: 60%;"|
<font size=6>'''Language - C#'''
 
'''Windows with Mono'''</font>
 
Welcome to using Phidgets with C#! By using C#, you will have access to the complete Phidget22 API, including events.
 
Mono is an open-source programming environment that aims to make Microsoft .NET applications available across all operating systems.
|{{TOC limit|2}}
|}
 
{{Language_-_C_Sharp_Intro|Windows|Mono}}
*You will also need to install [https://www.mono-project.com/download/stable/ Mono] on your machine
 
{{Finding Code Samples|C#|CSharp}}
 
==Using the Code Samples==
To use the code sample from the [{{server}}/?view=code_samples&lang=CSharp Code Samples] page, you can click the '''Download Example''' button to download a CS file with the sample code.
 
[[Image:CSharp_Sample_Code_Download.png|link=|center|800px]]
 
 
Once you have the example, you can compile and run your code:
 
==Setting up a New Project==
 
When you are building a project from scratch, or adding Phidget functionality to an existing project, you'll need to configure your development environment to properly link the Phidget .NET library.
 
The easiest way to allow Mono to access the Phidgets .NET library is to place a copy of ''Phidget22.NET.dll'' from the following location in the same folder as your program:
*'''C:\Program Files\Phidgets\Phidget22\Phidget22.NET.dll'''
 
Your folder should look somehting like this:
[[Image:CSharp_mono_folder_new_project.png|link= | center]]
 
==Compile and Run==
Once you are ready to run your program, open the ''Command Prompt'' and navigate to your project folder. Next, enter the following command:
<syntaxhighlight lang='bash'>
mcs /r:Phidget22.NET.dll Program.cs
</syntaxhighlight>
 
This will create an executable file called ''Program.exe''. Type in the following command to run the example:
<syntaxhighlight lang='bash'>
mono Program.exe
</syntaxhighlight>
 
[[Image:CSharp_Windows_Mono_Run_Example.png|link=|center]]
 
Success! The project is now using Phidgets.
 
{{Language Page What's Next}}

Latest revision as of 16:34, 15 March 2021

Redirect to: