Linguaggio .NET
La versione Windows di Nios4 permette l'integrazione con dei componenti esterni sviluppati utilizzando il Framework.NET di Microsoft. E' possibile in questo modo implementare ulteriormente il programma.
E' possibile creare del componenti per le seguenti parti del programma:
Sezioni
Report
Pannelli scheda
Tool
Invio Mail
Nella pagina download è possibile trovare i template in linguaggio vb.NET per impostare un progetto di base
Creazione di un progetto di esempio in vb.net
Ora vedremo come creare un progetto di esempio in vb.net. E' possibile creare questi progetti anche nel linguaggio C#.
Strumenti necessari
Per procedere occorre per prima cosa installare Nios4 sul proprio computer e l'ambiente di sviluppo Visual Studio 2019.
Creazione del progetto
Lanciato Visual Studio 2019 selezionare la voce "Crea nuovo progetto". Selezionare il linguaggio Visual Basic e il progetto "Libreria di classi"
Inserire il nome del progetto "section_sample". Il nome del progetto è importante visto che viene utilizzato da Nios4 per identificare la tipologia del componente. In questo caso "section_" identifica che il componente è una sezione. Fare riferimento alle pagine degli altri componenti per le caratteristiche e le proprietà.
Premere "Avanti" verrà richiesto il framework da utilizzare. Selezionare la versione 4 o successiva. A questo punto premendo "Crea" il progetto verrà impostato.
Inserimento riferimento a Nios4
Creato il progetto occorre inserire tra le dipendenze l'eseguibile di Nios4.
Premere con il tasto destro su "Dipendenze" e selezionare "Aggiungi riferimento a progetto...". Premere "Sfoglia..." e selezionare il file "Nios4.exe"
Creazione della classe
All'interno del progetto deve essere già presente il file Class1.vb.
Digitare "Imports Nios4" nella parte superiore del file
Subito sotto la scritta "Public Class Class1" digititare Implements Nios4.ISectionE e dare invio. L'editor inserirà automaticamente tutte le proprietà e i metodi della classe Section. A questo punto il file sarà pronto per essere ampliato. Per le caratteristiche di ogni componente vedere la pagina di riferimento.
Imports Nios4
Public Class Class1
Implements Nios4.ISectionE
Public Property N4 As CNios4 Implements ISectionE.N4
Get
Throw New NotImplementedException()
End Get
Set(value As CNios4)
Throw New NotImplementedException()
End Set
End Property
Public Property SectionName As String Implements ISectionE.SectionName
Get
Throw New NotImplementedException()
End Get
Set(value As String)
Throw New NotImplementedException()
End Set
End Property
Public Property GGUID As String Implements ISectionE.GGUID
Get
Throw New NotImplementedException()
End Get
Set(value As String)
Throw New NotImplementedException()
End Set
End Property
Public Property Panel As Windows.Forms.Control Implements ISectionE.Panel
Get
Throw New NotImplementedException()
End Get
Set(value As Windows.Forms.Control)
Throw New NotImplementedException()
End Set
End Property
Public Property TableName As String Implements ISectionE.TableName
Get
Throw New NotImplementedException()
End Get
Set(value As String)
Throw New NotImplementedException()
End Set
End Property
Public Property SEED As String Implements ISectionE.SEED
Get
Throw New NotImplementedException()
End Get
Set(value As String)
Throw New NotImplementedException()
End Set
End Property
Public Property UseAdd As Boolean Implements ISectionE.UseAdd
Get
Throw New NotImplementedException()
End Get
Set(value As Boolean)
Throw New NotImplementedException()
End Set
End Property
Public Property LabelAdd As String Implements ISectionE.LabelAdd
Get
Throw New NotImplementedException()
End Get
Set(value As String)
Throw New NotImplementedException()
End Set
End Property
Public Function Initialize(errorn As CNios4.CError) As Boolean Implements ISectionE.Initialize
Throw New NotImplementedException()
End Function
Public Function Refresh(errorn As CNios4.CError) As Boolean Implements ISectionE.Refresh
Throw New NotImplementedException()
End Function
Public Function Add(errorn As CNios4.CError) As Boolean Implements ISectionE.Add
Throw New NotImplementedException()
End Function
End Class
Creato correttamente il componente compilarlo all'interno della cartella di Nios4. In questo caso si dovrebbe creare un file con il nome "section_test.dll"