public void setText(string value)
 {
     TextBox1.Invoke(new Action(() =>
     {
         TextBox1.Text = value;
     }));
 }
Ejemplo n.º 2
0
        private void VideoCaptureDevice_NewFrame(object sender, NewFrameEventArgs eventArgs)
        {
            Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();

            if (bitmap != null)
            {
                try
                {
                    BarcodeReader reader = new BarcodeReader();

                    var result = reader.Decode(bitmap);
                    if (result != null)
                    {
                        TextBox1.Invoke(new MethodInvoker(delegate()
                        {
                            TextBox1.Text = result.ToString();
                        }));
                    }
                    pictureBox.Image = bitmap;
                }
                catch (Exception e)
                {
                    //MessageBox.Show("" + e);
                }
            }
        }
Ejemplo n.º 3
0
        private void UpdateMe()
        {
            Objects.Location loc;
            string str = "";
            if(ComboBox2.InvokeRequired)
            {
                ComboBox2.Invoke((MethodInvoker)delegate { str = ComboBox2.Text; });
                loc = GetLocation(str);
            }
            else
            {
                str = ComboBox2.Text;
                loc = GetLocation(str);
            }

            if(TextBox1.InvokeRequired)
            {
                TextBox1.Invoke((MethodInvoker)delegate { TextBox1.Text = loc.X.ToString(); });
            }
            else
            {
                TextBox1.Text = loc.X.ToString();
            }

            if (TextBox2.InvokeRequired)
            {
                TextBox2.Invoke((MethodInvoker)delegate { TextBox2.Text = loc.Y.ToString(); });
            }
            else
            {
                TextBox2.Text = loc.Y.ToString();
            }

            if (TextBox3.InvokeRequired)
            {
                TextBox3.Invoke((MethodInvoker)delegate { TextBox3.Text = loc.Z.ToString(); });
            }
            else
            {
                TextBox3.Text = loc.Z.ToString();
            }
        }