コード例 #1
0
        /// <summary>
        /// Disposes all components in the chain.
        /// </summary>
        /// <param name="disposeKind">The type of resources to dispose.</param>
        protected override void Dispose(DisposeObjectKind disposeKind)
        {
            if (!IsDisposed)
            {
                if (disposeKind == DisposeObjectKind.ManagedAndUnmanagedResources)
                {
                    foreach (var senderComponent in this.Senders)
                    {
                        if (this.MidiPort != null)
                        {
                            IInitializeByMidiPort init = senderComponent as IInitializeByMidiPort;

                            if (init != null)
                            {
                                init.Uninitialize(this.MidiPort);
                            }
                        }

                        IDisposable disposable = senderComponent as IDisposable;

                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }

                    this.sender = null;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes all chain components that implement the <see cref="T:IInitializeByMidiPort"/>.
        /// </summary>
        public virtual void Initialize()
        {
            ThrowIfDisposed();

            // initialize all receivers that implement IInitializeByMidiPort
            foreach (var receiverComponent in this.Receivers)
            {
                IInitializeByMidiPort init = receiverComponent as IInitializeByMidiPort;

                if (init != null)
                {
                    init.Initialize(this.MidiPort);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Initializes the sender chain components that implement the <see cref="IInitializeByMidiPort"/>.
        /// </summary>
        public virtual void Initialize()
        {
            if (this.MidiPort == null)
            {
                throw new InvalidOperationException("The Midi Port property was not initialized.");
            }

            foreach (var senderComponent in this.Senders)
            {
                IInitializeByMidiPort init = senderComponent as IInitializeByMidiPort;

                if (init != null)
                {
                    init.Initialize(this.MidiPort);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Disposes all components in the chain.
        /// </summary>
        /// <param name="disposeKind">The type of resources to dispose.</param>
        protected override void Dispose(DisposeObjectKind disposeKind)
        {
            if (!IsDisposed)
            {
                if (disposeKind == DisposeObjectKind.ManagedAndUnmanagedResources)
                {
                    foreach (var receiverComponent in this.Receivers)
                    {
                        if (this.MidiPort != null)
                        {
                            IInitializeByMidiPort init = receiverComponent as IInitializeByMidiPort;

                            if (init != null)
                            {
                                init.Uninitialize(this.MidiPort);
                            }
                        }

                        IDisposable disposable = receiverComponent as IDisposable;

                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }

                    IDisposable disposableChain = this.RootChain as IDisposable;

                    // clears RootChain, CurrentChain and Receiver
                    this.RootChain = null;

                    if (disposableChain != null)
                    {
                        disposableChain.Dispose();
                    }
                }
            }
        }