예제 #1
0
        /// <summary>
        /// Raises the <see cref="E:ProgressChanged"/> event.
        /// </summary>
        /// <param name="e">The <see cref="MLifterAudioBookGenerator.ProgressChangedEventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev02, 2008-05-20</remarks>
        public static void OnProgressChanged(ProgressChangedEventArgs e)
        {
            ProgressChangedEventHandler handler = ProgressChanged;

            if (handler != null)
            {
                foreach (ProgressChangedEventHandler caster in handler.GetInvocationList())
                {
                    ISynchronizeInvoke SyncInvoke = caster.Target as ISynchronizeInvoke;
                    try
                    {
                        if (SyncInvoke != null && SyncInvoke.InvokeRequired)
                        {
                            SyncInvoke.Invoke(handler, new object[] { null, e });
                        }
                        else
                        {
                            caster(null, e);
                        }
                    }
                    catch
                    { }
                }
            }
        }
예제 #2
0
        void RaiseProgressChangedEventFromClientContext(object state)
        {
            ProgressChangedEventArgs eventArgs = (ProgressChangedEventArgs)state;

            Delegate[] targets;

            lock (_operationProgressChangedLock)
            {
                targets = _operationProgressChanged.GetInvocationList();
            }

            foreach (ProgressChangedEventHandler handler in targets)
            {
                try
                {
                    handler(this, eventArgs);
                }
                catch
                {
                }
            }
        }