ciao,
mi date una mano a convertire un progetto da C# in vb.net?
ho il listato ed ho anche il convertitore Questo
il progetto è:
codice:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenNETCF.Desktop.Communication;
using System.IO;
namespace DeviceFileBrowser
{
public partial class Main : Form
{
private RAPI m_rapi;
private ActiveSync m_activeSync;
private string m_selectedFile = "";
private string m_path = "";
public Main()
{
InitializeComponent();
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
using (AboutBox ab = new AboutBox())
ab.ShowDialog(this);
}
private void Main_Load(object sender, EventArgs e)
{
InitializeRAPI();
}
private void InitializeRAPI()
{
this.toolStripMenuItem1.Enabled = false;
this.m_rapi = new RAPI();
this.m_activeSync = this.m_rapi.ActiveSync;
this.m_activeSync.Disconnect += new DisconnectHandler(activeSync_Disconnect);
this.m_activeSync.Active += new ActiveHandler(activeSync_Active);
this.m_rapi.RAPIConnected += new RAPIConnectedHandler(rapi_RAPIConnected);
this.m_rapi.RAPIDisconnected += new RAPIConnectedHandler(rapi_RAPIDisconnected);
//Init rapi if the device is present
if (this.m_rapi.DevicePresent)
this.m_rapi.Connect();
}
private void rapi_RAPIConnected()
{
this.Invoke(
new MethodInvoker(
delegate()
{
this.Cursor = Cursors.WaitCursor;
this.Icon = Properties.Resources.Connected1;
this.toolStripStatusConnectionStatus.Image = Properties.Resources.Connected;
this.toolStripStatusConnectionStatus.Text = "Loading Directories...";
this.Refresh();
LoadDirectories("\\");
this.toolStripStatusConnectionStatus.Text = "Connected";
toolStripMenuItem1.Enabled = true;
this.Cursor = Cursors.Default;
}
)
);
}
private void rapi_RAPIDisconnected()
{
this.Invoke(
new MethodInvoker(
delegate()
{
this.Cursor = Cursors.WaitCursor;
this.Icon = Properties.Resources.Disconnected1;
this.toolStripStatusConnectionStatus.Image = Properties.Resources.Disconnected;
this.toolStripStatusConnectionStatus.Text = "Not Connected";
toolStripMenuItem1.Enabled = false;
this.Cursor = Cursors.Default;
}
)
);
}
private void activeSync_Disconnect()
{
this.m_rapi.Disconnect();
}
private void activeSync_Active()
{
this.m_rapi.Connect();
}
private void LoadDirectories(string directory)
{
FileList fl = m_rapi.EnumFiles(directory + "*");
if (fl != null)
{
foreach (FileInformation fi in fl)
{
if ((fi.FileAttributes & (int)FileAttributes.Directory) == (int)FileAttributes.Directory)
{
TreeNode node = this.treeView_Directories.Nodes[0].Nodes.Add(fi.FileName);
this.LoadDirectories(directory + fi.FileName, node);
}
}
}
}
private void LoadDirectories(string directory, TreeNode node)
{
FileList fl = m_rapi.EnumFiles(directory + "\\*");
if (fl != null)
{
foreach (FileInformation fi in fl)
{
if ((fi.FileAttributes & (int)FileAttributes.Directory) == (int)FileAttributes.Directory)
{
TreeNode node1 = node.Nodes.Add(fi.FileName);
this.LoadDirectories(directory + "\\" + fi.FileName, node1);
}
}
}
}
private void LoadFilesFromDirectory(string directory)
{
}
private void treeView_Directories_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
if (!m_rapi.Connected)
return;
this.listView_Files.Clear();
string s = ParsePath(e.Node.FullPath);
FileList fl = m_rapi.EnumFiles(s + "\\*");
if (fl != null)
{
foreach (FileInformation fi in fl)
{
if ((fi.FileAttributes & (int)FileAttributes.Directory) != (int)FileAttributes.Directory)
this.listView_Files.Items.Add(fi.FileName);
}
}
}
private string ParsePath(string treeNodePath)
{
if (treeNodePath.StartsWith("Root"))
return treeNodePath.Replace("Root", "");
else return treeNodePath;
}
public string SelectedFile
{
get
{
return this.m_selectedFile;
}
}
public string Path
{
get
{
return this.m_path;
}
}
private void saveToDesktopToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.listView_Files.SelectedItems.Count > 0)
{
this.m_path = this.ParsePath(this.treeView_Directories.SelectedNode.FullPath);
this.m_selectedFile = this.listView_Files.SelectedItems[0].Text;
saveFileDialog1.FileName = m_selectedFile;
if (saveFileDialog1.ShowDialog(this) == DialogResult.OK)
{
m_rapi.CopyFileFromDevice(saveFileDialog1.FileName, m_path + "\\" + m_selectedFile, true);
}
}
}
private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.saveToDesktopToolStripMenuItem_Click(this, EventArgs.Empty);
}
private void listView_Files_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
ma io non ci riesco