Esempio n. 1
0
        public static void RunAsynchronouslyNoThrow <T>(IEnumerable <Sink <T> > enumerable, Action <T> callback, LogItemType type, string category)
            where T : class
        {
            Action <T> wrappedCb = delegate(T cur)
            {
                try
                {
                    callback(cur);
                }
                catch (Exception ex)
                {
                    Logger.Log(type, category, ex.Message, ex);
                }
            };

            foreach (Sink <T> cur in enumerable)
            {
                try
                {
                    SafeInvoke.BeginInvoke(cur.ISynchronizeInvoke, wrappedCb, cur.ISink);
                }
                catch (Exception ex)
                {
                    Logger.Log(type, category, ex.Message, ex);
                }
            }
        }
Esempio n. 2
0
 public static void RunAsynchronously <T>(IEnumerable <Sink <T> > enumerable, Action <T> callback)
     where T : class
 {
     foreach (Sink <T> cur in enumerable)
     {
         SafeInvoke.BeginInvoke(cur.ISynchronizeInvoke, callback, cur.ISink);
     }
 }
Esempio n. 3
0
 private void UpdateTracker()
 {
     if (m_tracker != null && !m_finished)
     {
         // Do a BeginInvoke here because the Invoke operation
         // can very likely block.  Avoid that by using BeginInvoke
         //
         // Since we'll use the current values anyways, don't post multiple BeginInvokes onto
         // the tracker or we could overload it.  Instead post one at a time.
         try
         {
             SafeInvoke.BeginInvoke(m_tracker, new Action(UpdateTrackerDirect));
         }
         catch (Exception ex)
         {
             Logger.Error(FutureLogCategory.BeginInvoke, ex.Message, ex);
         }
     }
 }
Esempio n. 4
0
 public IAsyncResult BeginInvoke(SinkCallback <T> callback)
 {
     return(SafeInvoke.BeginInvoke(m_invoke, () => callback(this)));
 }