예제 #1
0
 private void DoWhenListSourceIsReset(object sender, PcGenEventArgs args)
 {
     if (!IsRefreshDeferred)
     {
         Refresh();
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Not refreshing, we are in a Deferred Refresh Cycle.");
     }
 }
예제 #2
0
        //private bool StartWatchingProp(PSAccessServiceInternalInterface storeAccessor, PropIdType propId, ref IDisposable unsubscriber)
        //{
        //    if (unsubscriber != null)
        //    {
        //        unsubscriber.Dispose();
        //        //System.Diagnostics.Debug.WriteLine("The PBCollectionDataProvider has a previous subscription, that is not being unsubscribed.");
        //    }

        //    unsubscriber = storeAccessor.RegisterHandler(propId, DoWhenListSourceIsReset, SubscriptionPriorityGroup.Internal, keepRef: false);
        //    return true;
        //}

        private void DoWhenListSourceIsReset(object sender, PcGenEventArgs args)
        {
            // TODO: Attempt to avoid unsubscribing, just to resubscribe, if the PropItem is the same.
            //_unsubscriber?.Dispose();
            //_unsubscriber = null;

            if (!IsRefreshDeferred)
            {
                Refresh();
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Not refreshing, we are in a Deferred Refresh Cycle.");
            }
        }
        private void CallPcGenEventSubscriber <TCaller>(object target, object sender, PcGenEventArgs e, Delegate d)
        {
            Action <TCaller, object, PcGenEventArgs> realDel = (Action <TCaller, object, PcGenEventArgs>)d;

            realDel((TCaller)target, sender, e);
        }