public static void RaiseCurrentChanged(
            GridViewTemplate template,
            GridViewRowInfo row,
            GridViewColumn column,
            bool user)
        {
            if (template == null)
            {
                throw new ArgumentNullException("Template");
            }
            MasterGridViewTemplate masterTemplate = template.MasterTemplate;

            if (masterTemplate == null)
            {
                return;
            }
            GridViewEventInfo eventInfo  = new GridViewEventInfo(KnownEvents.CurrentChanged, GridEventType.Both, GridEventDispatchMode.Send);
            object            originator = user ? (object)(RadCollectionView <GridViewRowInfo>)null : (object)template.DataView;

            masterTemplate.SynchronizationService.DispatchEvent(new GridViewEvent((object)template, originator, new object[2]
            {
                (object)row,
                (object)column
            }, eventInfo));
        }
Exemple #2
0
        private void DispatchDataViewChangedEvent(DataViewChangedEventArgs args, GridEventType type)
        {
            GridViewEventInfo eventInfo = new GridViewEventInfo(KnownEvents.ViewChanged, type, GridEventDispatchMode.Send);

            GridViewSynchronizationService.DispatchEvent(this.owner, new GridViewEvent((object)this.owner, (object)this.owner, new object[1]
            {
                (object)args
            }, eventInfo), false);
        }
        protected virtual void NotifyListeners(GridViewEvent gridEvent)
        {
            GridViewEventInfo info = gridEvent.Info;
            bool flag = (info.Type & GridEventType.Data) == GridEventType.Data;

            if (flag && !this.IsDataEventDispatchSuspended && (!this.dataEntity.PreProcess(gridEvent) || !this.dataEntity.Process(gridEvent)) || (info.Type & GridEventType.UI) == GridEventType.UI && !this.IsUIEventDispatchSuspended && !this.uiEntity.ProcessEvent(gridEvent) || (!flag || this.IsDataEventDispatchSuspended))
            {
                return;
            }
            this.dataEntity.PostProcess(gridEvent);
        }
        protected virtual bool VerifyDispatch(GridViewEvent gridEvent)
        {
            if (this.IsDisposing || this.IsDisposed)
            {
                throw new ObjectDisposedException(nameof(GridViewSynchronizationService));
            }
            GridViewEventInfo info = gridEvent.Info;

            if (this.IsDispatchSuspended || this.IsUIEventDispatchSuspended && info.Type == GridEventType.UI || this.IsDataEventDispatchSuspended && info.Type == GridEventType.Data)
            {
                return(false);
            }
            return(!this.IsEventSuspended(info.Id));
        }
        protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs args)
        {
            base.OnCollectionChanged(args);
            if (this.Suspended)
            {
                return;
            }
            GridViewEventInfo eventInfo = new GridViewEventInfo(KnownEvents.CollectionChanged, GridEventType.Both, GridEventDispatchMode.Send);

            GridViewSynchronizationService.DispatchEvent(this.owner, new GridViewEvent((object)this, (object)null, new object[1]
            {
                (object)args
            }, eventInfo), false);
            this.owner.EventDispatcher.RaiseEvent <GridViewCollectionChangedEventArgs>(EventDispatcher.GroupByChanged, (object)this.owner, new GridViewCollectionChangedEventArgs(this.owner, args));
        }
        protected virtual void DispatchEvent(
            KnownEvents id,
            GridEventType type,
            GridEventDispatchMode dispatchMode,
            object originator,
            object[] arguments)
        {
            if (this.ViewTemplate == null)
            {
                return;
            }
            GridViewEventInfo eventInfo = new GridViewEventInfo(id, type, dispatchMode);

            GridViewSynchronizationService.DispatchEvent(this.ViewTemplate, new GridViewEvent((object)this, originator, arguments, eventInfo), false);
        }
 public void FlushEvents()
 {
     if (this.IsDisposing || this.IsDisposed)
     {
         throw new ObjectDisposedException(nameof(GridViewSynchronizationService));
     }
     ++this.dispatchingCount;
     do
     {
         this.AnalyzeQueue();
         if (this.eventsQueue.Count != 0)
         {
             this.currentEvent = this.eventsQueue.First.Value;
             this.eventsQueue.RemoveFirst();
             if (this.currentEvent.Info.DispatchMode == GridEventDispatchMode.Post)
             {
                 this.syncContext.Post(new SendOrPostCallback(this.OnPostCallback), (object)this.currentEvent);
             }
             else
             {
                 GridViewEvent     currentEvent = this.currentEvent;
                 GridViewEventInfo info         = currentEvent.Info;
                 bool flag = this.CanBeSuspended(info);
                 if (flag)
                 {
                     this.SuspendEvent(info.Id);
                 }
                 this.NotifyListeners(currentEvent);
                 this.currentEvent = currentEvent;
                 if (flag)
                 {
                     this.ResumeEvent(info.Id);
                 }
             }
             this.currentEvent = (GridViewEvent)null;
         }
         else
         {
             break;
         }
     }while (this.eventsQueue.Count > 0);
     --this.dispatchingCount;
 }
Exemple #8
0
        protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs args)
        {
            base.OnCollectionChanged(args);
            if (this.Suspended || this.owner == null)
            {
                return;
            }
            this.ApplyFilter();
            GridViewEventInfo eventInfo = new GridViewEventInfo(KnownEvents.CollectionChanged, GridEventType.Both, GridEventDispatchMode.Send);

            GridViewSynchronizationService.DispatchEvent(this.owner, new GridViewEvent((object)this, (object)null, new object[1]
            {
                (object)args
            }, eventInfo), false);
            this.owner.EventDispatcher.RaiseEvent <GridViewCollectionChangedEventArgs>(EventDispatcher.FilterChangedEvent, (object)this.owner, new GridViewCollectionChangedEventArgs(this.owner, args));
            if (!this.owner.IsSelfReference || !this.owner.EnableHierarchyFiltering)
            {
                return;
            }
            this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.GroupingChanged));
        }
        public static void DispatchEvent(
            GridViewTemplate template,
            GridViewEvent eventData,
            bool postUI)
        {
            if (template == null)
            {
                throw new ArgumentNullException("Template");
            }
            MasterGridViewTemplate masterTemplate = template.MasterTemplate;

            if (masterTemplate == null)
            {
                return;
            }
            GridViewSynchronizationService synchronizationService = masterTemplate.SynchronizationService;

            if (synchronizationService == null)
            {
                return;
            }
            if (eventData.Info.Type == GridEventType.Both && postUI)
            {
                KnownEvents       id         = eventData.Info.Id;
                bool              critical   = eventData.Info.Critical;
                object[]          arguments  = eventData.Arguments;
                object            sender     = eventData.Sender;
                object            originator = eventData.Originator;
                GridViewEventInfo eventInfo1 = new GridViewEventInfo(id, GridEventType.Data, GridEventDispatchMode.Send, critical);
                GridViewEvent     gridEvent1 = new GridViewEvent(sender, originator, arguments, eventInfo1);
                GridViewEventInfo eventInfo2 = new GridViewEventInfo(id, GridEventType.UI, GridEventDispatchMode.Post, critical);
                GridViewEvent     gridEvent2 = new GridViewEvent(sender, originator, arguments, eventInfo2);
                synchronizationService.DispatchEvent(gridEvent1);
                synchronizationService.DispatchEvent(gridEvent2);
            }
            else
            {
                synchronizationService.DispatchEvent(eventData);
            }
        }
        private void OnPostCallback(object state)
        {
            GridViewEvent gridEvent = state as GridViewEvent;

            if (gridEvent == null || this.IsDisposing || this.IsDisposed)
            {
                return;
            }
            GridViewEventInfo info = gridEvent.Info;
            bool flag = this.CanBeSuspended(info);

            if (flag)
            {
                this.SuspendEvent(info.Id);
            }
            this.NotifyListeners(gridEvent);
            if (!flag)
            {
                return;
            }
            this.ResumeEvent(info.Id);
        }
 protected virtual bool CanBeSuspended(GridViewEventInfo eventInfo)
 {
     return(eventInfo.Id != KnownEvents.PropertyChanged);
 }