
13. Using Yocto-RangeFinder with C#
C# (pronounced C-Sharp) is an object-oriented programming language promoted by Microsoft, it is
somewhat similar to Java. Like Visual-Basic and Delphi, it allows you to create Windows applications
quite easily. All the examples and the project models are tested with Microsoft C# 2010 Express,
freely available on the Microsoft web site
1
.
13.1. Installation
Download the Visual C# Yoctopuce library from the Yoctopuce web site
2
. There is no setup program,
simply copy the content of the zip file into the directory of your choice. You mostly need the content
of the
Sources
directory. The other directories contain the documentation and a few sample
programs. All sample projects are Visual C# 2010, projects, if you are using a previous version, you
may have to recreate the projects structure from scratch.
13.2. Using the Yoctopuce API in a Visual C# project
The Visual C#.NET Yoctopuce library is composed of a DLL and of source files in Visual C#. The
DLL is not a .NET DLL, but a classic DLL, written in C, which manages the low level communications
with the modules
3
. The source files in Visual C# manage the high level part of the API. Therefore,
your need both this DLL and the .cs files of the
sources
directory to create a project managing
Yoctopuce modules.
Configuring a Visual C# project
The following indications are provided for Visual Studio Express 2010, but the process is similar for
other versions. Start by creating your project. Then, on the
Solution Explorer
panel, right click on your
project, and select "Add" and then "Add an existing item".
A file selection window opens. Select the
yocto_api.cs
file and the files corresponding to the
functions of the Yoctopuce modules that your project is going to manage. If in doubt, select all the
files.
You then have the choice between simply adding these files to your project, or to add them as links
(the
Add
button is in fact a scroll-down menu). In the first case, Visual Studio copies the selected
files into your project. In the second case, Visual Studio simply keeps a link on the original files. We
recommend you to use links, which makes updates of the library much easier.
1
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express
2
www.yoctopuce.com/EN/libraries.php
3
The sources of this DLL are available in the C++ API
www.yoctopuce.com
77
Содержание Yocto-RangeFinder
Страница 1: ...Yocto RangeFinder User s guide...
Страница 2: ......
Страница 18: ...12 www yoctopuce com...
Страница 26: ...20 www yoctopuce com...
Страница 42: ...36 www yoctopuce com...
Страница 70: ...gcc lyocto lm lpthread lusb 1 0 lstdc 10 Using Yocto RangeFinder with C 64 www yoctopuce com...
Страница 90: ...84 www yoctopuce com...
Страница 120: ...114 www yoctopuce com...
Страница 130: ...124 www yoctopuce com...
Страница 158: ...21 High level API Reference On failure throws an exception or returns a negative error code 152 www yoctopuce com...
Страница 484: ...478 www yoctopuce com...
Страница 488: ...482 www yoctopuce com...
Страница 490: ...23 Characteristics 484 www yoctopuce com...
Страница 491: ......
Страница 492: ......