Ejemplo n.º 1
0
        internal void _Detach(PageFunctionBase pf)
        {
            if (pf._Return != null && pf._Saver == null)
            {
                ReturnEventSaverInfo[] list = null;

                Delegate[] delegates = null;

                delegates = (pf._Return).GetInvocationList();
                list      = _returnList = new ReturnEventSaverInfo[delegates.Length];

                for (int i = 0; i < delegates.Length; i++)
                {
                    Delegate returnDelegate = delegates[i];
                    bool     bSamePf        = false;

                    if (returnDelegate.Target == pf)
                    {
                        // This is the Event Handler implemented by the same PF, use for NonGeneric handling.
                        bSamePf = true;
                    }

                    MethodInfo           m    = returnDelegate.Method;
                    ReturnEventSaverInfo info = new ReturnEventSaverInfo(
                        returnDelegate.GetType().AssemblyQualifiedName,
                        returnDelegate.Target.GetType().AssemblyQualifiedName,
                        m.Name, bSamePf);

                    list[i] = info;
                }

                //
                // only save if there were delegates already attached.
                // note that there will be cases where the Saver has already been pre-populated from a Load
                // but no delegates have been created yet ( as the PF hasn`t called finish as yet)
                //
                // By only storing the saver once there are delegates - we avoid the problem of
                // wiping out any newly restored saver
                pf._Saver = this;
            }

            pf._DetachEvents();
        }
Ejemplo n.º 2
0
        internal void _Detach(PageFunctionBase pf)
        {
            if (pf._Return != null && pf._Saver == null)
            { 
                ReturnEventSaverInfo[] list = null;
 
                Delegate[] delegates = null; 

                delegates = (pf._Return).GetInvocationList(); 
                list = _returnList = new ReturnEventSaverInfo[delegates.Length];

                for (int i = 0; i < delegates.Length; i++)
                { 
                    Delegate returnDelegate = delegates[i];
                    bool bSamePf = false; 
 
                    if (returnDelegate.Target == pf)
                    { 
                        // This is the Event Handler implemented by the same PF, use for NonGeneric handling.
                        bSamePf = true;
                    }
 
                    MethodInfo m = returnDelegate.Method;
                    ReturnEventSaverInfo info = new ReturnEventSaverInfo( 
                        returnDelegate.GetType().AssemblyQualifiedName, 
                        returnDelegate.Target.GetType().AssemblyQualifiedName,
                        m.Name, bSamePf); 

                    list[i] = info;
                }
 
                //
                // only save if there were delegates already attached. 
                // note that there will be cases where the Saver has already been pre-populated from a Load 
                // but no delegates have been created yet ( as the PF hasn`t called finish as yet)
                // 
                // By only storing the saver once there are delegates - we avoid the problem of
                // wiping out any newly restored saver
                pf._Saver = this;
            } 

            pf._DetachEvents(); 
        } 
 internal void _Detach(PageFunctionBase pf)
 {
     if (pf._Return != null && pf._Saver == null)
     {
         Delegate[]             invocationList = pf._Return.GetInvocationList();
         ReturnEventSaverInfo[] array          = this._returnList = new ReturnEventSaverInfo[invocationList.Length];
         for (int i = 0; i < invocationList.Length; i++)
         {
             Delegate @delegate = invocationList[i];
             bool     fSamePf   = false;
             if (@delegate.Target == pf)
             {
                 fSamePf = true;
             }
             MethodInfo           method = @delegate.Method;
             ReturnEventSaverInfo returnEventSaverInfo = new ReturnEventSaverInfo(@delegate.GetType().AssemblyQualifiedName, @delegate.Target.GetType().AssemblyQualifiedName, method.Name, fSamePf);
             array[i] = returnEventSaverInfo;
         }
         pf._Saver = this;
     }
     pf._DetachEvents();
 }