コード例 #1
0
        /// <summary>
        /// Loads interfaces and binds them to appropriate delegates
        /// </summary>
        private void LoadInterfaces()
        {
            // Find assembly that contains the needed class
            EventCollection events = CatalogConfiguration.Instance.Events;

            if (events != null)
            {
                foreach (EventDefinition eventDef in events)
                {
                    Type type = Type.GetType(eventDef.ClassName);

                    if (type == null)
                    {
                        // Log Exception here
                        continue;
                    }

                    if (type.IsAbstract)
                    {
                        continue;
                    }

                    foreach (Type intf in type.GetInterfaces())
                    {
                        if (intf == typeof(ICatalogEventListener))
                        {
                            ICatalogEventListener listener = (ICatalogEventListener)Activator.CreateInstance(type);

                            EntryUpdating += new EntryEventHandler(listener.EntryUpdating);
                            EntryUpdated  += new EntryEventHandler(listener.EntryUpdated);

                            NodeUpdating += new NodeEventHandler(listener.NodeUpdating);
                            NodeUpdated  += new NodeEventHandler(listener.NodeUpdated);

                            CatalogUpdating += new CatalogEventHandler(listener.CatalogUpdating);
                            CatalogUpdated  += new CatalogEventHandler(listener.CatalogUpdated);

                            AssociationUpdating += new AssociationEventHandler(listener.AssociationUpdating);
                            AssociationUpdated  += new AssociationEventHandler(listener.AssociationUpdated);

                            RelationUpdating += new RelationEventHandler(listener.RelationUpdating);
                            RelationUpdated  += new RelationEventHandler(listener.RelationUpdated);

                            // Save a handle
                            _Handles.Add(new ObjectHandle(listener));
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Circuit.cs プロジェクト: ptilulu/QuantumGate1-2018
        /// <summary>
        /// Crée un circuit vide aux dimensions spécifiées.
        /// </summary>
        /// <param name="rowCount"></param>
        /// <param name="colCount"></param>
        public Circuit(int rowCount, int colCount) : this()
        {
            this.OnSetEntry   = null;
            this.OnCreateGate = null;
            this.OnPutGate    = null;
            this.OnMoveGate   = null;
            this.OnRemoveGate = null;
            this.OnInsertRow  = null;
            this.OnMoveRow    = null;
            this.OnRemoveRow  = null;
            this.OnInsertCol  = null;
            this.OnMoveCol    = null;
            this.OnRemoveCol  = null;

            EnsureCapacity(rowCount, colCount);
        }
コード例 #3
0
        /// <summary>
        /// Fires the deleted.
        /// </summary>
        /// <param name="uuid">The UUID of the entry (or photo).</param>
        /// <param name="fullPath">The full path of the deleted file.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="type">The change type.</param>
        private void FireDeleted(Guid uuid, string fullPath, EntryEventHandler handler, ChangeType type)
        {
            // Fire the event.
            if (handler != null)
            {
                EntryEventArgs e = new EntryEventArgs(uuid, fullPath, type);

                if (this.SynchronizingObject != null && this.SynchronizingObject.InvokeRequired)
                {
                    this.SynchronizingObject.Invoke(new Action(delegate() { handler(this, e); }), null);
                }
                else
                {
                    handler(this, e);
                }
            }

            // Delete the timer object from the dictionary.
            if (this.EntryDeletionTimers.ContainsKey(uuid))
            {
                this.EntryDeletionTimers[uuid].Dispose();
                this.EntryDeletionTimers.Remove(uuid);
            }
        }
コード例 #4
0
ファイル: EntryWatcher.cs プロジェクト: gusper/Journaley
        /// <summary>
        /// Fires the deleted.
        /// </summary>
        /// <param name="uuid">The UUID of the entry (or photo).</param>
        /// <param name="fullPath">The full path of the deleted file.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="type">The change type.</param>
        private void FireDeleted(Guid uuid, string fullPath, EntryEventHandler handler, ChangeType type)
        {
            // Fire the event.
            if (handler != null)
            {
                EntryEventArgs e = new EntryEventArgs(uuid, fullPath, type);

                if (this.SynchronizingObject != null && this.SynchronizingObject.InvokeRequired)
                {
                    this.SynchronizingObject.Invoke(new Action(delegate() { handler(this, e); }), null);
                }
                else
                {
                    handler(this, e);
                }
            }

            // Delete the timer object from the dictionary.
            if (this.EntryDeletionTimers.ContainsKey(uuid))
            {
                this.EntryDeletionTimers[uuid].Dispose();
                this.EntryDeletionTimers.Remove(uuid);
            }
        }
コード例 #5
0
ファイル: Pusher.cs プロジェクト: rwakelam/Flow
 private static void RaiseEntryEvent(EntryEventHandler eventHandler, string path)
 {
     EntryEventHandler temp = eventHandler;
     if (temp != null)
     {
         EntryEventArgs eventArgs = new EntryEventArgs(path);
         temp(eventArgs);
     }
 }