Beispiel #1
0
        /// <summary>
        /// Генерирует событие при возникновении ошибок в CAN адаптере
        /// </summary>
        private void OnErrorReceived(ERROR error)
        {
            EventHandlerErrorRecived handler = this.ErrorReceived;
            EventArgsLineErrorRecived args = new EventArgsLineErrorRecived(error);   
            
            if (handler != null)
            {
                foreach (EventHandler SingleCast in handler.GetInvocationList())
                {
                    ISynchronizeInvoke syncInvoke = SingleCast.Target as ISynchronizeInvoke;

                    try
                    {
                        if ((syncInvoke != null) && (syncInvoke.InvokeRequired))
                        {
                            syncInvoke.Invoke(SingleCast, new Object[] { this, args });
                        }
                        else
                        {
                            SingleCast(this, args);
                        }
                    }
                    catch
                    {
                        throw;
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Генерирует событие при возникновении ошибки
        /// </summary>
        /// <param name="error">Ошибка</param>
        protected virtual void OnErrorRecive(ERROR error)
        {
            NGK.CAN.DataLinkLayer.CanPort.EventArgsLineErrorRecived args = 
                new EventArgsLineErrorRecived(error);
            EventHandlerErrorRecived handler = this.ErrorReceived;

            //#if DEBUG
            //WindowsDebugging.WriteLine("ERROR: " + error.ToString(), Category.Error);
            //#endif

            if (handler != null)
            {
                foreach (EventHandlerErrorRecived SingleCast in handler.GetInvocationList())
                {
                    ISynchronizeInvoke syncInvoke = SingleCast.Target as ISynchronizeInvoke;

                    try
                    {
                        if ((syncInvoke != null) && (syncInvoke.InvokeRequired))
                        {
                            syncInvoke.Invoke(SingleCast, new Object[] { this, args });
                        }
                        else
                        {
                            SingleCast(this, args);
                        }
                    }
                    catch
                    { throw; }
                }
            }
            return;
        }
Beispiel #3
0
 /// <summary>
 /// Обработчик события аварийной ситуации от CAN-порта
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="error"></param>
 private void EventHandler_CanPort_ErrorReceived(object sender,
     EventArgsLineErrorRecived error)
 {
     throw new NotImplementedException();
 }