예제 #1
0
        private void Workspace_Changed(Events.Abstract e)
        {
            Changed = true;

            switch (e.type)
            {
            case Blockly.Events.CREATE:
                var cre = (Events.Create)e;
                BlockCreated?.Invoke(this, cre);
                break;

            case Blockly.Events.DELETE:
                var del = (Events.Delete)e;
                BlockDeleted?.Invoke(this, del);
                break;

            case Blockly.Events.CHANGE:
                var chg = (Events.Change)e;
                BlockChanged?.Invoke(this, chg);
                break;

            case Blockly.Events.MOVE:
                var mov = (Events.Move)e;
                BlockMoveed?.Invoke(this, mov);
                break;

            case Blockly.Events.UI:
                var ui = (Events.Ui)e;
                UiEvent?.Invoke(this, ui);
                break;
            }
        }
예제 #2
0
        private void OnPulse(object state)
        {
            lock (pendingTasks)
            {
                // Create new block
                Block block = CreateBlock();

                BlockCreated?.Invoke(block);
            }
        }
        internal byte[] GetBlock()
        {
            if (!smallPool.TryPop(out byte[] result))
            {
                result = new byte[BlockSize];
                BlockCreated?.Invoke();
            }
            else
            {
                Interlocked.Add(ref smallPoolFreeSize, -BlockSize);
            }

            Interlocked.Add(ref smallPoolInUseSize, BlockSize);
            return(result);
        }
예제 #4
0
 internal void ReportBlockCreated()
 {
     Counter.ReportBlockCreated();
     BlockCreated?.Invoke();
 }
 internal void ReportBlockCreated() => BlockCreated?.Invoke();