public void Initialize(Configuration config)
        {
            UpdateStatus(HardwareStatus.Initializing);

            asyncControl = new Thread(() =>
            {
                try
                {
                    counter = new CounterController(config.CounterPort, 250000);
                    counter.OnLogMessage += OnLogMessage;
                }
                catch (Exception)
                {
                    OnLogMessage("Failed to open counter on " + config.CounterPort);
                    UpdateStatus(HardwareStatus.Error);
                    return;
                }

                try
                {
                    printer = new PrinterController(config.PrinterPort, 250000);
                    printer.OnLogMessage += OnLogMessage;
                }
                catch (Exception)
                {
                    OnLogMessage("Failed to open printer on " + config.PrinterPort);
                    UpdateStatus(HardwareStatus.Error);
                    CloseSerialConnections();

                    return;
                }

                UpdateStatus(HardwareStatus.Idle);
            });

            asyncControl.Start();
        }
        void CloseSerialConnections()
        {
            if (printer != null)
                printer.Dispose();
            printer = null;

            if (counter != null)
                counter.Dispose();
            counter = null;
        }