private bool CheckIfCommPossibleWithPCS(string ipaddress) { MW.Communication = new CommunicationUDP(this, checkboxEoeRw); MW.SelectedDevice = 0; MW.ChooseComm.DataContext = MW.Communication; MW.Communication.AsyncRead(1, 0x1018, 0x01); Stopwatch sw = new Stopwatch(); sw.Start(); while (MW.ObjectDictionary.dictOfCoE[DictionaryBuilder.MakeKey(0x1018, 0x01)].Value == null) { if (sw.ElapsedMilliseconds > 5000) { throw new TimeoutException("A timeout occured. No UDP connection was achieved."); } } if ((uint)MW.ObjectDictionary.GetItem(0x1018, 0x01).Value == 0x29) /* Intec Motor */ { dataGridDevices.ItemsSource = MW.Communication.Devices; dataGridDevices.SelectedIndex = 0; MW.MyTimer1.Start(); return(true); } return(false); }