private void WaitBtn_Click(object sender, EventArgs e) { if (image == null) { SelectImageMessageBox(); return; } //get timeout int timeout = int.Parse(TimeoutTextBox.Text); //get wait options bool appear = false; if (AppearRadio.Checked) { appear = true; } try { uiNode.clippingRegion = null; uiNode.timeout = timeout; uiNode.WaitImage(image, GetAccuracy(), appear); if (appear) { MessageBox.Show("Image appeared"); } else { MessageBox.Show("Image disappeared"); } } catch (Exception) { if (appear) { MessageBox.Show("Image didn't appear"); } else { MessageBox.Show("Image didn't disappear"); } } }