|
//************************************************************************************************
// Copyright © 2010 Steven M. Cohn. All Rights Reserved.
//
//************************************************************************************************
namespace UsbManagerDemo
{
using System;
using System.Windows.Forms;
using iTuner;
public partial class MainForm : Form
{
private static readonly string CR = Environment.NewLine;
private UsbManager manager;
public MainForm ()
{
InitializeComponent();
manager = new UsbManager();
UsbDiskCollection disks = manager.GetAvailableDisks();
textBox.AppendText(CR);
textBox.AppendText("Available USB disks" + CR);
foreach (UsbDisk disk in disks)
{
textBox.AppendText(disk.ToString() + CR);
}
textBox.AppendText(CR);
manager.StateChanged += new UsbStateChangedEventHandler(DoStateChanged);
}
private void DoStateChanged (UsbStateChangedEventArgs e)
{
textBox.AppendText(e.State + " " + e.Disk.ToString() + CR);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.