private void ScannerThreadCom(object obj)
        {
            TCPCom ThreadCom = (TCPCom)obj;

            if (!ThreadCom.SetupCom())
            {
                //DebugWrite("Error setting up communication with Scanner.");
            }
            else
            {
                while (ProgramActive)
                {
                    string ReceivedData = ThreadCom.UseCom();
                    if (ReceivedData != "" && ReceivedData != null && ReceivedData.Length > 0)
                    {
                        var newString = ReceivedData.Replace("\u0002", "").Replace("\u0003", "");
                        StatusBar.Dispatcher.Invoke(() =>
                        {
                            StatusBar.Content = ReceivedData;
                        });
                        PopulateList(newString);
                    }
                }
            }
        }
        private void PrinterThreadCom(object obj)
        {
            TCPCom ThreadCom = (TCPCom)obj;
            string ReceivedData;


            if (!ThreadCom.SetupCom())
            {
                //DebugWrite("Error setting up communication with printer.");
            }
            else
            {
                while (ProgramActive)
                {
                    if (tick)
                    {
                        tick         = false;
                        ReceivedData = ThreadCom.GetACC();
                        if (ReceivedData != "" && ReceivedData != null && ReceivedData.Length > 0)
                        {
                            //StatusBar.Dispatcher.Invoke(() =>
                            //{
                            //    StatusBar.Content = ReceivedData;
                            //});
                        }
                        if (ReceivedData.Contains("0A44") && ReceivedData.Length > 15)
                        {
                            if (ReceivedData[14].ToString() == "1")
                            {
                                palletInPosition = true;
                                PalletStatus.Dispatcher.Invoke(() =>
                                {
                                    PalletStatus.Icon       = FontAwesome.WPF.FontAwesomeIcon.CheckCircle;
                                    PalletStatus.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#009d58"));
                                });
                            }
                            else if (ReceivedData[14].ToString() == "0")
                            {
                                palletInPosition = false;
                                printSent        = false;
                                PalletStatus.Dispatcher.Invoke(() =>
                                {
                                    PalletStatus.Icon       = FontAwesome.WPF.FontAwesomeIcon.TimesCircle;
                                    PalletStatus.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ca0b00"));
                                });
                            }
                        }
                        if (palletInPosition && !printSent)
                        {
                            SendPrint();
                        }
                    }
                }
            }
        }