Пример #1
0
            public void Fire_ObjectDeleting(StorageContext context, T obj, ref bool cancel)
            {
                if (ObjectDeleting != null)
                {
                    var evArgs = new ObjectWithCancelEventArgs <T>(obj);

                    ObjectDeleting(context, evArgs);

                    cancel = evArgs.Cancel;
                }
            }
Пример #2
0
            public void Fire_ObjectSaving(StorageContext context, T obj, ref bool cancel)
            {
                if (ObjectSaving != null)
                {
                    var evArgs = new ObjectWithCancelEventArgs <T>(obj);

                    foreach (var @delegate in ObjectSaving.GetInvocationList())
                    {
                        var ev = (EventHandler <ObjectWithCancelEventArgs <T> >)@delegate;

                        ev(context, evArgs);

                        if (evArgs.Cancel)
                        {
                            cancel = evArgs.Cancel;
                            return;
                        }
                    }
                }
            }