示例#1
0
        private void OnRemoteEventCounts(string name, int count)
        {
            var args = new FbRemoteEventCountsEventArgs(name, count);

            _synchronizationContext.Post(_ =>
            {
                RemoteEventCounts?.Invoke(this, args);
            }, null);
        }
        private void OnRemoteEventCounts()
        {
            bool canceled = false;

            int[] actualCounts = (int[])_revent.ActualCounts.Clone();
            if (_revent.PreviousCounts != null)
            {
                for (int i = 0; i < _revent.ActualCounts.Length; i++)
                {
                    actualCounts[i] -= _revent.PreviousCounts[i];
                }
            }

            // Send individual event notifications
            for (int i = 0; i < actualCounts.Length; i++)
            {
                FbRemoteEventEventArgs args = new FbRemoteEventEventArgs(_revent.Events[i], actualCounts[i]);
                _synchronizationContext.Send(_ =>
                {
                    RemoteEventCounts?.Invoke(this, args);
                }, null);

                if (args.Cancel)
                {
                    canceled = true;
                    break;
                }
            }

            if (canceled)
            {
                // Requeque
                CancelEvents();
            }
            else
            {
                // Requeque
                QueueEvents();
            }
        }