3 mal von stephan editiert.
The Arcaze C# DLL version 6.0 has been rewritten and repartitioned. Some changes were required for consistency reasons and better functionality.
If you want to upgrade an existing application to the new version of the C# DLL, a few changes are required in your application. The changes are shown here at the example of the ArcazeConfig application code. In most cases you will have a lot less changes, because you're not using all features. All changes required can be done in a few minutes for the complete application total.
Namespace changed
Namespace has been changed to "Arcaze".
Old
using SimpleSolutions;
using SimpleSolutions.Usb;
New
using SimpleSolutions;
using SimpleSolutions.Arcaze;
Access objects
In previous versions the bootloader commands were in a different class and not in the DLL at all. They are now integrated.
You can ignore this one, because end user applications did not have access to this functionality until now anyway. But for completeness: There is no "BootloaderHid" object anymore, it's integrated now.
Old
private ArcazeHid arcazeHid; // Arcaze Access Object
private BootloaderHid bootloaderHid; // Bootloader Access Object (for firmware updates)
arcazeHid = new ArcazeHid();
bootloaderHid = new BootloaderHid(this.Handle);
New
private ArcazeHid arcazeHid; // Arcaze Access Object
arcazeHid = new ArcazeHid();
Device Notification
Device Notification is now done with the Device Monitor class instead of doing it directly in the application. Therefore a new DeviceMonitor object has to be created.
Old
private List<DeviceInfo> presentArcaze = new List<DeviceInfo>(10);
private IntPtr deviceNotificationHandle; // für Windows-Ereignisverarbeitung für USB
deviceNotificationHandle = UsbHid.RegisterForDeviceNotifications(this.Handle);
arcazeHid.OurDeviceRemoved += OnOurDeviceRemoved;
arcazeHid.OurDeviceReceived += OnOurDeviceReceived;
arcazeHid.DeviceReceived += OnDeviceReceived;
arcazeHid.DeviceRemoved += OnDeviceReceived;
New
private List<DeviceInfo> presentArcaze = new List<DeviceInfo>(10);
private DeviceMonitor deviceMonitor = new DeviceMonitor();
deviceMonitor.RegisterForDeviceNotifications();
deviceMonitor.OurDeviceRemoved += OnOurDeviceRemoved;
deviceMonitor.OurDeviceReceived += OnOurDeviceReceived;
deviceMonitor.DeviceReceived += OnDeviceReceived;
deviceMonitor.DeviceRemoved += OnDeviceReceived;
Finding Arcaze Devices
Finding the devices has been simplified. You don't need to care about sorting out duplicated devices anymore. It's done inside the DLL now, so that code can be removed:
Old
private List<DeviceInfo> searchForArcaze()
{
List<DeviceInfo> allArcaze = new List<DeviceInfo>(5);
List<DeviceInfo> differentArcaze = new List<DeviceInfo>(5);
arcazeHid.Find(allArcaze);
differentArcaze = arcazeHid.RemoveSameSerialDevices(allArcaze);
toolStripComboBoxFoundArcaze.Items.Clear();
toolStripComboBoxFoundArcaze.Text = "";
for (int num = 0; num < differentArcaze.Count; num++)
{
toolStripComboBoxFoundArcaze.Items.Add(differentArcaze[num].DeviceName);
}
return differentArcaze;
}
New
private List<DeviceInfo> searchForArcaze()
{
List<DeviceInfo> arcazeDevices = new List<DeviceInfo>(5);
ArcazeHid.Find(arcazeDevices);
toolStripComboBoxFoundArcaze.Items.Clear();
toolStripComboBoxFoundArcaze.Text = "";
for (int num = 0; num < arcazeDevices.Count; num++)
{
toolStripComboBoxFoundArcaze.Items.Add(arcazeDevices[num].DeviceName);
}
return arcazeDevices;
}
ArcazeHid.Command renamed to ArcazeHid.ArcazeCommands
Since the bootloader commands have been added to the ArcazeHid class, the ArcazeCommands had to be made distinctive. They are now inside ArcazeHid.ArcazeCommands instead of ArcazeHid.Commands, while the bootloader commands are inside ArcazeHid.BootloaderCommands.
You can simply search/replace that for the whole application.
Old
arcazeHid.Command.CmdReset();
New
arcazeHid.ArcazeCommands.Reset();
Redundant "Cmd"-Prefix removed from commands
As already visible in the last example, the redundant "Cmd" prefix on all Commands has been removed.
You can simply search/replace that for the whole application.
Old
arcazeHid.Command.CmdReset();
New
arcazeHid.ArcazeCommands.Reset();