//Disconectar Câmera
 private void Disconnect(object sender, EventArgs e)
 {
     TearDownVisionSensorViewer();
     sensor.Dispose();
     sensor = null;
     UpdateControls();
 }
Exemplo n.º 2
0
 public void Initialize(IVisionSensor visionSensor)
 {
     CleanUp();
     sensor = visionSensor;
     sensor.ProgramSettingsUpdated += SensorProgramSettingsUpdated;
     // Display Initial Program List.
     SensorProgramSettingsUpdated(this, EventArgs.Empty);
 }
Exemplo n.º 3
0
 void Awake()
 {
     InitPrefabs();
     visionSensor = GetComponent <IVisionSensor>();
     if (visionSensor != null)
     {
         var child = GameObject.Instantiate(visionSensorPrefab, transform);
         child.GetComponent <SphereCollider>().radius = visionSensor.range;
         child.GetComponent <TriggerHandler>().caller = visionSensor;
         child.SetActive(true);
     }
 }
Exemplo n.º 4
0
        private void SensorDisposing(object sender, EventArgs e)
        {
            IVisionSensor key = (IVisionSensor)sender;

            key.Disposing -= new EventHandler(this.SensorDisposing);
            if (!this._dictionary.ContainsKey(key))
            {
                return;
            }
            this._dictionary[key].Disconnect();
            this._dictionary.Remove(key);
        }
 //Conecta IP e Porta
 private bool UpdateVisionSensorIVHSeriesObject()
 {
     try
     {
         sensor = store.CreateIVHSeries(iPePortasSensor.IpAddress, iPePortasSensor.PortNo);
     }
     catch (InvalidOperationException)
     {
         return(false);
     }
     catch (ConnectionLostException)
     {
         return(false);
     }
     return(true);
 }
 //Conecta IP e Porta
 private void UpdateVisionSensorObject()
 {
     if (UpdateVisionSensorIVHSeriesObject())
     {
         return;
     }
     try
     {
         sensor = store.Create(iPePortasSensor.IpAddress, iPePortasSensor.PortNo);
     }
     catch (InvalidOperationException e)
     {
         // You may have tried to create same VisionSensor object before disposing it.
         MessageBox.Show(e.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     catch (ConnectionLostException e)
     {
         MessageBox.Show(e.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }
Exemplo n.º 7
0
 public void Initialize(IVisionSensor visionSensor)
 {
     CleanUp();
     sensor = visionSensor;
     sensor.ImageAcquired += SensorImageAcquired;
 }