Esempio n. 1
0
        public new void StartStack()
        {
            ContTimer_Sync = 0;

            // Se activa el timer para pedir datos
            TimerManagement.Interval  = TIMER_STATUS_TIME;
            TimerManagement.AutoReset = false;             // se debe activar de nuevo al salir del evento Elapsed
            TimerManagement.Start();
        }
        //Private Sub LoadAllToolTemps()
        //    'leer temperaturas de selección y niveles. Se usa al cambier el mínimo o máximo de la estación
        //    For index = 0 To Info_Port.Length - 1
        //        ReadSelectTemp(CType(index, cPort))
        //        For Each ToolIn As cls_ToolSettings In Info_Port(0).ToolParam.ToolSettings
        //            If ToolIn.Tool <> GenericStationTools.NOTOOL Then
        //                ReadLevelsTemps(CType(index, cPort), ToolIn.Tool)
        //            End If
        //        Next
        //    Next
        //End Sub

        #endregion

        #region Timers and Events

        public async void TimerStatus_Tick(object sender, System.EventArgs e)
        {
            //SyncLock LockTimer02
            // dentro de un try, porque se puede haber producido la desconexión de la estación
            // y haberse borrado las clases y threads correpondientes
            try
            {
                if (connectErrorStatus != EnumConnectError.NO_ERROR)
                {
                    return;
                }

                // el UpdateStationStatus se usa para sincronismo
                if (ContTimer_Sync > (TIMER_SYNC_COUNT - 1))
                {
                    await UpdateStationStatusAsync();

                    // obtener datos de modo continuo
                    ContTimer_Sync = 0;
                }
                else
                {
                    ContTimer_Sync++;
                }

                if (bSendCommandsFirstTime)
                {
                    // primera solicitud de todos los valores
                    await LoadStationParamAsync();
                    await LoadAllToolParamAsync();
                    await LoadAllPortStatusAsync();
                    await LoadAllPeripheralAsync();
                    await LoadAllCountersAsync();
                    await LoadEthernetConfigurationAsync();
                    await LoadRobotConfigurationAsync();

                    bSendCommandsFirstTime = false;
                }
            }
            catch (Exception)
            {
            }

            // se vuelve a activar
            if (TimerManagement != null)
            {
                TimerManagement.Start();
            }

            //End SyncLock
        }