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; } }
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); }
private void ApplyEvent(BlockCreated e) { _hash = e.Hash; _previousHash = e.PreviousHash; }
internal void ReportBlockCreated() { Counter.ReportBlockCreated(); BlockCreated?.Invoke(); }
internal void ReportBlockCreated() => BlockCreated?.Invoke();
private void When(BlockCreated e) { _blocks[e.Hash] = e.BlockId; }