private void Find_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { toolStripProgressBar1.Value = 0; toolStripProgressBar1.Style = ProgressBarStyle.Continuous; ResourceList.Clear(); ResourceList.RaiseListChangedEvents = true; if (e.Result == null) { SetMessage("could not find any instruments, check connections and try again."); return; } foreach (string s in (e.Result as List <string>)) { ResourceList.Add(s); } if (ResourceList.Count == 1) { listBox1.SelectedIndex = 0; textBox1.Text = (string)ResourceList[0]; SetMessage("One Instrument Found."); Connect((string)ResourceList[0]); UpdateScreen(pictureBox1); } else if (ResourceList.Count != 0) { listBox1.SelectedIndex = 0; textBox1.Text = (string)ResourceList[0]; SetMessage("Multiple Instruments Found, Please Select one and click connect."); //listBox1.SelectedIndex = 0; } else { SetMessage("No Instruments Found."); } }
public void GiveResource(resource givenResource) { m_resource.Clear(givenResource); }