Exemplo n.º 1
0
        /// <summary>
        /// <para>
        /// Handler of new subscription result
        /// </para>
        /// </summary>
        /// <param name="src"></param>
        /// <param name="args"></param>
        private void NewSubscriptionResultHandler(object src, CimSubscriptionEventArgs args)
        {
            EventHandler <CimIndicationEventArgs> temp = this.CimIndicationArrived;

            if (temp != null)
            {
                // raise the event
                CimSubscriptionResultEventArgs resultArgs = args as CimSubscriptionResultEventArgs;
                if (resultArgs != null)
                {
                    temp(this, new CimIndicationEventInstanceEventArgs(resultArgs.Result));
                }
                else
                {
                    CimSubscriptionExceptionEventArgs exceptionArgs = args as CimSubscriptionExceptionEventArgs;
                    if (exceptionArgs != null)
                    {
                        temp(this, new CimIndicationEventExceptionEventArgs(exceptionArgs.Exception));
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void NewSubscriptionResultHandler(object src, CimSubscriptionEventArgs args)
        {
            EventHandler <CimIndicationEventArgs> eventHandler = this.CimIndicationArrived;

            if (eventHandler != null)
            {
                CimSubscriptionResultEventArgs cimSubscriptionResultEventArg = args as CimSubscriptionResultEventArgs;
                if (cimSubscriptionResultEventArg == null)
                {
                    CimSubscriptionExceptionEventArgs cimSubscriptionExceptionEventArg = args as CimSubscriptionExceptionEventArgs;
                    if (cimSubscriptionExceptionEventArg != null)
                    {
                        eventHandler(this, new CimIndicationEventExceptionEventArgs(cimSubscriptionExceptionEventArg.Exception));
                    }
                }
                else
                {
                    eventHandler(this, new CimIndicationEventInstanceEventArgs(cimSubscriptionResultEventArg.Result));
                    return;
                }
            }
        }