コード例 #1
0
        internal static void ConnectCallbacks(StackFrame parentFrame, params ObjectValue[] values)
        {
            Dictionary <IObjectValueUpdater, List <UpdateCallback> > callbacks = null;
            List <ObjectValue> valueList = new List <ObjectValue> (values);

            for (int n = 0; n < valueList.Count; n++)
            {
                ObjectValue val = valueList [n];
                val.source      = parentFrame.DebuggerSession.WrapDebuggerObject(val.source);
                val.updater     = parentFrame.DebuggerSession.WrapDebuggerObject(val.updater);
                val.parentFrame = parentFrame;
                UpdateCallback cb = val.GetUpdateCallback();
                if (cb != null)
                {
                    if (callbacks == null)
                    {
                        callbacks = new Dictionary <IObjectValueUpdater, List <UpdateCallback> > ();
                    }
                    List <UpdateCallback> list;
                    if (!callbacks.TryGetValue(val.Updater, out list))
                    {
                        list = new List <UpdateCallback> ();
                        callbacks [val.Updater] = list;
                    }
                    list.Add(cb);
                }
                if (val.children != null)
                {
                    valueList.AddRange(val.children);
                }
            }
            if (callbacks != null)
            {
                // Do the callback connection in a background thread
                System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                    foreach (KeyValuePair <IObjectValueUpdater, List <UpdateCallback> > cbs in callbacks)
                    {
                        cbs.Key.RegisterUpdateCallbacks(cbs.Value.ToArray());
                    }
                });
            }
        }