|
|
|
|
|
- Overview
- Integrating a .NET assembly in a WINDEV or WEBDEV project
- Using elements of the .NET assembly
- Limitations
- Incompatibility between the IE ActiveX (and oAuth2) and the use of .NET assembly
- Using standard .NET Framework 4 assemblies (and below)
- Using standard .NET Framework 4 assemblies (and below)
- Using standard assemblies of .NET 5 SDK
- Using a .NET assembly created with WINDEV
- List of .Net assemblies used in the project
- Reloading the .NET assemblies
Using .NET assemblies in a project
.NET technology is Microsoft's software development platform. This .NET platform simplifies the development of distributed object applications whose modules communicate via the Internet. This help globally explains how to use the .NET technology in WINDEV, WINDEV Mobile and WEBDEV. For more details, see a specific documentation. Integrating a .NET assembly in a WINDEV or WEBDEV project To integrate .NET assemblies into the current project: - On the "Project" tab, in the "Project" group, expand "Import" and select "A .NET assembly".
- In the window that appears, select the .NET assemblies to be integrated into the current project.
- A "Search" area allows you to easily find the desired assembly.
- The "Select from disk" button allows you to select an assembly that does not appear in the list. The assembly selected via the "Select from disk" button is automatically selected and appears at the top of the list.
- The "Fill list automatically" button searches for all assemblies available on the computer.
- If necessary, specify the targeted .NET framework. The list shows the different Microsoft versions. The "Automatic" option is selected by default.
Remark: The list of assemblies may vary depending on the targeted .Net framework.
- Validate. The selected assemblies are imported.
Using a .NET assembly is equivalent to using a class in WLanguage. Reminder: The classes are visible in the "Project explorer" pane. The .NET classes are grouped by "Namespace". Using elements of the .NET assembly The following elements imported into the .NET assembly can be handled in WLanguage: - Delegates: the delegates can be handled by DotNetDelegate.
You also have the ability to add a delegate with the += operator:clDotNet is ClassEventManagement // Branch the event clDotNet:m_LogHandler += Proc_Test // ... // Triggers the event clDotNet:SendAMessage("String sent")
//------------------------------------------------- // Manage the event PROCEDURE Proc_Test(src, args) Info("The string passed as parameter via the delegate is " + args:get_Message())
- NestedType with more than 1 level
- Reference
- Properties
- Array with more than 1 dimension
- Structures.
- Enums.
You have the ability to combine the Enum coming from .Net assemblies via &, | , ||, ~ . You have the ability to convert the enums into integers or to build them from integers. - Internal classes: the following syntax must be used:
<Object name> is "<Class name>" The syntax without quotes is also available:
<Object name> is <Class name> Example:
O is "ExternalClass.InternalClass"
O is ExternalClass.InternalClass
- Generic:
The following syntax is used to instantiate a generic:<Object name> is "<Generic name><<Concrete type>>" Example for instantiating a generic: MyList is "List<CMyObject>"
- Generic methods:
The following syntax is used to call a generic method:<Object name>."<Name of generic method><<Concrete type>>"(<parameters>) Example for calling a generic method: // Prototype of the generic CloneList method of CClone class // CloneList(List<T>) // ... MyList is "List<int>" // ... clClone is CClone MyListCopy is "List<int>" <- clClone."CloneList<int>"(MyList)
- Extension methods:
The extension methods can be called like the methods of the object.
When possible, the WLanguage types are implicitly converted into .Net types. Example: clDotNetString is "String" dynamic sWLString is string = "string" clDotNetString = sWLString
Limitations - A WLanguage class cannot be derived from a .NET class.
- The following types are supported:
- Date/Time
- WINDEV currencies. In output, the WINDEV currencies are converted into decimal numbers.
- Decimal numbers
A decimal parameter passed from a .NET assembly to a WLanguage function is converted into currency if possible. If this conversion is not possible, the parameter is converted into double. - Structures
- The objects derived in .NET from an exported WLanguage class are not supported. If an object of this type is passed to a WLanguage function as parameter, it is "casted" into the base WLanguage type.
- Passing pointer parameters between WLanguage and .NET is not supported.
- The "structure" members found in classes and/or in sets are not visible in .NET because the WLanguage structures are not visible in .NET. To fix this problem, create a class containing the code of the structure.
- The "class" members found in classes and/or in sets are visible in .NET only if the class is exported as well.
- Caution: Components created with version 11 (or earlier) that use .NET will no longer work with version SaaS. It is necessary to generate the components again with version SaaS.
Using standard .NET Framework 4 assemblies (and below) Using standard .NET Framework 4 assemblies (and below) To use standard .NET Framework 4 assemblies (and below): - Select the ".NET assemblies" folder in the "Project Explorer" pane.
- Open the context menu and select "Use a .NET assembly".
- In the window that appears, click "Automatically complete a list with the .NET assemblies on your disk.
Caution: This process may take quite a long time.".
- Select the standard assemblies to use (mscorlib.dll or another assembly).
- Validate.
Using standard assemblies of .NET 5 SDK To use standard assemblies of .NET 5 SDK: - Select the ".NET assemblies" folder in the "Project Explorer" pane.
- Open the context menu and select "Use a .NET assembly".
- In the window that appears, click "Select the .NET assemblies on disk....".
- Select the installation directory of the .NET 5 SDK. For example:
"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0". - Select the standard assemblies to use (System.Runtime.dll or another assembly).
Caution, this directory contains the mscorlib.dll file. This file must not be selected if the .NET 5 SDK is used. - Validate.
Using a .NET assembly created with WINDEV The assemblies generated by WINDEV can be used like any other .NET assembly. However, the WINDEV framework and the assembly must be found in the same directory. List of .Net assemblies used in the project To display the list of .Net assemblies used in the project, you can: - On the "Project" tab, in the "Project" group, expand "List of elements" and select "List of .NET assemblies used".
- In the "Project explorer" pane, select "List of .NET assemblies used in the project" in the context menu of ".NET assemblies".
Reloading the .NET assemblies You can reload the .NET assemblies used in the project to take into account a change made to an assembly since the project was opened. - In the "Project explorer" pane, select ".NET assemblies".
- In the context menu of this element, select "Reload .NET assemblies".
Related Examples:
|
Training (WINDEV): WD Text-To-Speech
[ + ] This example explains how to perform a speech synthesis in a WINDEV application by using the SpeechSynthesizer class found in the .NET framework. Note: - This example requires .Net version 3.0 (or later), - The speech synthesizer is available in English version by default.
|
|
Training (WINDEV): WD Using DotNET classes
[ + ] This example enables you to use the .NET classes in WLanguage In this example, we will be using: - the String class that is used to handle the character strings (switch to lowercase/uppercase characters, count the number of characters, ...). - the MessageBox class that is used to create custom dialog boxes (ability to choose the text, the icon and the buttons). These two classes come from the mscorlib.dll and System.Windows.Form.dll assemblies. - a .NET control used to view the Web pages. Summary of the example supplied with WINDEV: This example is used to: - analyze a character string (number of characters, number of words, replacement of characters, ...) - configure the dialog boxes (buttons, icon, text). The name of the button selected by the user is automatically displayed. - use a .NET control in order to view the Web pages.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|