private static int GetEventHandleLength()
        {
            int length = 0;

            length += (DeleteEventHandler == null) ? 0 : DeleteEventHandler.GetInvocationList().Length;
            length += (UpdateEventHandler == null) ? 0 : UpdateEventHandler.GetInvocationList().Length;
            length += (AddEventHandler == null) ? 0 : AddEventHandler.GetInvocationList().Length;

            return(length);
        }
        private static void ChangedEvent(IntPtr userData, NotificationType type, IntPtr operationList, int num)
        {
            IntPtr operationType;
            IntPtr uniqueNumber;
            IntPtr notification;

            NotificationEventArgs       eventargs;
            NotificationDeleteEventArgs deleteargs;

            for (int i = 0; i < num; i++)
            {
                uniqueNumber  = IntPtr.Zero;
                operationType = IntPtr.Zero;
                notification  = IntPtr.Zero;

                Interop.NotificationEventListener.GetOperationData(operationList + (i * Marshal.SizeOf <NotificationOperation>()), NotificationOperationDataType.Type, out operationType);
                Interop.NotificationEventListener.GetOperationData(operationList + (i * Marshal.SizeOf <NotificationOperation>()), NotificationOperationDataType.UniqueNumber, out uniqueNumber);
                Interop.NotificationEventListener.GetOperationData(operationList + (i * Marshal.SizeOf <NotificationOperation>()), NotificationOperationDataType.Notification, out notification);

                if (operationType == IntPtr.Zero)
                {
                    Log.Error(LogTag, "unable to get operationType");
                    continue;
                }

                Log.Info(LogTag, "type : " + ((int)operationType).ToString());
                Log.Info(LogTag, "Add : " + (AddEventHandler == null ? "0" : AddEventHandler.GetInvocationList().Length.ToString()));
                Log.Info(LogTag, "update: " + (UpdateEventHandler == null ? "0" : UpdateEventHandler.GetInvocationList().Length.ToString()));
                Log.Info(LogTag, "delete : " + (DeleteEventHandler == null ? "0" : DeleteEventHandler.GetInvocationList().Length.ToString()));

                switch ((int)operationType)
                {
                case (int)NotificationOperationType.Insert:
                    if (notification != IntPtr.Zero)
                    {
                        try
                        {
                            eventargs = NotificationEventArgsBinder.BindObject(notification, false);
                            AddEventHandler?.Invoke(null, eventargs);
                        }
                        catch (Exception e)
                        {
                            Log.Error(LogTag, e.Message);
                        }
                    }

                    break;

                case (int)NotificationOperationType.Update:
                    if (notification != IntPtr.Zero)
                    {
                        try
                        {
                            eventargs = NotificationEventArgsBinder.BindObject(notification, false);
                            UpdateEventHandler?.Invoke(null, eventargs);
                        }
                        catch (Exception e)
                        {
                            Log.Error(LogTag, e.Message);
                        }
                    }

                    break;

                case (int)NotificationOperationType.Delete:
                    if (uniqueNumber != IntPtr.Zero)
                    {
                        try
                        {
                            deleteargs = NotificationDeleteEventArgsBinder.BindObject((int)uniqueNumber);
                            DeleteEventHandler?.Invoke(null, deleteargs);
                        }
                        catch (Exception e)
                        {
                            Log.Error(LogTag, e.Message);
                        }
                    }

                    break;

                default:
                    Log.Info(LogTag, "Event : " + (int)operationType);
                    break;
                }
            }
        }