I am new to MVVM and Dependency Injection, and therefore I could need some Hint how to do it. My Project, which handles a Barcode Scanner and also running in the Background, currently is using the ManagementObjectSearcher with SerialPort and also WshShell(Windows Script Host Object Model) to send the output to the System.
On my Views, I got a Overview and a Settings Page, which display the Connection Status and some Settings for the Scanner, but using different viewmodels. How to do it right, should I use a Service to communicate with the Scanner, and also retrieve and send Data to the System or should this be handled by the Viewmodel. Also where to put the list of devices and connection? Should the VM reffer to the Service? And for showing the Information, should I use a ScannerViewModel and Inherit from SettingsViewModel and MainViewModel or add the ScannerViewModel to the other VMs as Injected Singleton?
I watched a bunch of Videos and read about MVVM and Dependency Injection, also googled but could not find any Hint about this. Also found samples for Device handling CustomSerialDeviceAccess. But they do it with Codebehind. I think that the 2 classes, DeviceListEntry and EventHandlerForDevice are Services, but i want to connect directly to the Device when the app is started and there is only 1 Device.
Also I Would like to show a better name than in this Example (USB/numbers and ID). Best would be to show the Vendor and which Series it is. But i believe this is Impossible without a whole List from the Vendors.
Or are there Better ways of connecting to a USB Scanner than the Windows.Devices.Enumeration namespace?
Also I could not find any SDKs for our Vendors, which are Datalogic and Zebra so far, which could give more Information about the Scanner, if there would be any SDK.
Could anyone Point me to the right Direction, to do it right with not violate patterns and to keep the code and files clean?
Thanks in Advance
Also my native language is not english, hopefully i wrote everything good enough for understanding