VB.net a VC#2008 ayuda con migración de código

Hola a todos.....en este momento estoy experimentando un poco con USB en modo HID usando un PIC18F2550 , programando en CCS v4.104 y Visual C#2008 para la PC.
Ahora mi consulta es la siguiente...
yo tengo un programa de control básico usando VB.net y easyHID...
Código:
 ' Acá está el código fuente del main...
    Public Class Form1

    Private Const VendorID As Short = 6017  ' Definimos el VendorID.
    Private Const ProductID As Short = 2000 ' Definimos el ProductID.

    ' Declaramos los buffer's de entrada y salida de datos.
    Private Const BufferInSize As Short = 8  ' Definimos el tamaño del buffer entrada.
    Private Const BufferOutSize As Short = 8 ' Definimos el tamaño del buffer de salida.
    Dim BufferIn(BufferInSize) As Byte
    Dim BufferOut(BufferOutSize) As Byte

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ConnectToHID(Me) ' Al ejecutarse el formulario conectamos el dispositivo al controlador.
    End Sub

    Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        DisconnectFromHID() ' Si cerramos el formulario desconectamos el dispositivo del controlador.
    End Sub

    ' Si se conecta el dispositivo al host...
    Public Sub OnPlugged(ByVal pHandle As Integer)
        If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then
            Me.estado.BackColor = Color.Green
            Me.estado_conexion.Text = "CONECTADO"
        End If
    End Sub

    ' Si se desconecta el dispositivo del host...
    Public Sub OnUnplugged(ByVal pHandle As Integer)
        If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then
            hidSetReadNotify(hidGetHandle(VendorID, ProductID), False)
            Me.estado.BackColor = Color.Red
            Me.estado_conexion.Text = "DESCONECTADO"
        End If
    End Sub

    Public Sub OnChanged() ' LLama a todas las funciones de mensajes.
        Dim pHandle As Integer
        pHandle = hidGetHandle(VendorID, ProductID)
        hidSetReadNotify(hidGetHandle(VendorID, ProductID), True)
    End Sub

    ' Si recibimos un dato...
    Public Sub OnRead(ByVal pHandle As Integer)
        If hidRead(pHandle, BufferIn(0)) Then
            ' Aqui se reciben los datos a partir del BufferIn(1) = dato del micro..
        End If
    End Sub

    Public Sub WriteSomeData() ' Si hay un dato listo para enviar...
        hidWriteEx(VendorID, ProductID, BufferOut(0))
    End Sub

    Private Sub boton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles boton.Click
        BufferOut(1) = 1
        Call WriteSomeData()
    End Sub
End Class
Y la librería de control :

Código:
Imports System
Imports System.Threading
Imports System.Runtime.InteropServices ' Clase para importar la DLL.


Module HIDDLLInterface
    'Declaramos todas las funciones.
    Declare Function hidConnect Lib "mcHID.dll" Alias "Connect" (ByVal pHostWin As Integer) As Boolean
    Declare Function hidDisconnect Lib "mcHID.dll" Alias "Disconnect" () As Boolean
    Declare Function hidGetItem Lib "mcHID.dll" Alias "GetItem" (ByVal pIndex As Integer) As Integer
    Declare Function hidGetItemCount Lib "mcHID.dll" Alias "GetItemCount" () As Integer
    Declare Function hidRead Lib "mcHID.dll" Alias "Read" (ByVal pHandle As Integer, ByRef pData As Byte) As Boolean
    Declare Function hidWrite Lib "mcHID.dll" Alias "Write" (ByVal pHandle As Integer, ByRef pData As Byte) As Boolean
    Declare Function hidReadEx Lib "mcHID.dll" Alias "ReadEx" (ByVal pVendorID As Integer, ByVal pProductID As Integer, ByRef pData As Byte) As Boolean
    Declare Function hidWriteEx Lib "mcHID.dll" Alias "WriteEx" (ByVal pVendorID As Integer, ByVal pProductID As Integer, ByRef pData As Byte) As Boolean
    Declare Function hidGetHandle Lib "mcHID.dll" Alias "GetHandle" (ByVal pVendoID As Integer, ByVal pProductID As Integer) As Integer
    Declare Function hidGetVendorID Lib "mcHID.dll" Alias "GetVendorID" (ByVal pHandle As Integer) As Integer
    Declare Function hidGetProductID Lib "mcHID.dll" Alias "GetProductID" (ByVal pHandle As Integer) As Integer
    Declare Function hidGetVersion Lib "mcHID.dll" Alias "GetVersion" (ByVal pHandle As Integer) As Integer
    Declare Function hidGetVendorName Lib "mcHID.dll" Alias "GetVendorName" (ByVal pHandle As Integer, ByVal pText As String, ByVal pLen As Integer) As Integer
    Declare Function hidGetProductName Lib "mcHID.dll" Alias "GetProductName" (ByVal pHandle As Integer, ByVal pText As String, ByVal pLen As Integer) As Integer
    Declare Function hidGetSerialNumber Lib "mcHID.dll" Alias "GetSerialNumber" (ByVal pHandle As Integer, ByVal pText As String, ByVal pLen As Integer) As Integer
    Declare Function hidGetInputReportLength Lib "mcHID.dll" Alias "GetInputReportLength" (ByVal pHandle As Integer) As Integer
    Declare Function hidGetOutputReportLength Lib "mcHID.dll" Alias "GetOutputReportLength" (ByVal pHandle As Integer) As Integer
    Declare Sub hidSetReadNotify Lib "mcHID.dll" Alias "SetReadNotify" (ByVal pHandle As Integer, ByVal pValue As Boolean)
    Declare Function hidIsReadNotifyEnabled Lib "mcHID.dll" Alias "IsReadNotifyEnabled" (ByVal pHandle As Integer) As Boolean
    Declare Function hidIsAvailable Lib "mcHID.dll" Alias "IsAvailable" (ByVal pVendorID As Integer, ByVal pProductID As Integer) As Boolean

    'Funciones para desplegar mensajes.

    Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Integer, ByVal hwnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
                                          (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer

    Delegate Function SubClassProcDelegate(ByVal hwnd As Integer, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Public Declare Function DelegateSetWindowLong Lib "USER32.DLL" Alias "SetWindowLongA" _
                                           (ByVal hwnd As Integer, ByVal attr As Integer, ByVal lval As SubClassProcDelegate) As Integer


    ' Constantes de la aplicación.
    Public Const WM_APP As Integer = 32768
    Public Const GWL_WNDPROC As Short = -4

    ' Constantes de mensajes de HID.
    Private Const WM_HID_EVENT As Decimal = WM_APP + 200
    Private Const NOTIFY_PLUGGED As Short = 1
    Private Const NOTIFY_UNPLUGGED As Short = 2
    Private Const NOTIFY_CHANGED As Short = 3
    Private Const NOTIFY_READ As Short = 4

    ' Variables locales.
    Private FPrevWinProc As Integer
    Private FWinHandle As Integer
    Private Ref_WinProc As New SubClassProcDelegate(AddressOf WinProc)
    Private HostForm As Object

    'Espera a recibir un mensaje del controlador HOST y luego se conecta a el mediante la librería de 
    'Funciones.
    Public Function ConnectToHID(ByRef targetForm As Form) As Boolean
        Dim pHostWin As Integer = targetForm.Handle.ToInt32
        FWinHandle = pHostWin
        pHostWin = hidConnect(FWinHandle)
        FPrevWinProc = DelegateSetWindowLong(FWinHandle, GWL_WNDPROC, Ref_WinProc)
        HostForm = targetForm
    End Function

    ' Se desconecta del HOST.
    Public Function DisconnectFromHID() As Boolean
        DisconnectFromHID = hidDisconnect
        SetWindowLong(FWinHandle, GWL_WNDPROC, FPrevWinProc)
    End Function

    Private Function WinProc(ByVal pHWnd As Integer, ByVal pMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
        If pMsg = WM_HID_EVENT Then
            Select Case wParam

                ' Mensaje de que un dispositivo se ha conectado al host.
                Case Is = NOTIFY_PLUGGED
                    HostForm.OnPlugged(lParam)
                    ' Mensaje de que un dispositivo se ha desconectado del host.
                Case Is = NOTIFY_UNPLUGGED
                    HostForm.OnUnplugged(lParam)
                    ' El controlador ha cambiado.
                Case Is = NOTIFY_CHANGED
                    HostForm.OnChanged()
                    ' Se he recibido un dato.
                Case Is = NOTIFY_READ
                    HostForm.OnRead(lParam)
            End Select
        End If
        WinProc = CallWindowProc(FPrevWinProc, pHWnd, pMsg, wParam, lParam)

    End Function
End Module
Mi pregunta es como poder migrar este código que está en VB.net a VC#2008
huh.gif
No se mucho de programación de aplicaciones pero me gustaría saber como poder llamar a las funciones de mcHID.dl que es la librería de easyHID en VC# 2008.

Cualquier ayuda es bienvenida
rolleyes2.gif
 
Código:
using System; 
using System.Threading; 
using System.Runtime.InteropServices; 
// Clase para importar la DLL. 

static class HIDDLLInterface 
{ 
    [DllImport("mcHID.dll", EntryPoint = "Connect", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern bool hidConnect(int pHostWin); 
    [DllImport("mcHID.dll", EntryPoint = "Disconnect", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern bool hidDisconnect(); 
    [DllImport("mcHID.dll", EntryPoint = "GetItem", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetItem(int pIndex); 
    [DllImport("mcHID.dll", EntryPoint = "GetItemCount", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetItemCount(); 
    [DllImport("mcHID.dll", EntryPoint = "Read", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern bool hidRead(int pHandle, ref byte pData); 
    [DllImport("mcHID.dll", EntryPoint = "Write", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern bool hidWrite(int pHandle, ref byte pData); 
    [DllImport("mcHID.dll", EntryPoint = "ReadEx", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern bool hidReadEx(int pVendorID, int pProductID, ref byte pData); 
    [DllImport("mcHID.dll", EntryPoint = "WriteEx", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern bool hidWriteEx(int pVendorID, int pProductID, ref byte pData); 
    [DllImport("mcHID.dll", EntryPoint = "GetHandle", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetHandle(int pVendoID, int pProductID); 
    [DllImport("mcHID.dll", EntryPoint = "GetVendorID", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetVendorID(int pHandle); 
    [DllImport("mcHID.dll", EntryPoint = "GetProductID", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetProductID(int pHandle); 
    [DllImport("mcHID.dll", EntryPoint = "GetVersion", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetVersion(int pHandle); 
    [DllImport("mcHID.dll", EntryPoint = "GetVendorName", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetVendorName(int pHandle, string pText, int pLen); 
    [DllImport("mcHID.dll", EntryPoint = "GetProductName", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetProductName(int pHandle, string pText, int pLen); 
    [DllImport("mcHID.dll", EntryPoint = "GetSerialNumber", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetSerialNumber(int pHandle, string pText, int pLen); 
    [DllImport("mcHID.dll", EntryPoint = "GetInputReportLength", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetInputReportLength(int pHandle); 
    [DllImport("mcHID.dll", EntryPoint = "GetOutputReportLength", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int hidGetOutputReportLength(int pHandle); 
    [DllImport("mcHID.dll", EntryPoint = "SetReadNotify", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern void hidSetReadNotify(int pHandle, bool pValue); 
    [DllImport("mcHID.dll", EntryPoint = "IsReadNotifyEnabled", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern bool hidIsReadNotifyEnabled(int pHandle); 
    [DllImport("mcHID.dll", EntryPoint = "IsAvailable", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern bool hidIsAvailable(int pVendorID, int pProductID); 
    [DllImport("user32", EntryPoint = "CallWindowProcA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int CallWindowProc(int lpPrevWndFunc, int hwnd, int Msg, int wParam, int lParam); 
    [DllImport("user32", EntryPoint = "SetWindowLongA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int SetWindowLong(int hwnd, int nIndex, int dwNewLong); 
    //Declaramos todas las funciones. 
    
    //Funciones para desplegar mensajes. 
    
    
    public delegate int SubClassProcDelegate(int hwnd, int msg, int wParam, int lParam); 
    [DllImport("USER32.DLL", EntryPoint = "SetWindowLongA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] 
    public static extern int DelegateSetWindowLong(int hwnd, int attr, SubClassProcDelegate lval); 
    
    
    // Constantes de la aplicación. 
    public const int WM_APP = 32768; 
    public const short GWL_WNDPROC = -4; 
    
    // Constantes de mensajes de HID. 
    private const decimal WM_HID_EVENT = WM_APP + 200; 
    private const short NOTIFY_PLUGGED = 1; 
    private const short NOTIFY_UNPLUGGED = 2; 
    private const short NOTIFY_CHANGED = 3; 
    private const short NOTIFY_READ = 4; 
    
    // Variables locales. 
    private static int FPrevWinProc; 
    private static int FWinHandle; 
    private static SubClassProcDelegate Ref_WinProc = new SubClassProcDelegate(WinProc); 
    private static object HostForm; 
    
    //Espera a recibir un mensaje del controlador HOST y luego se conecta a el mediante la librería de 
    //Funciones. 
    public static bool ConnectToHID(ref Form targetForm) 
    { 
        int pHostWin = targetForm.Handle.ToInt32; 
        FWinHandle = pHostWin; 
        pHostWin = hidConnect(FWinHandle); 
        FPrevWinProc = DelegateSetWindowLong(FWinHandle, GWL_WNDPROC, Ref_WinProc); 
        HostForm = targetForm; 
    } 
    
    // Se desconecta del HOST. 
    public static bool DisconnectFromHID() 
    { 
        bool functionReturnValue = false; 
        functionReturnValue = hidDisconnect; 
        SetWindowLong(FWinHandle, GWL_WNDPROC, FPrevWinProc); 
        return functionReturnValue; 
    } 
    
    private static int WinProc(int pHWnd, int pMsg, int wParam, int lParam) 
    { 
        if (pMsg == WM_HID_EVENT) { 
            switch (wParam) { 
                
                // Mensaje de que un dispositivo se ha conectado al host. 
                case // ERROR: Case labels with binary operators are unsupported : Equality NOTIFY_PLUGGED: 
                    HostForm.OnPlugged(lParam); 
                    break; 
                // Mensaje de que un dispositivo se ha desconectado del host. 
                case // ERROR: Case labels with binary operators are unsupported : Equality NOTIFY_UNPLUGGED: 
                    HostForm.OnUnplugged(lParam); 
                    break; 
                // El controlador ha cambiado. 
                case // ERROR: Case labels with binary operators are unsupported : Equality NOTIFY_CHANGED: 
                    HostForm.OnChanged(); 
                    break; 
                // Se he recibido un dato. 
                case // ERROR: Case labels with binary operators are unsupported : Equality NOTIFY_READ: 
                    HostForm.OnRead(lParam); 
                    break; 
            } 
        } 
            
        return CallWindowProc(FPrevWinProc, pHWnd, pMsg, wParam, lParam); 
    } 
}
 
Justamente meta estaba probado los códigos en un programa de ejemplo ...hasta ahora todo va bien pero hay un error que me está costando descifrar cuál es :
public static bool ConnectToHID(ref Form1 targetForm)
{
int pHostWin = targetForm.Handle.ToInt32;
FWinHandle = pHostWin;
pHostWin = hidConnect(FWinHandle);
FPrevWinProc = DelegateSetWindowLong(FWinHandle, GWL_WNDPROC, Ref_WinProc);
HostForm = targetForm;
}

me tira el error: no se puede encontrar el tipo o nombre de espacio de nombres "Form" (¿falta una referencia using o una referencia de ensamblado ?)
 
Ahora meta me voy a poner a hacer un programa de ejemplo para pasarte por que el primero lo borré accidentalmente :rolleyes:
La verdad está costando mucho hacerlo funcionar pero de poder se puede (y)
 
Bueno meta como había dicho acá te dejo la primera versión del código fuente :cry: pero con 16 errores para correjir....pude correjir de forma eficaz el problema de llamar a las funciones desde la librería ....pero hay funciones que no están bien hechas...datos que no se como están definidos...etc
como vos decis de a poco se va a ir haciendo hasta que el proyecto salga funcionando (y)
 

Adjuntos

  • picHID.rar
    330 KB · Visitas: 4
Estoy viendo el ejemplo:

Por lo que veo no está completo porque hay muchos avisos.

Código:
Error    2    El método debe tener un tipo de valor devuelto    C:\Documents and Settings\Hunter\Mis documentos\Descargas\picHID\picHID\picHID\picHID.cs    30    9    picHID

Aquí dejé el archivo de descarga para que lo vean.
http://social.msdn.microsoft.com/Fo...74b7ba8b#dd93ef1b-5b7a-43e9-bfab-5bc720742873

La verdad es que hay errores de void, es decir, no puedes llamar a un void porque ese void no le haz incluido un proceso. El proceso no existe y esos son los avisos que veo, entre otros que no entiendo.
 
hay cosas que no entiendo sobre esta librería pero de a poco lo voy a ir viendo ..gracias meta

acá está de vuelta el código pero con 9 errores :unsure: , ahora está un poco más correjido pero igual hay varios problemas que no puedo solucionar ....
al igual que la otra vez te dejo el adjunto para q lo veas .

PD: también dejo la lista de errores correspondientes a esta versión :cry:
 

Adjuntos

  • easyHID c#.rar
    181.7 KB · Visitas: 5
  • LISTAS DE ERRORES V2.0.txt
    2.3 KB · Visitas: 1
Última edición:
Por ahora hay que buscar partes por partes hasta lograr la solución.

e001.gif

e002.gif

e003.gif



Ya queda menos, o eso parece. Aquí por ahora hay que resolver la conversión bien de bool a int y al revés.

e004.gif
 
Última edición:
Si el problema de la conversión de tipos es lo que me ha dado el mayor problema...hay que buscar como convertir una variable bool en int.

por lo menos ya son menos errores....gracias meta
 
PD: creo que le encontré solución ...voy a probar y posteo resultados

Código:
public static bool ConnectToHID(ref Form targetForm)
        {
            bool pHostWin = Convert.ToBoolean(targetForm.Handle);
            FWinHandle = Convert.ToInt32(FWinHandle);
            pHostWin = hidConnect(FWinHandle);
            FPrevWinProc = DelegateSetWindowLong(FWinHandle, GWL_WNDPROC, Ref_WinProc);
            HostForm = targetForm;
//INSTANT C# NOTE: Inserted the following 'return' since all code paths must return a value in C#:
            return false;
        }
Ahi me dejó de mostrar ese error :D ahora me llama la atención : //INSTANT C# NOTE: Inserted the following 'return' since all code paths must return a value in C#:


A que se deberá esa nota ??

Viendo los otros errores:
Código:
1    No se puede pasar '<this>' como argumento out o ref porque es de sólo lectura    C:\Documents and Settings\Flia. Moyano\Escritorio\Electrónica\easyHID c#\Form1.cs    32    37    easyHID_VB.net 2008
Error    
2    'object' no contiene una definición de 'OnPlugged' ni se encontró ningún método de extensión 'OnPlugged' que acepte un primer argumento de tipo 'object' (¿falta una directiva de uso o una referencia de ensamblado?)    C:\Documents and Settings\Flia. Moyano\Escritorio\Electrónica\easyHID c#\Module1.cs    122    16    easyHID_VB.net 2008
Error    
3    'object' no contiene una definición de 'OnUnplugged' ni se encontró ningún método de extensión 'OnUnplugged' que acepte un primer argumento de tipo 'object' (¿falta una directiva de uso o una referencia de ensamblado?)    C:\Documents and Settings\Flia. Moyano\Escritorio\Electrónica\easyHID c#\Module1.cs    126    16    easyHID_VB.net 2008
Error    
4    'object' no contiene una definición de 'OnChanged' ni se encontró ningún método de extensión 'OnChanged' que acepte un primer argumento de tipo 'object' (¿falta una directiva de uso o una referencia de ensamblado?)    C:\Documents and Settings\Flia. Moyano\Escritorio\Electrónica\easyHID c#\Module1.cs    130    16    easyHID_VB.net 2008
Error   
5    'object' no contiene una definición de 'OnRead' ni se encontró ningún método de extensión 'OnRead' que acepte un primer argumento de tipo 'object' (¿falta una directiva de uso o una referencia de ensamblado?)    C:\Documents and Settings\Flia. Moyano\Escritorio\Electrónica\easyHID c#\Module1.cs    134    16    easyHID_VB.net 2008
ya son menos, pero igual hay algunos que no entiendo :rolleyes:
 
Última edición:
Veo que lo enlaces que te puse te resultó de ayuda algo. Por lo que veo, que menos los errores, andas muy bien. Voy a investigar que using y referencia falta, porque la verdad no los encuentro.

e005.gif

Los errores que me aparecen son:
Error 1 'object' no contiene una definición de 'OnPlugged' ni se encontró ningún método de extensión 'OnPlugged' que acepte un primer argumento de tipo 'object' (¿falta una directiva de uso o una referencia de ensamblado?) C:\Documents and Settings\Usuario\Escritorio\easyHID c#\Module1.cs 122 16 easyHID_VB.net 2008

e006.gif

http://en.csharp-online.net/Design-Time_Integration—Host_Form_Integration

http://msdn.microsoft.com/es-es/library/aa289500(en-us,VS.71).aspx

http://www.google.es/#hl=es&q=HostForm+c#&meta=&aq=f&oq=HostForm+c#&fp=a0524c7b64d27806


 
Última edición:
Si meta al parecer la correccion de errores ha traido de manos ....funciones que no tengo idea de su comportamiento...

Sigo investigando a ver que pasa...pero como me estás dando una mano grande...creo que en algunos días la vamos a tener andando
 
Si te fijas en el cuadro o rectángulo azul, throw new NotImplementedException();

Quita todo esa línea y ahí va instrucciones de lo que buscas.
 
Que donde pone:

throw new NotImplementedException();

está de adorno por decirlo de alguna manera. Lo boras y tienes que poner los códigos para el funcionamiento del OnPlugged.

Puedes poner cualquier función que haga algo, si lo dejas como está, no hace nada. Hace algo si pones esto:

Console.Writeline ("Hola mundo");


Ya es algo, pero si lo dejas como throw new NotImplementedException(); es como si estuviera en blanco.
 
Atrás
Arriba