public void TryAddCount(IMyCubeBlock block) { if (method.Invoke(block)) { Count++; OnBlockAdded?.Invoke(block); } }
/// <summary> /// Adds a new connection to the currently active ones /// </summary> /// <param name="obj">The connectable to add</param> public void AddConnectable(IConnectable obj) { lock (_tickLock) { // Register the node and add some metadata if (Nodes.Contains(obj)) { return; } Nodes.Add(obj); obj.Id = _nodeIndex++; // Get a name to call the object if not specified if (string.IsNullOrEmpty(obj.Name)) { obj.Name = obj.InternalName + " " + obj.Id; } _connectableMetadata.Add(obj, new IConnectableMetadata()); // Check to see if the connection has a ticker var dc = obj as DataConnection; if (dc != null && dc.Poller != null && dc.Poller.IsTickPoller) { // Add the ticker and start the timer as needed _tickers.Add(dc.Poller); if (_tickers.Count == 1) { _tickTimer.Change(TickTime, Timeout.Infinite); } } OnBlockAdded?.Invoke(this, obj); } }
public void AddBlock(IBlockModel block) { _blocks.Add(block); OnBlockAdded?.Invoke(block); }
public void AddBlock(BlockInfo block) { Blocks.Add(block); OnBlockAdded?.Invoke(block); }