![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
|
Pasar código de Visual a MonoDevelop
Hola:
Hice un manual para del puerto serie controlado con Visual C# .net Express 2008. Al menos hay códigos que deseo pasarlo a Linux con MonoDevelop GTK# (C#). El manual es este: Ver manual El código fuente al que deseo pasar a Linux es este (de la página 162 del manual): Descargar FUENTE 1 Contraseña = D.P.E. Si no pueden descargarlo, me avisan. Necesito colaboradores para ampliar el manual. Por otra parte estoy pasándolo con Visual Basic y Visual C++ 2008. Ver vídeo: http://www.youtube.com/watch?v=niWAbQ-HVnY Quiero que los usuarios de Windows, también entren a Linux y vean sus mismas posibilidades. Un cordial saludo. EDITO: El código de Visual C# es este y quiero pasarlo a GTK# de MonoDevelop. Código:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
namespace PicRS232
{
public partial class Form1_Principal : Form
{
public Form1_Principal()
{
InitializeComponent();
// Abrir puerto mientra se ejecute la aplicación
if (!serialPort1.IsOpen)
{
try
{
serialPort1.Open();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
private void button_t_Click(object sender, EventArgs e)
{
byte[] mBuffer = new byte[1];
mBuffer[0] = 0x74; //ASCII letra "t".
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
private void button_b_Click(object sender, EventArgs e)
{
byte[] miBuffer = new byte[1];
miBuffer[0] = 0x62; //ASCII letra "b".
serialPort1.Write(miBuffer, 0, miBuffer.Length);
}
private void button_a_Click(object sender, EventArgs e)
{
byte[] mBuffer = new byte[1];
mBuffer[0] = 0x61; //ASCII letra "a".
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
private void button_l_Click(object sender, EventArgs e)
{
byte[] mBuffer = new byte[1];
mBuffer[0] = 0x6C; //ASCII letra "l".
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
private void button_Espacio_Click(object sender, EventArgs e)
{
byte[] mBuffer = new byte[1];
mBuffer[0] = 0x20; //ASCII letra "Espacio".
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
}
}
Saludo. EDITO: Por ahora he hecho esto: Código:
// MainWindow.cs created with MonoDevelop
// User: metaconta at 23:01 08/12/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//
using System;
using Gtk;
using System.IO.Ports; // Añadir este using.
public partial class MainWindow: Gtk.Window
{
public MainWindow (): base (Gtk.WindowType.Toplevel)
{
Build ();
// Abrir puerto mientra se ejecute la aplicación
if (!serialPort1.IsOpen)
{
try
{
serialPort1.Open();
}
catch (System.Exception ex)
{
// MessageBox.Show(ex.ToString());
}
}
}
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
Application.Quit ();
a.RetVal = true;
}
protected virtual void OnButtonTClicked (object sender, System.EventArgs e)
{
byte[] mBuffer = new byte[1];
mBuffer[0] = 0x74; //ASCII letra "t".
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
protected virtual void OnButtonBClicked (object sender, System.EventArgs e)
{
byte[] miBuffer = new byte[1];
miBuffer[0] = 0x62; //ASCII letra "b".
serialPort1.Write(miBuffer, 0, miBuffer.Length);
}
protected virtual void OnButtonAClicked (object sender, System.EventArgs e)
{
byte[] mBuffer = new byte[1];
mBuffer[0] = 0x61; //ASCII letra "a".
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
protected virtual void OnButtonLClicked (object sender, System.EventArgs e)
{
byte[] mBuffer = new byte[1];
mBuffer[0] = 0x6C; //ASCII letra "l".
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
protected virtual void OnButtonEspacioClicked (object sender, System.EventArgs e)
{
byte[] mBuffer = new byte[1];
mBuffer[0] = 0x20; //ASCII letra "Espacio".
serialPort1.Write(mBuffer, 0, mBuffer.Length);
}
}
__________________
http://electronica-pic.blogspot.com....n-arduino.html Manuales de electrónica general, PIC y Arduino. Última edición por REHome fecha: 09-12-2008 a las 01:59:04. |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| como desarrollar en monodevelop para windows o linux ? | uper | .NET | 7 | 02-06-2015 23:53:20 |
| MonoDevelop C# | REHome | .NET | 1 | 15-10-2008 09:05:16 |
| Pasar programa de Visual Basic 6 a Delphi | Abuelo7 | Varios | 3 | 10-06-2008 17:22:57 |
| pasar qreport a PDF por codigo | m8estrella83 | Impresión | 2 | 05-08-2007 01:00:31 |
| Codigo visual ASP.net para impresión de un formulario | HombreSigma | .NET | 2 | 12-11-2005 05:10:27 |
|