![Oriel Cornerstone 130 Скачать руководство пользователя страница 7](http://html.mh-extra.com/html/oriel/cornerstone-130/cornerstone-130_quick-start-manual_1650790007.webp)
CS API v3.01 QSG
Programming Interface Manual
7
Cornerstone cs = new Cornerstone(true);
Int32 deviceCount = 0;
public MainForm()
{
InitializeComponent();
// This is C# standard form init function
connect();
usbDevices.DeviceAt= new EventHandler(usbDevices_DeviceAttached);
usbDevices.DeviceR= new EventHandler(usbDevices_DeviceRemoved)
}
/// These two functions below handle dynamic USB plug and unplug events
void usbDevices_DeviceRemoved(object sender, EventArgs e)
{
USBEventArgs usbEvent = e as USBEventArgs;
cs.disconnect();
}
void usbDevices_DeviceAttached(object sender, EventArgs e)
{
USBEventArgs usbEvent = e as USBEventArgs;
cs.connect();
connect();
}
void connect()
{
cornerstone = cs.device;
usbDevices = cs.usbDevices;
deviceCount = usbDevices.Count;
}
void toggleButtons(Boolean toggle)
{
btnResponse.Enabled = toggle;
btnSend.Enabled = toggle;
btnQuery.Enabled = toggle;
}
C# (Form file) code
– Abbreviated to show added code snippets
..
using CornerstoneDll;
namespace CornerstoneApp
{